box.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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/rtgui.h>
  17. #include <rtgui/widgets/widget.h>
  18. #include <rtgui/widgets/container.h>
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. DECLARE_CLASS_TYPE(box);
  23. /** Gets the type of a box */
  24. #define RTGUI_BOX_TYPE (RTGUI_TYPE(box))
  25. /** Casts the object to an rtgui_box */
  26. #define RTGUI_BOX(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_BOX_TYPE, rtgui_box_t))
  27. /** Checks if the object is an rtgui_box */
  28. #define RTGUI_IS_BOX(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_BOX_TYPE))
  29. struct rtgui_box
  30. {
  31. struct rtgui_container parent;
  32. rt_uint16_t orient;
  33. rt_uint16_t border_size;
  34. };
  35. typedef struct rtgui_box rtgui_box_t;
  36. struct rtgui_box* rtgui_box_create(int orientation, rtgui_rect_t* rect);
  37. void rtgui_box_destroy(struct rtgui_box* box);
  38. rt_bool_t rtgui_box_event_handler(rtgui_widget_t* widget, rtgui_event_t* event);
  39. void rtgui_box_append(rtgui_box_t* box, rtgui_widget_t* widget);
  40. void rtgui_box_layout(rtgui_box_t* box);
  41. rt_uint32_t rtgui_box_get_width(rtgui_box_t* box);
  42. rt_uint32_t rtgui_box_get_height(rtgui_box_t* box);
  43. #ifdef __cplusplus
  44. }
  45. #endif
  46. #endif