workbench.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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
  23. #define RTGUI_WORKBENCH_FLAG_INVISIBLE 0x01
  24. #define RTGUI_WORKBENCH_FLAG_FULLSCREEN 0x02
  25. #define RTGUI_WORKBENCH_FLAG_CLOSEBLE 0x00
  26. #define RTGUI_WORKBENCH_FLAG_UNCLOSEBLE 0x10
  27. #define RTGUI_WORKBENCH_FLAG_DEFAULT RTGUI_WORKBENCH_FLAG_VISIBLE | RTGUI_WORKBENCH_FLAG_CLOSEBLE
  28. /** Gets the type of a workbench */
  29. #define RTGUI_WORKBENCH_TYPE (rtgui_workbench_type_get())
  30. /** Casts the object to an rtgui_workbench */
  31. #define RTGUI_WORKBENCH(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_WORKBENCH_TYPE, rtgui_workbench_t))
  32. /** Checks if the object is an rtgui_workbench */
  33. #define RTGUI_IS_WORKBENCH(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_WORKBENCH_TYPE))
  34. struct rtgui_workbench
  35. {
  36. /* inherit from toplevel */
  37. struct rtgui_toplevel parent;
  38. /* panel id */
  39. rtgui_panel_t* panel;
  40. /* workbench flag */
  41. rt_uint8_t flag;
  42. /* workbench title */
  43. unsigned char* title;
  44. };
  45. rtgui_workbench_t *rtgui_workbench_create(const char* panel_name, const unsigned char* title);
  46. void rtgui_workbench_destroy(rtgui_workbench_t* workbench);
  47. rtgui_type_t* rtgui_workbench_type_get(void);
  48. rt_bool_t rtgui_workbench_event_handler(rtgui_widget_t* widget, rtgui_event_t* event);
  49. void rtgui_workbench_set_flag(rtgui_workbench_t* workbench, rt_uint8_t flag);
  50. void rtgui_workbench_event_loop(rtgui_workbench_t* workbench);
  51. rt_err_t rtgui_workbench_show (rtgui_workbench_t* workbench);
  52. rt_err_t rtgui_workbench_hide (rtgui_workbench_t* workbench);
  53. void rtgui_workbench_add_view(rtgui_workbench_t* workbench, rtgui_view_t* view);
  54. void rtgui_workbench_remove_view(rtgui_workbench_t* workbench, rtgui_view_t* view);
  55. void rtgui_workbench_show_view(rtgui_workbench_t* workbench, rtgui_view_t* view);
  56. void rtgui_workbench_hide_view(rtgui_workbench_t* workbench, rtgui_view_t* view);
  57. rtgui_view_t *rtgui_workbench_get_current_view(rtgui_workbench_t * workbench);
  58. #endif