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