rtgui.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. * File : rtgui.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 __RT_GUI_H__
  15. #define __RT_GUI_H__
  16. #include <rtthread.h>
  17. #include <rtgui/rtgui_config.h>
  18. #include <string.h>
  19. #define RT_INT16_MAX 32767
  20. #define RT_INT16_MIN (-RT_INT16_MAX-1)
  21. #define SELECTED_HEIGHT 20 //ÒÑÑ¡ÔñÐеĸ߶È
  22. #define RT_COUNT(array) sizeof(array)/sizeof(array[0])
  23. /* Use new name & namespace */
  24. typedef struct rtgui_point rtgui_point_t;
  25. typedef struct rtgui_rect rtgui_rect_t;
  26. typedef rt_uint32_t rtgui_color_t;
  27. typedef struct rtgui_event rtgui_event_t;
  28. typedef struct rtgui_font rtgui_font_t;
  29. typedef struct rtgui_dc rtgui_dc_t;
  30. typedef struct rtgui_gc rtgui_gc_t;
  31. typedef void* PVOID;
  32. typedef struct rtgui_type rtgui_type_t;
  33. typedef struct rtgui_object rtgui_object_t;
  34. typedef struct rtgui_widget rtgui_widget_t;
  35. typedef struct rtgui_panel rtgui_panel_t;
  36. typedef struct rtgui_container rtgui_container_t;
  37. typedef struct rtgui_win rtgui_win_t;
  38. typedef struct rtgui_staticline rtgui_staticline_t;
  39. typedef struct rtgui_label rtgui_label_t;
  40. typedef struct rtgui_textbox rtgui_textbox_t;
  41. typedef struct rtgui_button rtgui_button_t;
  42. typedef struct rtgui_view rtgui_view_t;
  43. typedef struct rtgui_checkbox rtgui_checkbox_t;
  44. typedef struct rtgui_radiobox rtgui_radiobox_t;
  45. typedef struct rtgui_listbox rtgui_listbox_t;
  46. typedef struct rtgui_list_view rtgui_list_view_t;
  47. typedef struct rtgui_fileview rtgui_filelist_view_t;
  48. typedef struct rtgui_scrollbar rtgui_scrollbar_t;
  49. typedef struct rtgui_iconbox rtgui_iconbox_t;
  50. typedef struct rtgui_menu_item rtgui_menu_item_t;
  51. typedef struct rtgui_menu rtgui_menu_t;
  52. typedef struct rtgui_combo rtgui_combo_t;
  53. typedef rt_bool_t (*rtgui_event_handler_ptr)(PVOID wdt, rtgui_event_t* event);
  54. struct rtgui_point
  55. {
  56. rt_int16_t x, y;
  57. };
  58. struct rtgui_rect
  59. {
  60. rt_int16_t x1, y1, x2, y2;
  61. };
  62. extern rtgui_point_t rtgui_empty_point;
  63. #define rtgui_rect_width(r) ((r).x2 - (r).x1)
  64. #define rtgui_rect_height(r) ((r).y2 - (r).y1)
  65. struct rtgui_gc
  66. {
  67. /* foreground and background color */
  68. rtgui_color_t foreground, background;
  69. /* text style */
  70. rt_uint16_t textstyle;
  71. /* text align */
  72. rt_uint16_t textalign;
  73. /* font */
  74. struct rtgui_font* font;
  75. };
  76. enum RTGUI_MARGIN_STYLE
  77. {
  78. RTGUI_MARGIN_LEFT = 0x01,
  79. RTGUI_MARGIN_RIGHT = 0x02,
  80. RTGUI_MARGIN_TOP = 0x04,
  81. RTGUI_MARGIN_BOTTOM = 0x08,
  82. RTGUI_MARGIN_ALL = (RTGUI_MARGIN_LEFT | RTGUI_MARGIN_RIGHT | RTGUI_MARGIN_TOP | RTGUI_MARGIN_BOTTOM)
  83. };
  84. enum RTGUI_BORDER_STYLE
  85. {
  86. RTGUI_BORDER_NONE = 0,
  87. RTGUI_BORDER_SIMPLE,
  88. RTGUI_BORDER_RAISE,
  89. RTGUI_BORDER_SUNKEN,
  90. RTGUI_BORDER_BOX,
  91. RTGUI_BORDER_STATIC,
  92. RTGUI_BORDER_EXTRA,
  93. RTGUI_BORDER_UP,
  94. RTGUI_BORDER_DOWN
  95. };
  96. #define RTGUI_BORDER_DEFAULT_WIDTH 2
  97. #define RTGUI_WIDGET_DEFAULT_MARGIN 3
  98. enum RTGUI_ORIENTATION
  99. {
  100. RTGUI_HORIZONTAL = 0x01,
  101. RTGUI_VERTICAL = 0x02,
  102. RTGUI_ORIENTATION_BOTH = RTGUI_HORIZONTAL | RTGUI_VERTICAL
  103. };
  104. enum RTGUI_ALIGN
  105. {
  106. RTGUI_ALIGN_NOT = 0x00,
  107. RTGUI_ALIGN_CENTER_HORIZONTAL = 0x01,
  108. RTGUI_ALIGN_LEFT = RTGUI_ALIGN_NOT,
  109. RTGUI_ALIGN_TOP = RTGUI_ALIGN_NOT,
  110. RTGUI_ALIGN_RIGHT = 0x02,
  111. RTGUI_ALIGN_BOTTOM = 0x04,
  112. RTGUI_ALIGN_CENTER_VERTICAL = 0x08,
  113. RTGUI_ALIGN_EXPAND = 0x10,
  114. RTGUI_ALIGN_STRETCH = 0x20,
  115. };
  116. enum RTGUI_TEXTSTYLE
  117. {
  118. RTGUI_TEXTSTYLE_NORMAL = 0x00,
  119. RTGUI_TEXTSTYLE_DRAW_BACKGROUND = 0x01,
  120. RTGUI_TEXTSTYLE_SHADOW = 0x02,
  121. RTGUI_TEXTSTYLE_OUTLINE = 0x04,
  122. };
  123. enum RTGUI_MODAL_CODE
  124. {
  125. RTGUI_MODAL_OK,
  126. RTGUI_MODAL_CANCEL
  127. };
  128. typedef enum RTGUI_MODAL_CODE rtgui_modal_code_t;
  129. #include <rtgui/rtgui_object.h>
  130. #endif