1 /* This is a small demo of the high-performance GUIX graphics framework. */
2 
3 #include <stdio.h>
4 #include "tx_api.h"
5 #include "gx_api.h"
6 #include "all_widgets_5_3_3_resources.h"
7 #include "all_widgets_5_3_3_specifications.h"
8 
9 extern GX_WINDOW *pGaugeScreen;
10 INT angle[6] = { -114, -90, 52, -27, 52, -114 };
11 int angle_index = 0;
12 
set_gauge_angle(GX_CIRCULAR_GAUGE * gauge)13 VOID set_gauge_angle(GX_CIRCULAR_GAUGE *gauge)
14 {
15     gx_circular_gauge_angle_set(gauge, angle[angle_index++]);
16     if (angle_index >= (int)(sizeof(angle) / sizeof(INT)))
17     {
18         angle_index = 0;
19     }
20 }
21 
gauge_event_handle(GX_WINDOW * window,GX_EVENT * event_ptr)22 UINT gauge_event_handle(GX_WINDOW *window, GX_EVENT *event_ptr)
23 {
24     GX_CIRCULAR_GAUGE *gauge = &((GAUGE_SCREEN_CONTROL_BLOCK *)pGaugeScreen)->gauge_screen_gauge_1;
25     INT tics;
26 
27     switch (event_ptr->gx_event_type)
28     {
29     case GX_EVENT_SHOW:
30         set_gauge_angle(gauge);
31         gx_window_event_process(window, event_ptr);
32         break;
33 
34     case GX_SIGNAL(ID_GAUGE, GX_EVENT_ANIMATION_COMPLETE):
35         set_gauge_angle(gauge);
36 
37         tics = gauge->gx_circular_gauge_info.gx_circular_gauge_info_animation_delay;
38         gx_system_timer_start((GX_WIDGET *)gauge, GX_CIRCULAR_GAUGE_TIMER, tics, tics);
39         break;
40 
41     default:
42         return next_button_handler(window, event_ptr);
43     }
44     return 0;
45 }