Select one of the symbols to view example projects that use it.
 
Outline
#include "GUIDEMO.h"
#include "main.h"
_aFrameWinControl
_aFrameWinInfo
_GUIDemoConfig
_hDialogControl
_hDialogInfo
_pfDrawBk
_iDemo
_iDemoMinor
_HaltTime
_HaltTimeStart
_Halt
_Next
_Pressed
_DrawLogo
_ClearHalt()
_DrawBkSimple(int)
_DrawBk(int)
_DrawBkCircle(int)
_HideProgress()
_ShowProgress()
_cbBk(WM_MESSAGE *)
_cbEffect(int, void *)
_cbFrameWinControl(WM_MESSAGE *)
_cbFrameWinInfo(WM_MESSAGE *)
_FRAMEWIN_DrawSkinFlex(const WIDGET_ITEM_DRAW_INFO *)
_Main()
GUIDEMO_SetDrawLogo(unsigned char)
GUIDEMO_AddIntToString(char *, unsigned int)
GUIDEMO_AddStringToString(char *, const char *)
GUIDEMO_CheckCancel()
GUIDEMO_ClearText(char *)
GUIDEMO_Delay(int)
GUIDEMO_DrawBk(int)
GUIDEMO_GetConfFlag(unsigned short)
GUIDEMO_GetTime()
GUIDEMO_HideControlWin()
GUIDEMO_HideInfoWin()
GUIDEMO_NotifyStartNext()
GUIDEMO_ShowControlWin()
GUIDEMO_ShowInfo(const char *)
GUIDEMO_ShowInfoWin()
GUIDEMO_ShowIntro(const char *, const char *)
GUIDEMO_UpdateControlText()
GUIDEMO_Wait(int)
GUIDEMO_Main()
Files
loading...
CodeScopeSTM32 Libraries and SamplesSTemWin_SampleDemoSTemWin/App/GUIDEMO.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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/********************************************************************* * Portions COPYRIGHT(c) 2016 STMicroelectronics * * Portions SEGGER Microcontroller GmbH & Co. KG * * Solutions for real time microcontroller applications * ********************************************************************** * * * (c) 1996 - 2015 SEGGER Microcontroller GmbH & Co. KG * * * * Internet: www.segger.com Support: support@segger.com * * * ********************************************************************** ** emWin V5.28 - Graphical user interface for embedded applications ** All Intellectual Property rights in the Software belongs to SEGGER. emWin is protected by international copyright laws. Knowledge of the source code may not be used to write a similar product. This file may only be used in accordance with the following terms: The software has been licensed to STMicroelectronics International N.V. a Dutch company with a Swiss branch and its headquarters in Plan- les-Ouates, Geneva, 39 Chemin du Champ des Filles, Switzerland for the purposes of creating libraries for ARM Cortex-M-based 32-bit microcon_ troller products commercialized by Licensee only, sublicensed and dis_ tributed under the terms and conditions of the End User License Agree_ ment supplied by STMicroelectronics International N.V. Full source code is available at: www.segger.com We appreciate your understanding and fairness. ---------------------------------------------------------------------- File : GUIDEMO.c Purpose : Several GUIDEMO routines ---------------------------------------------------------------------- *//* ... */ /** ****************************************************************************** * @file GUIDEMO.c * @author MCD Application Team * @brief Several GUIDEMO routines ****************************************************************************** * @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. * ****************************************************************************** *//* ... */ #include "GUIDEMO.h" #include "main.h" /********************************************************************* * * Dialog resources * ********************************************************************** *//* ... */ static const GUI_WIDGET_CREATE_INFO _aFrameWinControl[] = { { FRAMEWIN_CreateIndirect, "Control", 0, 0, 0, CONTROL_SIZE_X, CONTROL_SIZE_Y, 0, 0 }, { BUTTON_CreateIndirect, "Halt", GUI_ID_HALT, 2, 24, BUTTON_SIZE_X, BUTTON_SIZE_Y, 0, 0 }, { BUTTON_CreateIndirect, "Next", GUI_ID_NEXT, 36, 24, BUTTON_SIZE_X, BUTTON_SIZE_Y, 0, 0 }, { PROGBAR_CreateIndirect, 0, GUI_ID_PROGBAR0, 2, 11, PROGBAR_SIZE_X, PROGBAR_SIZE_Y, WM_CF_HIDE, 0 }, { TEXT_CreateIndirect, 0, GUI_ID_TEXT0, 2, 2, TEXT_SIZE_X, TEXT_SIZE_Y, 0, 0 } ...}; static const GUI_WIDGET_CREATE_INFO _aFrameWinInfo[] = { { FRAMEWIN_CreateIndirect, "STemWin Demo", 0, 0, 0, 0, 0, 0, 0 }, { TEXT_CreateIndirect, "", GUI_ID_TEXT0, 3, 3, 0, 0, 0, 0 } ...}; /********************************************************************* * * Static variables * ********************************************************************** *//* ... */ static GUIDEMO_CONFIG _GUIDemoConfig; static WM_HWIN _hDialogControl; static WM_HWIN _hDialogInfo; static void (* _pfDrawBk)(int DrawLogo); static int _iDemo; static int _iDemoMinor; static int _HaltTime; static int _HaltTimeStart; static int _Halt; static int _Next; static int _Pressed; static U8 _DrawLogo; /********************************************************************* * * Static functions * ********************************************************************** *//* ... */ /********************************************************************* * * _ClearHalt * * This function is called if the next button is pressed after * the demo was halted *//* ... */ static void _ClearHalt(void) { _Halt = 0; _HaltTime = 0; _HaltTimeStart = 0; }{ ... } /********************************************************************* * * _DrawBkSimple *//* ... */ static void _DrawBkSimple(int DrawLogo) { GUI_SetBkColor(BK_COLOR_1); GUI_Clear(); if (DrawLogo) { GUI_DrawBitmap(&bmSTLogo70x35, 5, 5); }if (DrawLogo) { ... } }{ ... } #if GUIDEMO_USE_AUTO_BK /********************************************************************* * * _DrawBk *//* ... */ static void _DrawBk(int DrawLogo) { int xSize; int ySize; xSize = LCD_GetXSize(); ySize = LCD_GetYSize(); GUI_DrawGradientV(0, 0, xSize, ySize, BK_COLOR_0, BK_COLOR_1); if (DrawLogo) { GUI_DrawBitmap(&bmSTLogo70x35, 5, 5); }if (DrawLogo) { ... } }{ ... } /********************************************************************* * * _DrawBkCircle *//* ... */ static void _DrawBkCircle(int DrawLogo) { static GUI_MEMDEV_Handle hMemStretch; GUI_MEMDEV_Handle hMemGradient; GUI_MEMDEV_Handle hMemCircle; GUI_MEMDEV_Handle hMemOld; int CircleWidth; int ySizeV; int xSize; int ySize; int i; U32 * pData; xSize = LCD_GetXSize(); ySize = LCD_GetYSize(); ySizeV = LCD_GetVYSize(); if (ySizeV > ySize) { GUI_SetBkColor(BK_COLOR_1); GUI_ClearRect(0, 0, xSize, ySizeV); }if (ySizeV > ySize) { ... } if (hMemStretch == 0) { CircleWidth = (CIRCLE_RADIUS << 1) + 1; hMemCircle = GUI_MEMDEV_CreateFixed(0, 0, CircleWidth, CircleWidth, GUI_MEMDEV_NOTRANS, GUI_MEMDEV_APILIST_32, GUI_COLOR_CONV_8888); hMemStretch = GUI_MEMDEV_CreateEx (0, 0, xSize, ySize, GUI_MEMDEV_NOTRANS); hMemGradient = GUI_MEMDEV_CreateFixed(0, 0, 1, CIRCLE_RADIUS, GUI_MEMDEV_NOTRANS, GUI_MEMDEV_APILIST_32, GUI_COLOR_CONV_8888); // // Initialize background // hMemOld = GUI_MEMDEV_Select(hMemCircle); GUI_SetBkColor(BK_COLOR_1); GUI_Clear(); // // Create Gradient // GUI_MEMDEV_Select(hMemGradient); GUI_DrawGradientV(0, 0, 0, CIRCLE_RADIUS, BK_COLOR_0, BK_COLOR_1); // // Get color and draw circles // pData = (U32 *)GUI_MEMDEV_GetDataPtr(hMemGradient); GUI_MEMDEV_Select(hMemCircle); for (i = 0; i < CIRCLE_RADIUS; i++, pData++) { GUI_SetColor(*pData); GUI_DrawCircle(CIRCLE_RADIUS, CIRCLE_RADIUS, i); }for (i = 0; i < CIRCLE_RADIUS; i++, pData++) { ... } // // Stretch and display // GUI_MEMDEV_Select(hMemStretch); GUI_MEMDEV_DrawPerspectiveX(hMemCircle, 0, 0, ySize, ySize, xSize, 0); GUI_MEMDEV_Delete(hMemCircle); GUI_MEMDEV_Delete(hMemGradient); GUI_MEMDEV_Select(hMemOld); }if (hMemStretch == 0) { ... } GUI_MEMDEV_Write(hMemStretch); if (DrawLogo) { GUI_DrawBitmap(&bmSTLogo70x35, LOGO_DIST_BORDER, LOGO_DIST_BORDER); }if (DrawLogo) { ... } }{ ... } /* ... */#endif /********************************************************************* * * _HideProgress *//* ... */ static void _HideProgress(void) { PROGBAR_Handle hProg; hProg = WM_GetDialogItem(_hDialogControl, GUI_ID_PROGBAR0); WM_HideWindow(hProg); }{ ... } /********************************************************************* * * _ShowProgress *//* ... */ static void _ShowProgress(void) { PROGBAR_Handle hProg; hProg = WM_GetDialogItem(_hDialogControl, GUI_ID_PROGBAR0); WM_ShowWindow(hProg); }{ ... } /********************************************************************* * * _cbBk *//* ... */ static void _cbBk(WM_MESSAGE * pMsg) { WM_KEY_INFO * pInfo; switch (pMsg->MsgId) { case WM_PAINT: _pfDrawBk(_DrawLogo); break;case WM_PAINT: case WM_SET_FOCUS: pMsg->Data.v = 0; break;case WM_SET_FOCUS: case WM_KEY: pInfo = (WM_KEY_INFO *)pMsg->Data.p; if (pInfo->PressedCnt) { switch (pInfo->Key) { case 'n': _Next = 1; break;case 'n': }switch (pInfo->Key) { ... } }if (pInfo->PressedCnt) { ... } break;case WM_KEY: default: WM_DefaultProc(pMsg); break;default }switch (pMsg->MsgId) { ... } }{ ... } /********************************************************************* * * _cbEffect *//* ... */ static int _cbEffect(int TimeRem, void * pVoid) { GUI_PID_STATE State; int Pressed; GUI_USE_PARA(TimeRem); Pressed = *((int *)pVoid); GUI_Exec(); GUI_PID_GetState(&State); if (State.Pressed) { *((int *)pVoid) = 1; return 0; }if (State.Pressed) { ... } else { if ((State.Pressed == 0) && (Pressed == 1)) { *((int *)pVoid) = 0; _Next = 1; return 1; }if ((State.Pressed == 0) && (Pressed == 1)) { ... } _Next = GUIDEMO_CheckCancel(); return _Next; }else { ... } }{ ... } /********************************************************************* * * _cbFrameWinControl *//* ... */ static void _cbFrameWinControl(WM_MESSAGE * pMsg) { WM_HWIN hItem; int xSize; int ySize; int NCode; int Id; switch (pMsg->MsgId) { case WM_KEY: WM_SendMessage(WM_HBKWIN, pMsg); break;case WM_KEY: case WM_INIT_DIALOG: hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_PROGBAR0); PROGBAR_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); PROGBAR_SetFont(hItem, &GUI_FontD6x8); hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_HALT); BUTTON_SetFocussable(hItem, 0); hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_NEXT); BUTTON_SetFocussable(hItem, 0); hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_TEXT0); TEXT_SetText(hItem, "Intro"); TEXT_SetFont(hItem, &GUI_Font8_ASCII); break;case WM_INIT_DIALOG: case WM_PAINT: xSize = WM_GetWindowSizeX(pMsg->hWin); ySize = WM_GetWindowSizeY(pMsg->hWin); GUI_DrawGradientV(0, 0, xSize - 1, ySize - 1, 0xFFFFFF, 0xDCCEC0); break;case WM_PAINT: case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch (NCode) { case WM_NOTIFICATION_RELEASED: switch (Id) { case GUI_ID_HALT: if (_Halt) { _Halt = 0; _HaltTime = GUI_GetTime() - _HaltTimeStart; WM_MakeModal(0); }if (_Halt) { ... } else { _Halt = 1; _HaltTimeStart = GUI_GetTime() - _HaltTime; WM_MakeModal(pMsg->hWin); }else { ... } break;case GUI_ID_HALT: case GUI_ID_NEXT: _Next = 1; // Will be set to 0 by GUIDEMO_GetNextState() _ClearHalt(); // Clear _Halt, so the next sample demonstrates immediately break;case GUI_ID_NEXT: }switch (Id) { ... } break;case WM_NOTIFICATION_RELEASED: }switch (NCode) { ... } break;case WM_NOTIFY_PARENT: default: WM_DefaultProc(pMsg);default }switch (pMsg->MsgId) { ... } }{ ... } /********************************************************************* * * _cbFrameWinInfo *//* ... */ static void _cbFrameWinInfo(WM_MESSAGE * pMsg) { int xSize; int ySize; switch (pMsg->MsgId) { case WM_KEY: WM_SendMessage(WM_HBKWIN, pMsg); break;case WM_KEY: case WM_CREATE: xSize = LCD_GetXSize(); WM_SetWindowPos(pMsg->hWin, xSize >> 1, 0, xSize >> 1, INFO_SIZE_Y); break;case WM_CREATE: case WM_PAINT: xSize = WM_GetWindowSizeX(pMsg->hWin); ySize = WM_GetWindowSizeY(pMsg->hWin); GUI_DrawGradientV(0, 0, xSize - 1, ySize - 1, 0xFFFFFF, 0xDCCEC0); break;case WM_PAINT: default: WM_DefaultProc(pMsg);default }switch (pMsg->MsgId) { ... } }{ ... } /********************************************************************* * * _FRAMEWIN_DrawSkinFlex *//* ... */ static int _FRAMEWIN_DrawSkinFlex(const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo) { switch (pDrawItemInfo->Cmd) { case WIDGET_ITEM_CREATE: FRAMEWIN_SetTextAlign(pDrawItemInfo->hWin, GUI_TA_HCENTER | GUI_TA_VCENTER); FRAMEWIN_SetTextColor(pDrawItemInfo->hWin, GUI_BLACK); break;case WIDGET_ITEM_CREATE: default: return FRAMEWIN_DrawSkinFlex(pDrawItemInfo);default }switch (pDrawItemInfo->Cmd) { ... } return 0; }{ ... } /********************************************************************* * * _Main *//* ... */ static void _Main(void) { int xSize; int ySize; WM_SelectWindow(WM_HBKWIN); GUI_Clear(); #if (GUI_SUPPORT_CURSOR | GUI_SUPPORT_TOUCH) // GUI_CURSOR_Show(); #endif // // Create and configure Control and Information window // xSize = LCD_GetXSize(); ySize = LCD_GetYSize(); _hDialogControl = GUI_CreateDialogBox(_aFrameWinControl, GUI_COUNTOF(_aFrameWinControl), &_cbFrameWinControl, WM_HBKWIN, xSize - CONTROL_SIZE_X, ySize - CONTROL_SIZE_Y); _hDialogInfo = GUI_CreateDialogBox(_aFrameWinInfo, GUI_COUNTOF(_aFrameWinInfo), &_cbFrameWinInfo, WM_HBKWIN, (xSize >> 1) - 1, 0); WM_HideWindow(_hDialogInfo); // // Show Intro // WM_InvalidateWindow(_hDialogControl); WM_DisableMemdev(WM_HBKWIN); GUI_Exec(); WM_EnableMemdev(WM_HBKWIN); GUI_SetBkColor(GUI_RED); GUI_Clear(); GUI_SetBkColor(GUI_GREEN); GUI_Clear(); GUI_SetBkColor(GUI_BLUE); GUI_Clear(); GUIDEMO_Intro(); // // Run the demos // for (_iDemo = 0; _GUIDemoConfig.apFunc[_iDemo]; _iDemo++) { _ClearHalt(); GUIDEMO_UpdateControlText(); (*_GUIDemoConfig.apFunc[_iDemo])(); _iDemoMinor = 0; _Pressed = 0; }for (_iDemo = 0; _GUIDemoConfig.apFunc[_iDemo]; _iDemo++) { ... } _iDemo = 0; // // Cleanup // WM_DeleteWindow(_hDialogControl); WM_DeleteWindow(_hDialogInfo); #if (GUI_SUPPORT_CURSOR | GUI_SUPPORT_TOUCH) GUI_CURSOR_Hide(); #endif }{ ... } /********************************************************************* * * Public functions * ********************************************************************** *//* ... */ /********************************************************************* * * GUIDEMO_SetDrawLogo *//* ... */ void GUIDEMO_SetDrawLogo(U8 OnOff) { _DrawLogo = OnOff ? 1 : 0; }{ ... } /********************************************************************* * * GUIDEMO_AddIntToString *//* ... */ void GUIDEMO_AddIntToString(char * pText, unsigned int Number) { int TextLen; int LenNum; int i; TextLen = 0; while (*(pText + TextLen)) { TextLen++; }while (*(pText + TextLen)) { ... } i = 1; LenNum = 1; while ((Number / i) >= 10) { i *= 10; LenNum++; }while ((Number / i) >= 10) { ... } *(pText + TextLen + LenNum) = '\0'; while (LenNum) { *(pText + TextLen + LenNum - 1) = '0' + Number % 10; Number /= 10; LenNum--; }while (LenNum) { ... } }{ ... } /********************************************************************* * * GUIDEMO_AddStringToString *//* ... */ void GUIDEMO_AddStringToString(char * pText, const char * acAdd) { int i; int j; i = 0; j = 0; while (*(pText + i)) { i++; }while (*(pText + i)) { ... } while (*(acAdd + j)) { *(pText + i) = *(acAdd + j); i++; j++; }while (*(acAdd + j)) { ... } *(pText + i) = '\0'; }{ ... } /********************************************************************* * * GUIDEMO_CheckCancel *//* ... */ int GUIDEMO_CheckCancel(void) { // // Do not return until the button is released // while (_Halt == 1) { GUI_Delay(10); }while (_Halt == 1) { ... } // // Check Next Button // if (_Next == 1) { _Next = 0; return 1; }if (_Next == 1) { ... } return 0; }{ ... } /********************************************************************* * * GUIDEMO_ClearText * *//* ... */ void GUIDEMO_ClearText(char * pText) { *pText = 0; }{ ... } /********************************************************************* * * GUIDEMO_Delay * * This function has to be called if the current step of the sample * is the last one and consists of a single frame *//* ... */ void GUIDEMO_Delay(int TimeDelay) { PROGBAR_Handle hProg; int NextState; U32 TimeStart; U32 TimeDiff; hProg = WM_GetDialogItem(_hDialogControl, GUI_ID_PROGBAR0); if (TimeDelay > SHOW_PROGBAR_AT) { _ShowProgress(); }if (TimeDelay > SHOW_PROGBAR_AT) { ... } PROGBAR_SetValue(hProg, 0); PROGBAR_SetMinMax(hProg, 0, TimeDelay); TimeStart = GUI_GetTime(); do { TimeDiff = GUIDEMO_GetTime() - TimeStart; if (TimeDelay > SHOW_PROGBAR_AT) { PROGBAR_SetValue(hProg, TimeDiff); }if (TimeDelay > SHOW_PROGBAR_AT) { ... } GUI_Delay(5); NextState = GUIDEMO_CheckCancel(); ...} while (TimeDiff < (U32)TimeDelay && !NextState); if (TimeDelay > SHOW_PROGBAR_AT) { _HideProgress(); }if (TimeDelay > SHOW_PROGBAR_AT) { ... } GUI_Exec(); }{ ... } /********************************************************************* * * GUIDEMO_DrawBk *//* ... */ void GUIDEMO_DrawBk(int DrawLogo) { _pfDrawBk(DrawLogo); }{ ... } /********************************************************************* * * GUIDEMO_GetConfFlag *//* ... */ U16 GUIDEMO_GetConfFlag(U16 Flag) { return (_GUIDemoConfig.Flags & Flag) ? 1 : 0; }{ ... } /********************************************************************* * * GUIDEMO_GetTime *//* ... */ int GUIDEMO_GetTime(void) { return _Halt ? _HaltTimeStart : GUI_GetTime() - _HaltTime; }{ ... } /********************************************************************* * * GUIDEMO_HideControlWin *//* ... */ void GUIDEMO_HideControlWin(void) { WM_HideWindow(_hDialogControl); WM_ValidateWindow(WM_HBKWIN); }{ ... } /********************************************************************* * * GUIDEMO_HideInfoWin *//* ... */ void GUIDEMO_HideInfoWin(void) { WM_HideWindow(_hDialogInfo); WM_ValidateWindow(WM_HBKWIN); }{ ... } /********************************************************************* * * GUIDEMO_NotifyStartNext * * Use this function if the next step of the current sample will be * shown immediately *//* ... */ void GUIDEMO_NotifyStartNext(void) { _iDemoMinor++; _ClearHalt(); GUIDEMO_UpdateControlText(); }{ ... } /********************************************************************* * * GUIDEMO_ShowControlWin *//* ... */ void GUIDEMO_ShowControlWin(void) { WM_ShowWindow(_hDialogControl); GUI_Exec(); }{ ... } /********************************************************************* * * GUIDEMO_ShowInfo *//* ... */ void GUIDEMO_ShowInfo(const char * acInfo) { TEXT_Handle hText; if (WM_IsVisible(_hDialogInfo)) { hText = WM_GetDialogItem(_hDialogInfo, GUI_ID_TEXT0); TEXT_SetText(hText, acInfo); }if (WM_IsVisible(_hDialogInfo)) { ... } }{ ... } /********************************************************************* * * GUIDEMO_ShowInfoWin *//* ... */ void GUIDEMO_ShowInfoWin(void) { WM_ShowWindow(_hDialogInfo); }{ ... } /********************************************************************* * * GUIDEMO_ShowIntro * * Function description * Shows the GUIDEMO introduction screen which display the title of * the sample and a short description. *//* ... */ void GUIDEMO_ShowIntro(const char * acTitle, const char * acDescription) { int FontDistY; int TimeWait; int xCenter; int yCenter; int xSize; int ySize; int i; xSize = LCD_GetXSize(); ySize = LCD_GetYSize(); xCenter = xSize >> 1; yCenter = ySize >> 1; GUIDEMO_HideInfoWin(); GUIDEMO_ShowControlWin(); GUI_Exec(); GUIDEMO_DrawBk(1); GUI_SetColor(GUI_WHITE); // // Title // GUI_SetTextMode(GUI_TM_TRANS); GUI_SetFont(&GUI_FontRounded22); GUI_DispStringHCenterAt(acTitle, xCenter, 60); // // Description // GUI_SetFont(&GUI_Font16_ASCII); FontDistY = GUI_GetFontDistY(); GUI_DispStringHCenterAt(acDescription, xCenter, yCenter - FontDistY + 10); // // Determine time to wait // i = 0; while (acDescription[i]) { i++; }while (acDescription[i]) { ... } TimeWait = i * CHAR_READING_TIME; GUIDEMO_Wait(TimeWait); }{ ... } /********************************************************************* * * GUIDEMO_UpdateControlText *//* ... */ void GUIDEMO_UpdateControlText(void) { TEXT_Handle hText; char acText[20] = { 0 }; hText = WM_GetDialogItem(_hDialogControl, GUI_ID_TEXT0); GUIDEMO_AddStringToString(acText, "Demo "); GUIDEMO_AddIntToString (acText, _iDemo + 1); GUIDEMO_AddStringToString(acText, "."); GUIDEMO_AddIntToString (acText, _iDemoMinor); GUIDEMO_AddStringToString(acText, "/"); GUIDEMO_AddIntToString (acText, _GUIDemoConfig.NumDemos - 1); TEXT_SetText (hText, acText); }{ ... } /********************************************************************* * * GUIDEMO_Wait * * This function has to be called if the current step is a static * frame and another step will follow *//* ... */ void GUIDEMO_Wait(int TimeWait) { GUIDEMO_Delay(TimeWait); GUIDEMO_NotifyStartNext(); }{ ... } /********************************************************************* * * GUIDEMO_Main *//* ... */ void GUIDEMO_Main(void) { FRAMEWIN_SKINFLEX_PROPS Framewin_Props; #if GUIDEMO_USE_AUTO_BK int NumFreeBytes; int BitsPerPixel;/* ... */ #endif GUI_MEMDEV_SetAnimationCallback(_cbEffect, (void *)&_Pressed); WM_SetCallback(WM_HBKWIN, _cbBk); BUTTON_SetReactOnLevel(); FRAMEWIN_GetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_ACTIVE); Framewin_Props.Radius = 0; FRAMEWIN_SetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_ACTIVE); FRAMEWIN_GetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_INACTIVE); Framewin_Props.Radius = 0; FRAMEWIN_SetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_INACTIVE); FRAMEWIN_SetDefaultSkin (_FRAMEWIN_DrawSkinFlex); PROGBAR_SetDefaultSkin (PROGBAR_SKIN_FLEX); BUTTON_SetDefaultSkin (BUTTON_SKIN_FLEX); SCROLLBAR_SetDefaultSkin (SCROLLBAR_SKIN_FLEX); SLIDER_SetDefaultSkin (SLIDER_SKIN_FLEX); HEADER_SetDefaultSkin (HEADER_SKIN_FLEX); GUI_SetTextMode (GUI_TM_TRANS); GUIDEMO_Config(&_GUIDemoConfig); #if GUIDEMO_USE_VNC if (GUIDEMO_GetConfFlag(GUIDEMO_CF_USE_VNC)) { _GUIDemoConfig.pGUI_VNC_X_StartServer(0, 0); }if (GUIDEMO_GetConfFlag(GUIDEMO_CF_USE_VNC)) { ... } /* ... */ #endif #if GUIDEMO_USE_AUTO_BK // // Determine if HW has enough memory to draw the gradient circle as background // BitsPerPixel = LCD_GetBitsPerPixel(); if ((BitsPerPixel >= 16) && GUIDEMO_GetConfFlag(GUIDEMO_CF_USE_AUTO_BK)) { NumFreeBytes = GUI_ALLOC_GetNumFreeBytes(); if (NumFreeBytes > NUMBYTES_NEEDED) { _pfDrawBk = _DrawBkCircle; }if (NumFreeBytes > NUMBYTES_NEEDED) { ... } else { _pfDrawBk = _DrawBk; }else { ... } }if ((BitsPerPixel >= 16) && GUIDEMO_GetConfFlag(GUIDEMO_CF_USE_AUTO_BK)) { ... } else #endif { _pfDrawBk = _DrawBkSimple; }else { ... } GUIDEMO_SetDrawLogo(1); while (1) { _Main(); }while (1) { ... } }{ ... }