workbench.h 2.8 KB

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