workbench.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * File : workbench.h
  3. * This file is part of RTGUI in 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-04 Bernard first version
  13. */
  14. #ifndef __RTGUI_WORKBENCH_H__
  15. #define __RTGUI_WORKBENCH_H__
  16. #include <rtgui/rtgui.h>
  17. #include <rtgui/list.h>
  18. #include <rtgui/region.h>
  19. #include <rtgui/dc.h>
  20. #include <rtgui/widgets/view.h>
  21. #include <rtgui/widgets/toplevel.h>
  22. #define RTGUI_WORKBENCH_FLAG_VISIBLE 0x00 /* workbench is visible */
  23. #define RTGUI_WORKBENCH_FLAG_INVISIBLE 0x01 /* workbench is invisible */
  24. #define RTGUI_WORKBENCH_FLAG_FULLSCREEN 0x02 /* workbench is full screen */
  25. #define RTGUI_WORKBENCH_FLAG_MODAL_MODE 0x04 /* workbench is modal mode showing */
  26. #define RTGUI_WORKBENCH_FLAG_CLOSEBLE 0x00
  27. #define RTGUI_WORKBENCH_FLAG_UNCLOSEBLE 0x10
  28. #define RTGUI_WORKBENCH_FLAG_CLOSED 0x20
  29. #define RTGUI_WORKBENCH_FLAG_DEFAULT RTGUI_WORKBENCH_FLAG_VISIBLE | RTGUI_WORKBENCH_FLAG_CLOSEBLE
  30. #define RTGUI_WORKBENCH_IS_MODAL_MODE(w) ((w)->flag & RTGUI_WORKBENCH_FLAG_MODAL_MODE)
  31. DECLARE_CLASS_TYPE(workbench);
  32. /** Gets the type of a workbench */
  33. #define RTGUI_WORKBENCH_TYPE (RTGUI_TYPE(workbench))
  34. /** Casts the object to an rtgui_workbench */
  35. #define RTGUI_WORKBENCH(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_WORKBENCH_TYPE, rtgui_workbench_t))
  36. /** Checks if the object is an rtgui_workbench */
  37. #define RTGUI_IS_WORKBENCH(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_WORKBENCH_TYPE))
  38. struct rtgui_workbench
  39. {
  40. /* inherit from toplevel */
  41. struct rtgui_toplevel parent;
  42. /* panel id */
  43. rtgui_panel_t* panel;
  44. /* workbench flag */
  45. rt_uint8_t flag;
  46. rtgui_modal_code_t modal_code;
  47. rtgui_widget_t *modal_widget;
  48. /* workbench title */
  49. unsigned char* title;
  50. rtgui_view_t* current_view;
  51. };
  52. rtgui_type_t* rtgui_workbench_type_get(void);
  53. rtgui_workbench_t *rtgui_workbench_create(const char* panel_name, const unsigned char* title);
  54. void rtgui_workbench_destroy(rtgui_workbench_t* workbench);
  55. void rtgui_workbench_close(rtgui_workbench_t* workbench);
  56. rt_bool_t rtgui_workbench_event_handler(rtgui_widget_t* widget, rtgui_event_t* event);
  57. void rtgui_workbench_set_flag(rtgui_workbench_t* workbench, rt_uint8_t flag);
  58. rt_bool_t rtgui_workbench_event_loop(rtgui_workbench_t* workbench);
  59. rt_err_t rtgui_workbench_show (rtgui_workbench_t* workbench);
  60. rt_err_t rtgui_workbench_hide (rtgui_workbench_t* workbench);
  61. void rtgui_workbench_add_view(rtgui_workbench_t* workbench, rtgui_view_t* view);
  62. void rtgui_workbench_remove_view(rtgui_workbench_t* workbench, rtgui_view_t* view);
  63. void rtgui_workbench_show_view(rtgui_workbench_t* workbench, rtgui_view_t* view);
  64. void rtgui_workbench_hide_view(rtgui_workbench_t* workbench, rtgui_view_t* view);
  65. rtgui_view_t *rtgui_workbench_get_current_view(rtgui_workbench_t * workbench);
  66. #endif