container.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * File : box.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_BOX_H__
  15. #define __RTGUI_BOX_H__
  16. #include <rtgui/widgets/widget.h>
  17. #include <rtgui/event.h>
  18. /** Gets the type of a box */
  19. #define RTGUI_CONTAINER_TYPE (rtgui_container_type_get())
  20. /** Casts the object to a rtgui_container_t */
  21. #define RTGUI_CONTAINER(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_CONTAINER_TYPE, rtgui_container_t))
  22. /** Checks if the object is a rtgui_container_t */
  23. #define RTGUI_IS_CONTAINER(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_CONTAINER_TYPE))
  24. struct rtgui_container
  25. {
  26. /* inherit from widget */
  27. rtgui_widget_t parent;
  28. rtgui_widget_t *focused;
  29. rtgui_list_t children;
  30. };
  31. typedef struct rtgui_container rtgui_container_t;
  32. rtgui_type_t *rtgui_container_type_get(void);
  33. void rtgui_container_add_child(PVOID cbox, PVOID wdt);
  34. void rtgui_container_remove_child(rtgui_container_t *box, PVOID wdt);
  35. void rtgui_container_destroy_children(rtgui_container_t *box);
  36. rtgui_widget_t* rtgui_container_get_first_child(rtgui_container_t* box);
  37. rt_bool_t rtgui_container_event_handler(PVOID wdt, rtgui_event_t* event);
  38. rt_bool_t rtgui_container_dispatch_event(rtgui_container_t *box, rtgui_event_t* event);
  39. rt_bool_t rtgui_container_dispatch_mouse_event(rtgui_container_t *box, rtgui_event_mouse_t* event);
  40. #endif