workbench.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. /** Gets the type of a workbench */
  32. #define RTGUI_WORKBENCH_TYPE (rtgui_workbench_type_get())
  33. /** Casts the object to an rtgui_workbench */
  34. #define RTGUI_WORKBENCH(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_WORKBENCH_TYPE, rtgui_workbench_t))
  35. /** Checks if the object is an rtgui_workbench */
  36. #define RTGUI_IS_WORKBENCH(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_WORKBENCH_TYPE))
  37. struct rtgui_workbench
  38. {
  39. /* inherit from toplevel */
  40. struct rtgui_toplevel parent;
  41. /* panel id */
  42. rtgui_panel_t* panel;
  43. /* workbench flag */
  44. rt_uint8_t flag;
  45. rtgui_modal_code_t modal_code;
  46. rtgui_widget_t *modal_widget;
  47. /* workbench title */
  48. unsigned char* title;
  49. rtgui_view_t* current_view;
  50. };
  51. rtgui_type_t* rtgui_workbench_type_get(void);
  52. rtgui_workbench_t *rtgui_workbench_create(const char* panel_name, const unsigned char* title);
  53. void rtgui_workbench_destroy(rtgui_workbench_t* workbench);
  54. rt_bool_t rtgui_workbench_event_handler(rtgui_widget_t* widget, rtgui_event_t* event);
  55. void rtgui_workbench_set_flag(rtgui_workbench_t* workbench, rt_uint8_t flag);
  56. rt_bool_t rtgui_workbench_event_loop(rtgui_workbench_t* workbench);
  57. rt_err_t rtgui_workbench_show (rtgui_workbench_t* workbench);
  58. rt_err_t rtgui_workbench_hide (rtgui_workbench_t* workbench);
  59. void rtgui_workbench_add_view(rtgui_workbench_t* workbench, rtgui_view_t* view);
  60. void rtgui_workbench_remove_view(rtgui_workbench_t* workbench, rtgui_view_t* view);
  61. void rtgui_workbench_show_view(rtgui_workbench_t* workbench, rtgui_view_t* view);
  62. void rtgui_workbench_hide_view(rtgui_workbench_t* workbench, rtgui_view_t* view);
  63. rtgui_view_t *rtgui_workbench_get_current_view(rtgui_workbench_t * workbench);
  64. #endif