toplevel.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * File : toplevel.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2009-10-16 Bernard first version
  13. */
  14. #ifndef __RTGUI_TOPLEVEL_H__
  15. #define __RTGUI_TOPLEVEL_H__
  16. #include <rtgui/widgets/container.h>
  17. /** Gets the type of a toplevel */
  18. #define RTGUI_TOPLEVEL_TYPE (rtgui_toplevel_type_get())
  19. /** Casts the object to an rtgui_toplevel */
  20. #define RTGUI_TOPLEVEL(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_TOPLEVEL_TYPE, rtgui_toplevel_t))
  21. /** Checks if the object is an rtgui_toplevel */
  22. #define RTGUI_IS_TOPLEVEL(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_TOPLEVEL_TYPE))
  23. struct rtgui_toplevel
  24. {
  25. /* inherit from container */
  26. rtgui_container_t parent;
  27. /* drawing count */
  28. rt_base_t drawing;
  29. /* external clip info */
  30. rtgui_rect_t* external_clip_rect;
  31. rt_uint32_t external_clip_size;
  32. /* server thread id */
  33. rt_thread_t server;
  34. /* current focus widget */
  35. rtgui_widget_t* focus;
  36. };
  37. typedef struct rtgui_toplevel rtgui_toplevel_t;
  38. rtgui_type_t *rtgui_toplevel_type_get(void);
  39. rt_bool_t rtgui_toplevel_event_handler(rtgui_widget_t* widget, rtgui_event_t* event);
  40. void rtgui_toplevel_handle_clip(struct rtgui_toplevel* top,
  41. struct rtgui_event_clip_info* info);
  42. void rtgui_toplevel_update_clip(rtgui_toplevel_t* top);
  43. void rtgui_toplevel_set_focus(struct rtgui_toplevel* top, rtgui_widget_t* focus);
  44. rtgui_widget_t* rtgui_toplevel_get_focus(struct rtgui_toplevel* top);
  45. #endif