view.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. DECLARE_CLASS_TYPE(view);
  22. /** Gets the type of a view */
  23. #define RTGUI_VIEW_TYPE (RTGUI_TYPE(view))
  24. /** Casts the object to an rtgui_view */
  25. #define RTGUI_VIEW(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_VIEW_TYPE, rtgui_view_t))
  26. /** Checks if the object is an rtgui_view */
  27. #define RTGUI_IS_VIEW(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_VIEW_TYPE))
  28. /*
  29. * the view widget
  30. */
  31. struct rtgui_view
  32. {
  33. /* inherit from container */
  34. struct rtgui_container parent;
  35. /* private field */
  36. char* title;
  37. rt_bool_t modal_show;
  38. };
  39. typedef struct rtgui_view rtgui_view_t;
  40. rtgui_view_t* rtgui_view_create(const char* title);
  41. void rtgui_view_destroy(rtgui_view_t* view);
  42. rt_bool_t rtgui_view_event_handler(struct rtgui_widget* widget, struct rtgui_event* event);
  43. #ifndef RTGUI_USING_SMALL_SIZE
  44. void rtgui_view_set_box(rtgui_view_t* view, rtgui_box_t* box);
  45. #endif
  46. rtgui_modal_code_t rtgui_view_show(rtgui_view_t* view, rt_bool_t is_modal);
  47. void rtgui_view_hide(rtgui_view_t* view);
  48. void rtgui_view_end_modal(rtgui_view_t* view, rtgui_modal_code_t modal_code);
  49. char* rtgui_view_get_title(rtgui_view_t* view);
  50. void rtgui_view_set_title(rtgui_view_t* view, const char* title);
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54. #endif