1 /* This is a small demo of the high-performance GUIX graphics framework. */
2
3 #include <stdio.h>
4 #include "gx_api.h"
5
6 #include "synergy_32bpp_16bppdriver_resources.h"
7 #include "synergy_32bpp_16bppdriver_specifications.h"
8
9 MAIN_WINDOW_CONTROL_BLOCK *pMainWin;
10 GX_WINDOW *pic_window;
11
12 /* Define the ThreadX demo thread control block and stack. */
13
14 TX_THREAD demo_thread;
15 UCHAR demo_thread_stack[4096];
16
17 GX_WINDOW_ROOT *root;
18 GX_BOOL alpha = GX_FALSE;
19 GX_BOOL compressed = GX_FALSE;
20 INT xshift;
21 INT yshift;
22
23 /* Define prototypes. */
24 VOID demo_thread_entry(ULONG thread_input);
25 extern UINT win32_dave2d_graphics_driver_setup_565rgb(GX_DISPLAY *display);
26
27
main(int argc,char ** argv)28 int main(int argc, char ** argv)
29 {
30 tx_kernel_enter();
31 return(0);
32 }
33
34
tx_application_define(void * first_unused_memory)35 VOID tx_application_define(void *first_unused_memory)
36 {
37
38 /* Create the main demo thread. */
39 tx_thread_create(&demo_thread, "GUIX Demo Thread", demo_thread_entry,
40 0, demo_thread_stack, sizeof(demo_thread_stack),
41 1, 1, TX_NO_TIME_SLICE, TX_AUTO_START);
42 }
43
44
demo_thread_entry(ULONG thread_input)45 VOID demo_thread_entry(ULONG thread_input)
46 {
47 /* Initialize GUIX. */
48 gx_system_initialize();
49
50
51 gx_studio_display_configure(DISPLAY_1, win32_dave2d_graphics_driver_setup_565rgb,
52 LANGUAGE_ENGLISH, DISPLAY_1_THEME_1, &root);
53
54 /* create the main screen */
55 gx_studio_named_widget_create("main_window", (GX_WIDGET *) root, (GX_WIDGET **) &pMainWin);
56 pic_window = &pMainWin ->main_window_pic_window;
57
58 /* Show the root window to make it and patients screen visible. */
59 gx_widget_show(root);
60
61 /* let GUIX run */
62 gx_system_start();
63 }
64
main_event_handler(GX_WINDOW * window,GX_EVENT * myevent)65 UINT main_event_handler(GX_WINDOW *window, GX_EVENT *myevent)
66 {
67 UINT status = 0;
68 switch(myevent -> gx_event_type)
69 {
70 case GX_SIGNAL(ID_COMPRESSED, GX_EVENT_RADIO_SELECT):
71 compressed = GX_TRUE;
72 gx_system_dirty_mark(pic_window);
73 break;
74
75 case GX_SIGNAL(ID_UNCOMPRESSED, GX_EVENT_RADIO_SELECT):
76 compressed = GX_FALSE;
77 gx_system_dirty_mark(pic_window);
78 break;
79
80 default:
81 status = gx_window_event_process(window, myevent);
82 break;
83 }
84 return status;
85 }
86
87
pic_win_draw(GX_WINDOW * window)88 VOID pic_win_draw(GX_WINDOW *window)
89 {
90
91 if(compressed)
92 {
93 gx_window_wallpaper_set(window, GX_PIXELMAP_ID_RED_APPLE, GX_FALSE);
94 }
95 else
96 {
97 gx_window_wallpaper_set(window, GX_PIXELMAP_ID_FISH, GX_FALSE);
98 }
99
100
101 gx_window_draw((GX_WINDOW*) window);
102 }