1 /* This is a small demo of the high-performance GUIX graphics framework. */
2
3 #include <stdio.h>
4 #include "gx_api.h"
5 #include "rich_text_view_16bpp_resources.h"
6 #include "rich_text_view_16bpp_specifications.h"
7
8 extern MAIN_SCREEN_CONTROL_BLOCK main_screen;
9
10 /* Define the ThreadX demo thread control block and stack. */
11
12 TX_THREAD demo_thread;
13 UCHAR demo_thread_stack[4096];
14 GX_WINDOW_ROOT *root;
15
16 /* Define prototypes. */
17 VOID demo_thread_entry(ULONG thread_input);
18 extern UINT win32_graphics_driver_setup_565rgb(GX_DISPLAY *display);
19
20
main(int argc,char ** argv)21 int main(int argc, char ** argv)
22 {
23 tx_kernel_enter();
24 return(0);
25 }
26
27
tx_application_define(void * first_unused_memory)28 VOID tx_application_define(void *first_unused_memory)
29 {
30 /* Create the main demo thread. */
31 tx_thread_create(&demo_thread, "GUIX Demo Thread", demo_thread_entry,
32 0, demo_thread_stack, sizeof(demo_thread_stack),
33 1, 1, TX_NO_TIME_SLICE, TX_AUTO_START);
34 }
35
demo_thread_entry(ULONG thread_input)36 VOID demo_thread_entry(ULONG thread_input)
37 {
38 /* Initialize GUIX. */
39 gx_system_initialize();
40
41 gx_studio_display_configure(DISPLAY_1, win32_graphics_driver_setup_565rgb,
42 LANGUAGE_ENGLISH, DISPLAY_1_THEME_1, &root);
43
44 /* create the button screen */
45 gx_studio_named_widget_create("main_screen", (GX_WIDGET*)root, GX_NULL);
46
47 /* Show the root window to make it and patients screen visible. */
48 gx_widget_show(root);
49
50 /* let GUIX run */
51 gx_system_start();
52 }
53
main_screen_event_process(GX_WINDOW * window,GX_EVENT * event_ptr)54 UINT main_screen_event_process(GX_WINDOW *window, GX_EVENT* event_ptr)
55 {
56
57 switch (event_ptr->gx_event_type)
58 {
59 case GX_SIGNAL(ID_SCROLLBAR_CHECK, GX_EVENT_TOGGLE_ON):
60 /* Show text view scrollbar. */
61 gx_widget_show((GX_WIDGET*)&main_screen.main_screen_vertical_scroll);
62 break;
63
64 case GX_SIGNAL(ID_SCROLLBAR_CHECK, GX_EVENT_TOGGLE_OFF):
65 /* Hide text view scrollbar. */
66 gx_widget_hide((GX_WIDGET*)&main_screen.main_screen_vertical_scroll);
67 break;
68
69 case GX_SIGNAL(ID_WHITESPACE_SLIDER, GX_EVENT_SLIDER_VALUE):
70 /* Set whitespace value. */
71 gx_numeric_prompt_value_set(&main_screen.main_screen_whitespace_value, (GX_UBYTE)event_ptr->gx_event_payload.gx_event_longdata);
72
73 /* Set rich text view whitespace. */
74 gx_multi_line_text_view_whitespace_set((GX_MULTI_LINE_TEXT_VIEW *)&main_screen.main_screen_rich_text_view,
75 (GX_UBYTE)event_ptr->gx_event_payload.gx_event_longdata);
76 break;
77
78 case GX_SIGNAL(ID_LINE_SPACE_SLIDER, GX_EVENT_SLIDER_VALUE):
79 /* Set line space value. */
80 gx_numeric_prompt_value_set(&main_screen.main_screen_line_space_value, (GX_UBYTE)event_ptr->gx_event_payload.gx_event_longdata);
81
82 /* Set rich tet view line space. */
83 gx_multi_line_text_view_line_space_set((GX_MULTI_LINE_TEXT_VIEW*)&main_screen.main_screen_rich_text_view,
84 (GX_BYTE)event_ptr->gx_event_payload.gx_event_longdata);
85 break;
86
87 default:
88 return gx_window_event_process(window, event_ptr);
89 }
90
91 return GX_SUCCESS;
92 }
93