view.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * File : view.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_VIEW_H__
  15. #define __RTGUI_VIEW_H__
  16. #include <rtgui/widgets/box.h>
  17. #include <rtgui/widgets/container.h>
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. /** Gets the type of a view */
  22. #define RTGUI_VIEW_TYPE (rtgui_view_type_get())
  23. /** Casts the object to an rtgui_view */
  24. #define RTGUI_VIEW(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_VIEW_TYPE, rtgui_view_t))
  25. /** Checks if the object is an rtgui_view */
  26. #define RTGUI_IS_VIEW(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_VIEW_TYPE))
  27. /*
  28. * the view widget
  29. */
  30. struct rtgui_view
  31. {
  32. /* inherit from container */
  33. struct rtgui_container parent;
  34. /* private field */
  35. char* title;
  36. };
  37. typedef struct rtgui_view rtgui_view_t;
  38. rtgui_view_t* rtgui_view_create(const char* title);
  39. void rtgui_view_destroy(rtgui_view_t* view);
  40. rt_bool_t rtgui_view_event_handler(struct rtgui_widget* widget, struct rtgui_event* event);
  41. void rtgui_view_set_box(rtgui_view_t* view, rtgui_box_t* box);
  42. void rtgui_view_show(rtgui_view_t* view);
  43. void rtgui_view_hide(rtgui_view_t* view);
  44. char* rtgui_view_get_title(rtgui_view_t* view);
  45. void rtgui_view_set_title(rtgui_view_t* view, const char* title);
  46. #ifdef __cplusplus
  47. }
  48. #endif
  49. #endif