Select one of the symbols to view example projects that use it.
 
Outline
Includes
#include "main.h"
#include "gardening_control_res.c"
Private function prototypes
Private typedef
gardening_control_board
Private defines
#define ID_WINDOW_0
#define ID_BUTTON_INFO_CLOSE
#define ID_BUTTON_CONTROL
#define ID_BUTTON_SPRINKLERS
#define ID_BUTTON_DROWISE
#define ID_TEXT_CONTROL
#define ID_TEXT_CONTROL2
#define ID_TEXT_CONTROL3
#define ID_TEXT_SPRINKLERS
#define ID_TEXT_DROWISE
#define ID_BUTTON_EXIT
Private variables
_aDialog
_OnPaint_exit(BUTTON_Handle)
_cbButton_exit(WM_MESSAGE *)
_OnPaint_control(BUTTON_Handle)
_cbButton_control(WM_MESSAGE *)
_OnPaint_sprinklers(BUTTON_Handle)
_cbButton_sprinklers(WM_MESSAGE *)
_OnPaint_drowise(BUTTON_Handle)
_cbButton_drowise(WM_MESSAGE *)
_cbDialog(WM_MESSAGE *)
Startup(GUI_HWIN, uint16_t, uint16_t)
Files
loading...
CodeScopeSTM32 Libraries and SamplesSTemWinGui/Core/gardening_control/gardening_control_win.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * @file gardening_control_win.c * @author MCD Application Team * @brief gardening control functions ****************************************************************************** * @attention * * Copyright (c) 2017 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** *//* ... */ /* Includes ------------------------------------------------------------------*/ #include "main.h" #include "gardening_control_res.c" /** @addtogroup GARDENING_CONTROL_MODULE * @{ *//* ... */ /** @defgroup GARDENING_CONTROL * @brief gardening control routines * @{ *//* ... */ Includes /* External variables --------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ static void Startup(WM_HWIN hWin, uint16_t xpos, uint16_t ypos); Private function prototypes /* Private typedef -----------------------------------------------------------*/ K_ModuleItem_Typedef gardening_control_board = { 5, "garden control", open_gardening, 0, Startup, NULL, ...} ; Private typedef /* Private defines -----------------------------------------------------------*/ #define ID_WINDOW_0 (GUI_ID_USER + 0x00) #define ID_BUTTON_INFO_CLOSE (GUI_ID_USER + 0x03) #define ID_BUTTON_CONTROL (GUI_ID_USER + 0x05) #define ID_BUTTON_SPRINKLERS (GUI_ID_USER + 0x06) #define ID_BUTTON_DROWISE (GUI_ID_USER + 0x07) #define ID_TEXT_CONTROL (GUI_ID_USER + 0x09) #define ID_TEXT_CONTROL2 (GUI_ID_USER + 0x0A) #define ID_TEXT_CONTROL3 (GUI_ID_USER + 0x0B) #define ID_TEXT_SPRINKLERS (GUI_ID_USER + 0x0C) #define ID_TEXT_DROWISE (GUI_ID_USER + 0x0D) #define ID_BUTTON_EXIT (GUI_ID_USER + 0x08) 11 defines Private defines /* Private macros ------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ static const GUI_WIDGET_CREATE_INFO _aDialog[] = { { WINDOW_CreateIndirect, "", ID_WINDOW_0, 0, 0, 800, 480, 0, 0x64, 0 }, { TEXT_CreateIndirect, "main", ID_TEXT_CONTROL, 80, 325, 100, 30, 0, 0x0, 0 }, { TEXT_CreateIndirect, "control", ID_TEXT_CONTROL2, 135, 325, 100, 30, 0, 0x0, 0 }, { TEXT_CreateIndirect, "(on/off)", ID_TEXT_CONTROL3, 100, 345, 100, 30, 0, 0x0, 0 }, { TEXT_CreateIndirect, "sprinklers", ID_TEXT_SPRINKLERS, 355, 325, 100, 30, 0, 0x0, 0 }, { TEXT_CreateIndirect, "drowise", ID_TEXT_DROWISE, 610, 325, 100, 30, 0, 0x0, 0 }, ...}; Private variables /* Private functions ---------------------------------------------------------*/ /** * @brief Paints exit button * @param hObj: button handle * @retval None *//* ... */ static void _OnPaint_exit(BUTTON_Handle hObj) { GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor()); GUI_Clear(); GUI_SetColor(GUI_STCOLOR_LIGHTBLUE); GUI_AA_FillCircle(100, 0, 100); GUI_SetBkColor(GUI_STCOLOR_LIGHTBLUE); GUI_SetColor(GUI_WHITE); GUI_SetFont(&GUI_FontLubalGraph32); GUI_DispStringAt("Menu", 20, 20); }{ ... } /** * @brief callback for Exit button * @param pMsg: pointer to data structure of type WM_MESSAGE * @retval None *//* ... */ static void _cbButton_exit(WM_MESSAGE * pMsg) { switch (pMsg->MsgId) { case WM_PAINT: _OnPaint_exit(pMsg->hWin); break;case WM_PAINT: default: /* The original callback */ BUTTON_Callback(pMsg); break;default }switch (pMsg->MsgId) { ... } }{ ... } /** * @brief Paints control button * @param hObj: button handle * @retval None *//* ... */ static void _OnPaint_control(BUTTON_Handle hObj) { int Index; GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor()); GUI_Clear(); Index = (WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED) ? 1 : 0; if(Index) { GUI_DrawBitmap(&bmdes_control_sub, 0, 0); }if (Index) { ... } else { GUI_DrawBitmap(&bmcontrol_sub, 0, 0); }else { ... } }{ ... } /** * @brief callback for control button * @param pMsg: pointer to data structure of type WM_MESSAGE * @retval None *//* ... */ static void _cbButton_control(WM_MESSAGE * pMsg) { switch (pMsg->MsgId) { case WM_PAINT: _OnPaint_control(pMsg->hWin); break;case WM_PAINT: default: /* The original callback */ BUTTON_Callback(pMsg); break;default }switch (pMsg->MsgId) { ... } }{ ... } /** * @brief Paints sprinklers button * @param hObj: button handle * @retval None *//* ... */ static void _OnPaint_sprinklers(BUTTON_Handle hObj) { int Index; GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor()); GUI_Clear(); Index = (WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED) ? 1 : 0; if(Index) { GUI_DrawBitmap(&bmdes_garden_sub, 0, 0); }if (Index) { ... } else { GUI_DrawBitmap(&bmgarden_sub, 0, 0); }else { ... } }{ ... } /** * @brief callback for sprinklers button * @param pMsg: pointer to data structure of type WM_MESSAGE * @retval None *//* ... */ static void _cbButton_sprinklers(WM_MESSAGE * pMsg) { switch (pMsg->MsgId) { case WM_PAINT: _OnPaint_sprinklers(pMsg->hWin); break;case WM_PAINT: default: /* The original callback */ BUTTON_Callback(pMsg); break;default }switch (pMsg->MsgId) { ... } }{ ... } /** * @brief Paints drowise button * @param hObj: button handle * @retval None *//* ... */ static void _OnPaint_drowise(BUTTON_Handle hObj) { int Index; GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor()); GUI_Clear(); Index = (WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED) ? 1 : 0; if(Index) { GUI_DrawBitmap(&bmdes_water_sub, 0, 0); }if (Index) { ... } else { GUI_DrawBitmap(&bmwater_sub, 0, 0); }else { ... } }{ ... } /** * @brief callback for drowise button * @param pMsg: pointer to data structure of type WM_MESSAGE * @retval None *//* ... */ static void _cbButton_drowise(WM_MESSAGE * pMsg) { switch (pMsg->MsgId) { case WM_PAINT: _OnPaint_drowise(pMsg->hWin); break;case WM_PAINT: default: /* The original callback */ BUTTON_Callback(pMsg); break;default }switch (pMsg->MsgId) { ... } }{ ... } /** * @brief Callback routine of the main dialog * @param pMsg: pointer to data structure of type WM_MESSAGE * @retval None *//* ... */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int Id, NCode; switch (pMsg->MsgId) { case WM_INIT_DIALOG: hItem = BUTTON_CreateEx(700, 0, 100,100, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_EXIT); WM_SetCallback(hItem, _cbButton_exit); hItem = BUTTON_CreateEx(50, 150, 180, 180, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_CONTROL); WM_SetCallback(hItem, _cbButton_control); hItem = BUTTON_CreateEx(310, 140, 180, 180, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_SPRINKLERS); WM_SetCallback(hItem, _cbButton_sprinklers); hItem = BUTTON_CreateEx(570, 140, 180, 180, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_DROWISE); WM_SetCallback(hItem, _cbButton_drowise); /* Title Initialization in play list */ hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CONTROL); TEXT_SetText(hItem, "main"); TEXT_SetFont(hItem, &GUI_FontLubalGraph24B); TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CONTROL2); TEXT_SetText(hItem, "control"); TEXT_SetFont(hItem, &GUI_FontLubalGraph24B); TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CONTROL3); TEXT_SetText(hItem, "(on/off)"); TEXT_SetFont(hItem, &GUI_FontLubalGraph24B); TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE); /* Title Initialization in play list */ hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_SPRINKLERS); TEXT_SetText(hItem, "sprinklers"); TEXT_SetFont(hItem, &GUI_FontLubalGraph24B); TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE); /* Duration */ hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_DROWISE); TEXT_SetText(hItem, "dropwise"); TEXT_SetFont(hItem, &GUI_FontLubalGraph24B); TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE); break; case WM_INIT_DIALOG: case WM_PAINT: break; case WM_PAINT: case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); /* Id of widget */ NCode = pMsg->Data.v; /* Notification code */ switch(Id) { case ID_BUTTON_EXIT: switch(NCode) { case WM_NOTIFICATION_RELEASED: GUI_EndDialog(pMsg->hWin, 0); break;case WM_NOTIFICATION_RELEASED: }switch (NCode) { ... } break; case ID_BUTTON_EXIT: }switch (Id) { ... } break;case WM_NOTIFY_PARENT: default: WM_DefaultProc(pMsg); break;default }switch (pMsg->MsgId) { ... } }{ ... } /** * @brief gardening control window Startup * @param hWin: pointer to the parent handle. * @param xpos: X position * @param ypos: Y position * @retval None *//* ... */ static void Startup(WM_HWIN hWin, uint16_t xpos, uint16_t ypos) { GUI_CreateDialogBox(_aDialog, GUI_COUNTOF(_aDialog), _cbDialog, hWin, xpos, ypos); }{ ... } /** * @} *//* ... */ /** * @} *//* ... */