rtgui.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. #define RT_INT16_MAX 32767
  19. #define RT_INT16_MIN (-RT_INT16_MAX-1)
  20. #define RTGUI_NOT_FOUND (-1)
  21. struct rtgui_event;
  22. struct rtgui_object;
  23. struct rtgui_widget;
  24. struct rtgui_win;
  25. struct rtgui_font;
  26. typedef struct rtgui_win rtgui_win_t;
  27. typedef rt_bool_t (*rtgui_event_handler_ptr)(struct rtgui_object *object, struct rtgui_event *event);
  28. typedef void (*rtgui_onbutton_func_t)(struct rtgui_object *object, struct rtgui_event *event);
  29. /**
  30. * Coordinate point
  31. */
  32. struct rtgui_point
  33. {
  34. rt_int16_t x, y;
  35. };
  36. typedef struct rtgui_point rtgui_point_t;
  37. extern rtgui_point_t rtgui_empty_point;
  38. /**
  39. * Rectangle structure
  40. */
  41. struct rtgui_rect
  42. {
  43. rt_int16_t x1, y1, x2, y2;
  44. };
  45. typedef struct rtgui_rect rtgui_rect_t;
  46. #define rtgui_rect_width(r) ((r).x2 - (r).x1)
  47. #define rtgui_rect_height(r) ((r).y2 - (r).y1)
  48. typedef unsigned long rtgui_color_t;
  49. /**
  50. * Graphic context
  51. */
  52. struct rtgui_gc
  53. {
  54. /* foreground and background color */
  55. rtgui_color_t foreground, background;
  56. /* text style */
  57. rt_uint16_t textstyle;
  58. /* text align */
  59. rt_uint16_t textalign;
  60. /* font */
  61. struct rtgui_font *font;
  62. };
  63. typedef struct rtgui_gc rtgui_gc_t;
  64. enum RTGUI_MARGIN_STYLE
  65. {
  66. RTGUI_MARGIN_LEFT = 0x01,
  67. RTGUI_MARGIN_RIGHT = 0x02,
  68. RTGUI_MARGIN_TOP = 0x04,
  69. RTGUI_MARGIN_BOTTOM = 0x08,
  70. RTGUI_MARGIN_ALL = RTGUI_MARGIN_LEFT | RTGUI_MARGIN_RIGHT | RTGUI_MARGIN_TOP | RTGUI_MARGIN_BOTTOM
  71. };
  72. /**
  73. * Border style
  74. */
  75. enum RTGUI_BORDER_STYLE
  76. {
  77. RTGUI_BORDER_NONE = 0,
  78. RTGUI_BORDER_SIMPLE,
  79. RTGUI_BORDER_RAISE,
  80. RTGUI_BORDER_SUNKEN,
  81. RTGUI_BORDER_BOX,
  82. RTGUI_BORDER_STATIC,
  83. RTGUI_BORDER_EXTRA,
  84. RTGUI_BORDER_UP,
  85. RTGUI_BORDER_DOWN
  86. };
  87. #define RTGUI_BORDER_DEFAULT_WIDTH 2
  88. #define RTGUI_WIDGET_DEFAULT_MARGIN 3
  89. /**
  90. * Orientation
  91. */
  92. enum RTGUI_ORIENTATION
  93. {
  94. RTGUI_HORIZONTAL = 0x01,
  95. RTGUI_VERTICAL = 0x02,
  96. RTGUI_ORIENTATION_BOTH = RTGUI_HORIZONTAL | RTGUI_VERTICAL
  97. };
  98. enum RTGUI_ALIGN
  99. {
  100. RTGUI_ALIGN_NOT = 0x00,
  101. RTGUI_ALIGN_CENTER_HORIZONTAL = 0x01,
  102. RTGUI_ALIGN_LEFT = RTGUI_ALIGN_NOT,
  103. RTGUI_ALIGN_TOP = RTGUI_ALIGN_NOT,
  104. RTGUI_ALIGN_RIGHT = 0x02,
  105. RTGUI_ALIGN_BOTTOM = 0x04,
  106. RTGUI_ALIGN_CENTER_VERTICAL = 0x08,
  107. RTGUI_ALIGN_CENTER = RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL,
  108. RTGUI_ALIGN_EXPAND = 0x10,
  109. RTGUI_ALIGN_STRETCH = 0x20,
  110. };
  111. enum RTGUI_TEXTSTYLE
  112. {
  113. RTGUI_TEXTSTYLE_NORMAL = 0x00,
  114. RTGUI_TEXTSTYLE_DRAW_BACKGROUND = 0x01,
  115. RTGUI_TEXTSTYLE_SHADOW = 0x02,
  116. RTGUI_TEXTSTYLE_OUTLINE = 0x04,
  117. };
  118. enum RTGUI_MODAL_CODE
  119. {
  120. RTGUI_MODAL_OK,
  121. RTGUI_MODAL_CANCEL
  122. };
  123. typedef enum RTGUI_MODAL_CODE rtgui_modal_code_t;
  124. #include <rtgui/rtgui_object.h>
  125. #endif