µGFX library fork

gwin_rules.h 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /*
  2. * This file is subject to the terms of the GFX License. If a copy of
  3. * the license was not distributed with this file, you can obtain one at:
  4. *
  5. * http://ugfx.org/license.html
  6. */
  7. /**
  8. * @file src/gwin/gwin_rules.h
  9. * @brief GWIN safety rules header file.
  10. *
  11. * @addtogroup GWIN
  12. * @{
  13. */
  14. #ifndef _GWIN_RULES_H
  15. #define _GWIN_RULES_H
  16. #if GFX_USE_GWIN
  17. // Sub-system rules
  18. #if !GFX_USE_GDISP
  19. #error "GWIN: GFX_USE_GDISP must be TRUE when using GWIN"
  20. #endif
  21. #if !GDISP_NEED_CLIP
  22. #if GFX_DISPLAY_RULE_WARNINGS
  23. #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
  24. #warning "GWIN: Drawing can occur outside the defined windows as GDISP_NEED_CLIP is FALSE"
  25. #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
  26. COMPILER_WARNING("GWIN: Drawing can occur outside the defined windows as GDISP_NEED_CLIP is FALSE")
  27. #endif
  28. #endif
  29. #endif
  30. // Objects require their super-class
  31. #if GWIN_NEED_TABSET || GWIN_NEED_FRAME || GWIN_NEED_CONTAINER
  32. #if !GWIN_NEED_CONTAINERS
  33. #if GFX_DISPLAY_RULE_WARNINGS
  34. #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
  35. #warning "GWIN: GWIN_NEED_CONTAINERS is required when a container is enabled. It has been turned on for you."
  36. #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
  37. COMPILER_WARNING("GWIN: GWIN_NEED_CONTAINERS is required when a container is enabled. It has been turned on for you.")
  38. #endif
  39. #endif
  40. #undef GWIN_NEED_CONTAINERS
  41. #define GWIN_NEED_CONTAINERS TRUE
  42. #endif
  43. #endif
  44. #if GWIN_NEED_BUTTON || GWIN_NEED_SLIDER || GWIN_NEED_CHECKBOX || GWIN_NEED_LABEL || GWIN_NEED_RADIO || GWIN_NEED_LIST || \
  45. GWIN_NEED_IMAGE || GWIN_NEED_CHECKBOX || GWIN_NEED_PROGRESSBAR || GWIN_NEED_KEYBOARD || GWIN_NEED_TEXTEDIT
  46. #if !GWIN_NEED_WIDGET
  47. #if GFX_DISPLAY_RULE_WARNINGS
  48. #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
  49. #warning "GWIN: GWIN_NEED_WIDGET is required when a widget is used. It has been turned on for you."
  50. #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
  51. COMPILER_WARNING("GWIN: GWIN_NEED_WIDGET is required when a widget is used. It has been turned on for you.")
  52. #endif
  53. #endif
  54. #undef GWIN_NEED_WIDGET
  55. #define GWIN_NEED_WIDGET TRUE
  56. #endif
  57. #endif
  58. // Rules for the super-classes
  59. #if GWIN_NEED_CONTAINERS
  60. #if !GWIN_NEED_WIDGET
  61. #if GFX_DISPLAY_RULE_WARNINGS
  62. #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
  63. #warning "GWIN: GWIN_NEED_WIDGET is required when GWIN_NEED_CONTAINERS is enabled. It has been turned on for you."
  64. #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
  65. COMPILER_WARNING("GWIN: GWIN_NEED_WIDGET is required when GWIN_NEED_CONTAINERS is enabled. It has been turned on for you.")
  66. #endif
  67. #endif
  68. #undef GWIN_NEED_WIDGET
  69. #define GWIN_NEED_WIDGET TRUE
  70. #endif
  71. #endif
  72. #if GWIN_NEED_WIDGET
  73. #if !GDISP_NEED_TEXT
  74. #error "GWIN: GDISP_NEED_TEXT is required if GWIN_NEED_WIDGET is TRUE."
  75. #endif
  76. #if !GFX_USE_GINPUT
  77. // This test also ensures that GFX_USE_GEVENT is set
  78. #error "GWIN: GFX_USE_GINPUT (and one or more input sources) is required if GWIN_NEED_WIDGET is TRUE"
  79. #endif
  80. #if !GWIN_NEED_WINDOWMANAGER
  81. #if GFX_DISPLAY_RULE_WARNINGS
  82. #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
  83. #warning "GWIN: GWIN_NEED_WINDOWMANAGER is required if GWIN_NEED_WIDGET is TRUE. It has been turned on for you."
  84. #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
  85. COMPILER_WARNING("GWIN: GWIN_NEED_WINDOWMANAGER is required if GWIN_NEED_WIDGET is TRUE. It has been turned on for you.")
  86. #endif
  87. #endif
  88. #undef GWIN_NEED_WINDOWMANAGER
  89. #define GWIN_NEED_WINDOWMANAGER TRUE
  90. #endif
  91. #if !GDISP_NEED_MULTITHREAD
  92. #if GFX_DISPLAY_RULE_WARNINGS
  93. #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
  94. #warning "GWIN: GDISP_NEED_MULTITHREAD is required if GWIN_NEED_WIDGET is TRUE. It has been turned on for you"
  95. #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
  96. COMPILER_WARNING("GWIN: GDISP_NEED_MULTITHREAD is required if GWIN_NEED_WIDGET is TRUE. It has been turned on for you")
  97. #endif
  98. #endif
  99. #undef GDISP_NEED_MULTITHREAD
  100. #define GDISP_NEED_MULTITHREAD TRUE
  101. #endif
  102. #endif
  103. #if GWIN_NEED_WINDOWMANAGER
  104. #if !GFX_USE_GQUEUE || !GQUEUE_NEED_ASYNC
  105. #if GFX_DISPLAY_RULE_WARNINGS
  106. #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
  107. #warning "GWIN: GFX_USE_GQUEUE and GQUEUE_NEED_ASYNC is required if GWIN_NEED_WINDOWMANAGER is TRUE. It has been turned on for you."
  108. #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
  109. COMPILER_WARNING("GWIN: GFX_USE_GQUEUE and GQUEUE_NEED_ASYNC is required if GWIN_NEED_WINDOWMANAGER is TRUE. It has been turned on for you.")
  110. #endif
  111. #endif
  112. #undef GFX_USE_GQUEUE
  113. #undef GQUEUE_NEED_ASYNC
  114. #define GFX_USE_GQUEUE TRUE
  115. #define GQUEUE_NEED_ASYNC TRUE
  116. #endif
  117. #if !GFX_USE_GTIMER
  118. #if GFX_DISPLAY_RULE_WARNINGS
  119. #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
  120. #warning "GWIN: GFX_USE_GTIMER is required if GWIN_NEED_WINDOWMANAGER is TRUE. It has been turned on for you."
  121. #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
  122. COMPILER_WARNING("GWIN: GFX_USE_GTIMER is required if GWIN_NEED_WINDOWMANAGER is TRUE. It has been turned on for you.")
  123. #endif
  124. #endif
  125. #undef GFX_USE_GTIMER
  126. #define GFX_USE_GTIMER TRUE
  127. #endif
  128. #endif
  129. // Rules for individual objects
  130. #if GWIN_NEED_LIST
  131. #if !GDISP_NEED_TEXT
  132. #error "GWIN: GDISP_NEED_TEXT is required when GWIN_NEED_LIST is TRUE."
  133. #endif
  134. #endif
  135. #if GWIN_NEED_RADIO
  136. #if !GDISP_NEED_CIRCLE
  137. #if GFX_DISPLAY_RULE_WARNINGS
  138. #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
  139. #warning "GWIN: GDISP_NEED_CIRCLE should be set to TRUE for much nicer radio button widgets."
  140. #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
  141. COMPILER_WARNING("GWIN: GDISP_NEED_CIRCLE should be set to TRUE for much nicer radio button widgets.")
  142. #endif
  143. #endif
  144. #endif
  145. #endif
  146. #if GWIN_NEED_IMAGE
  147. #if !GDISP_NEED_IMAGE
  148. #error "GWIN: GDISP_NEED_IMAGE is required when GWIN_NEED_IMAGE is TRUE."
  149. #endif
  150. #endif
  151. #if GWIN_NEED_CONSOLE
  152. #if !GDISP_NEED_TEXT
  153. #error "GWIN: GDISP_NEED_TEXT is required if GWIN_NEED_CONSOLE is TRUE."
  154. #endif
  155. #endif
  156. #if GWIN_NEED_TEXTEDIT
  157. #if !GDISP_NEED_TEXT
  158. #error "GWIN: GDISP_NEED_TEXT is required if GWIN_NEED_TEXTEDIT is TRUE."
  159. #endif
  160. #if !(GINPUT_NEED_KEYBOARD || GWIN_NEED_KEYBOARD)
  161. #error "GWIN: GINPUT_NEED_KEYBOARD or GWIN_NEED_KEYBOARD is required if GWIN_NEED_TEXTEDIT is TRUE."
  162. #endif
  163. #endif
  164. #endif
  165. #endif /* _GWIN_RULES_H */
  166. /** @} */