1 /* This is a small demo of the high-performance GUIX graphics framework. */
2
3 #include "demo_guix_industrial.h"
4
5 #define COUNTDOWN_TIMER 0xf1
6 #define COUNTDOWN_VALUE 9
7
8 static INT countdown_value = COUNTDOWN_VALUE;
9
10 /******************************************************************************************/
11 /* Start count down timer. */
12 /******************************************************************************************/
complete_window_timer_start()13 VOID complete_window_timer_start()
14 {
15 gx_system_timer_start((GX_WIDGET *)&complete_window, COUNTDOWN_TIMER, GX_TICKS_SECOND, GX_TICKS_SECOND);
16 }
17
18 /******************************************************************************************/
19 /* Stop count down timer. */
20 /******************************************************************************************/
complete_window_timer_stop()21 VOID complete_window_timer_stop()
22 {
23 gx_system_timer_stop((GX_WIDGET*)&complete_window, COUNTDOWN_TIMER);
24 }
25
26 /******************************************************************************************/
27 /* Initiate complete window. */
28 /******************************************************************************************/
complete_window_init()29 VOID complete_window_init()
30 {
31 countdown_value = COUNTDOWN_VALUE;
32 gx_numeric_prompt_value_set(&complete_window.complete_window_countdown, countdown_value);
33 }
34
35 /******************************************************************************************/
36 /* Override event processing of "complete_window" to handle signals from my child widgets.*/
37 /******************************************************************************************/
complete_window_event_process(GX_WINDOW * window,GX_EVENT * event_ptr)38 UINT complete_window_event_process(GX_WINDOW *window, GX_EVENT *event_ptr)
39 {
40 switch (event_ptr->gx_event_type)
41 {
42 case GX_EVENT_TIMER:
43 if (event_ptr->gx_event_payload.gx_event_timer_id == COUNTDOWN_TIMER)
44 {
45 countdown_value--;
46 gx_numeric_prompt_value_set(&complete_window.complete_window_countdown, countdown_value);
47
48 if (countdown_value == 0)
49 {
50 gx_system_timer_stop((GX_WIDGET *)window, COUNTDOWN_TIMER);
51 screen_toggle_animation_start((GX_WINDOW *)&sequence_window, (GX_WINDOW *)&complete_window);
52 }
53 }
54 break;
55
56 default:
57 return gx_window_event_process(window, event_ptr);
58 }
59
60 return 0;
61 }
62