1 /***************************************************************************
2 * Copyright (c) 2024 Microsoft Corporation
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the MIT License which is available at
6 * https://opensource.org/licenses/MIT.
7 *
8 * SPDX-License-Identifier: MIT
9 **************************************************************************/
10
11
12
13 /* Include necessary system files. */
14 #include "gx_api.h"
15
16 /* Define constants for the GUIX Win32 demo. */
17
18 /* Define the display dimentions specific to this implemenation. */
19 #define DEMO_DISPLAY_WIDTH 640
20 #define DEMO_DISPLAY_HEIGHT 480
21
22 /* Define the number of pixels on the canvas */
23 #define DEFAULT_CANVAS_PIXELS (DEMO_DISPLAY_WIDTH * DEMO_DISPLAY_HEIGHT)
24 #define ID_PROGRESS_BAR_TIMER 1
25
26 /* Define the GUIX resources for this demo. */
27
28 /* GUIX display represents the physical display device */
29 GX_DISPLAY demo_display;
30
31 /* GUIX canvas is the frame buffer on top of GUIX displayl. */
32 GX_CANVAS default_canvas;
33
34 /* The root window is a special GUIX background window, right on top of the canvas. */
35 GX_WINDOW_ROOT demo_root_window;
36 GX_WINDOW border_style_window;
37 GX_WINDOW fill_style_window;
38
39 /* GUIX Progress Bar. */
40 GX_PROGRESS_BAR progress_bar;
41
42 /* GUIX Progress Bar information. */
43 GX_PROGRESS_BAR_INFO info;
44
45 GX_RADIO_BUTTON radio_button_1;
46 GX_RADIO_BUTTON radio_button_2;
47 GX_RADIO_BUTTON radio_button_3;
48 GX_RADIO_BUTTON radio_button_4;
49 GX_RADIO_BUTTON radio_button_5;
50 GX_RADIO_BUTTON radio_button_6;
51 GX_RADIO_BUTTON radio_button_7;
52 GX_CHECKBOX checkbox;
53
54 GX_PROMPT prompt_1;
55 GX_PROMPT prompt_2;
56 GX_PROMPT prompt_3;
57
58 /* Memory for the frame buffer. */
59 GX_COLOR default_canvas_memory[DEFAULT_CANVAS_PIXELS];
60
61 /* User-defined color ID */
62 #define GX_COLOR_ID_BLACK GX_FIRST_USER_COLOR
63 #define GX_COLOR_ID_WHITE (GX_FIRST_USER_COLOR + 1)
64 #define GX_COLOR_ID_GREEN (GX_FIRST_USER_COLOR + 2)
65 #define GX_COLOR_ID_YELLOW (GX_FIRST_USER_COLOR + 3)
66
67 /* Define the default theme colors. */
68
69 #define GX_COLOR_CANVAS GX_COLOR_BLACK
70 #define GX_COLOR_WIDGET_FILL 0x00787c78
71 #define GX_COLOR_WINDOW_FILL 0x00e2e2e2
72 #define GX_COLOR_STANDARD_BORDER 0x009b9b73
73 #define GX_COLOR_WINDOW_BORDER 0x007599aa
74 #define GX_COLOR_NORMAL_TEXT GX_COLOR_BLACK
75 #define GX_COLOR_SELECTED_TEXT GX_COLOR_WHITE
76 #define GX_COLOR_SELECTED_FILL GX_COLOR_BLUE
77
78 #define GX_COLOR_SHADOW GX_COLOR_DARKGRAY
79 #define GX_COLOR_SHINE 0x00dadada
80
81 #define GX_COLOR_BUTTON_BORDER 0x00e0c060
82 #define GX_COLOR_BUTTON_UPPER 0x00f8f8e0
83 #define GX_COLOR_BUTTON_LOWER 0x00f8ecb0
84 #define GX_COLOR_BUTTON_TEXT GX_COLOR_BLACK
85
86 #define GX_COLOR_SCROLL_FILL 0x00e8d8f8
87 #define GX_COLOR_SCROLL_BUTTON 0x00e8ccb0
88 #define GX_COLOR_TEXT_INPUT_TEXT GX_COLOR_BLACK
89 #define GX_COLOR_TEXT_INPUT_FILL GX_COLOR_WHITE
90
91 #define GX_COLOR_SLIDER_TICK GX_COLOR_BLACK
92 #define GX_COLOR_SLIDER_GROOVE_TOP GX_COLOR_LIGHTGRAY
93 #define GX_COLOR_SLIDER_GROOVE_BOTTOM GX_COLOR_WHITE
94 #define GX_COLOR_SLIDER_NEEDLE_OUTLINE GX_COLOR_BLACK
95 #define GX_COLOR_SLIDER_NEEDLE_FILL GX_COLOR_DARKGRAY
96 #define GX_COLOR_SLIDER_NEEDLE_LINE1 GX_COLOR_LIGHTGRAY
97 #define GX_COLOR_SLIDER_NEEDLE_LINE2 GX_COLOR_BUTTON_BORDER
98
99 #define GX_SYSTEM_DEFAULT_COLORS_DECLARE \
100 GX_COLOR_CANVAS, \
101 GX_COLOR_WIDGET_FILL, \
102 GX_COLOR_WINDOW_FILL, \
103 GX_COLOR_STANDARD_BORDER, \
104 GX_COLOR_WINDOW_BORDER, \
105 GX_COLOR_NORMAL_TEXT, \
106 GX_COLOR_SELECTED_TEXT, \
107 GX_COLOR_SELECTED_FILL, \
108 GX_COLOR_SHADOW, \
109 GX_COLOR_SHINE, \
110 GX_COLOR_BUTTON_BORDER, \
111 GX_COLOR_BUTTON_UPPER, \
112 GX_COLOR_BUTTON_LOWER, \
113 GX_COLOR_BUTTON_TEXT, \
114 GX_COLOR_SCROLL_FILL, \
115 GX_COLOR_SCROLL_BUTTON, \
116 GX_COLOR_TEXT_INPUT_TEXT, \
117 GX_COLOR_TEXT_INPUT_FILL, \
118 GX_COLOR_SLIDER_TICK, \
119 GX_COLOR_SLIDER_GROOVE_TOP, \
120 GX_COLOR_SLIDER_GROOVE_BOTTOM, \
121 GX_COLOR_SLIDER_NEEDLE_OUTLINE, \
122 GX_COLOR_SLIDER_NEEDLE_FILL, \
123 GX_COLOR_SLIDER_NEEDLE_LINE1, \
124 GX_COLOR_SLIDER_NEEDLE_LINE2
125
126 /* User-defined color table. */
127 static GX_COLOR demo_color_table[] =
128 {
129 /* First, bring in GUIX default color table. These colors are used
130 by GUIX internals. */
131 GX_SYSTEM_DEFAULT_COLORS_DECLARE,
132
133 /* In this demo, two color entries are added to the color table. */
134 GX_COLOR_BLACK,
135 GX_COLOR_WHITE,
136 GX_COLOR_GREEN,
137 GX_COLOR_YELLOW
138 };
139
140 /* Font Table */
141
142
143 extern GX_FONT _gx_system_font_8bpp;
144 GX_FONT *demo_font_table[] =
145 {
146 &_gx_system_font_8bpp,
147 &_gx_system_font_8bpp,
148 &_gx_system_font_8bpp,
149 &_gx_system_font_8bpp
150 };
151
152 extern GX_PIXELMAP RADIO_ON_pixelmap;
153 extern GX_PIXELMAP RADIO_OFF_pixelmap;
154 extern GX_PIXELMAP CHECKBOX_ON_pixelmap;
155 extern GX_PIXELMAP CHECKBOX_OFF_pixelmap;
156 extern GX_PIXELMAP TFIELD_FILL_SMALL_pixelmap;
157 extern GX_PIXELMAP VERTICAL_FILL_pixelmap;
158
159 GX_PIXELMAP *demo_pixelmap_table[] = {
160 NULL,
161 &RADIO_ON_pixelmap,
162 &RADIO_OFF_pixelmap,
163 &CHECKBOX_ON_pixelmap,
164 &CHECKBOX_OFF_pixelmap,
165 &TFIELD_FILL_SMALL_pixelmap,
166 &VERTICAL_FILL_pixelmap
167 };
168
169 enum demo_pixelmaps {
170 BID_RADIO_ON = 1,
171 BID_RADIO_OFF,
172 BID_CHECKBOX_ON,
173 BID_CHECKBOX_OFF,
174 BID_PROMPT_FILL,
175 BID_VERTICAL_FILL,
176 NUMBER_OF_PIXELMAPS
177 };
178
179 /* Define GUIX strings and string IDs for this demo. */
180
181 enum demo_string_ids
182 {
183 RAISED_BORDER = 1,
184 RECESSED_BORDER,
185 THIN_BORDER,
186 NO_BORDER,
187 SEGMENTED_FILL,
188 SOLID_FILL,
189 PIXELMAP_FILL,
190 SHOW_TEXT,
191 BORDER_STYLE,
192 FILL_STYLE,
193 TEXT,
194 STRING_TABLE_MAX
195 };
196
197 GX_CONST GX_CHAR string_raised_border[] = "raised border";
198 GX_CONST GX_CHAR string_recessed_border[] = "recessed border";
199 GX_CONST GX_CHAR string_thin_border[] = "thin border";
200 GX_CONST GX_CHAR string_no_border[] = "no border";
201 GX_CONST GX_CHAR string_segmented_fill[] = "segmented fill";
202 GX_CONST GX_CHAR string_solid_fill[] = "solid fill";
203 GX_CONST GX_CHAR string_pixelmap_fill[]= "pixelmap fill";
204 GX_CONST GX_CHAR string_show_text[] = "show text";
205 GX_CONST GX_CHAR string_border_style[] = "border style";
206 GX_CONST GX_CHAR string_fill_style[] = "fill style";
207 GX_CONST GX_CHAR string_text[] = "text";
208
209 /* Define GUIX string for the demo. */
210 GX_CONST GX_STRING demo_strings[] = {
211 {NULL, 0},
212 {string_raised_border, sizeof(string_raised_border) - 1},
213 {string_recessed_border, sizeof(string_recessed_border) - 1},
214 {string_thin_border, sizeof(string_thin_border) - 1},
215 {string_no_border, sizeof(string_no_border) - 1},
216 {string_segmented_fill, sizeof(string_segmented_fill) - 1},
217 {string_solid_fill, sizeof(string_solid_fill) - 1},
218 {string_pixelmap_fill, sizeof(string_pixelmap_fill) - 1},
219 {string_show_text, sizeof(string_show_text) - 1},
220 {string_border_style, sizeof(string_border_style) - 1},
221 {string_fill_style, sizeof(string_fill_style) - 1},
222 {string_text, sizeof(string_text) - 1}
223 };
224
225 /* Define Language table. */
226 GX_CONST GX_STRING *language_table[1] =
227 {
228 demo_strings,
229 };
230
231 /* widget id values used by this demo */
232 enum demo_widget_ids {
233 ID_RAISED_BORDER = 1,
234 ID_RECESSED_BORDER,
235 ID_THIN_BORDER,
236 ID_NO_BORDER,
237 ID_SEGMENTED_FILL,
238 ID_SOLID_FILL,
239 ID_PIXELMAP_FILL,
240 ID_SHOW_TEXT
241 };
242
243 /* Define prototypes. */
244
245 VOID start_guix(VOID);
246 UINT main_event_handler(GX_WIDGET *widget, GX_EVENT *myevent);
247 UINT border_win_event_handler(GX_WIDGET *widget, GX_EVENT *myevent);
248 UINT fill_win_event_handler(GX_WIDGET *widget, GX_EVENT *myevent);
249
250 /* Prototype for the win32 screen driver setup routine. */
251 extern UINT win32_graphics_driver_setup_24xrgb(GX_DISPLAY *graphic);
252
main(int argc,char ** argv)253 int main(int argc, char ** argv)
254 {
255 tx_kernel_enter();
256 return (0);
257 }
258
259
260
tx_application_define(void * first_unused_memory)261 VOID tx_application_define(void *first_unused_memory)
262 {
263 start_guix();
264 }
265
start_guix(VOID)266 VOID start_guix(VOID)
267 {
268
269 GX_RECTANGLE root_window_size;
270 GX_RECTANGLE size;
271
272 /* Initialize GUIX. */
273 gx_system_initialize();
274
275 /* Create the demo display and associated driver. */
276 gx_display_create(&demo_display, "demo display", win32_graphics_driver_setup_24xrgb,
277 DEMO_DISPLAY_WIDTH, DEMO_DISPLAY_HEIGHT);
278
279 /* Install the demo color table. */
280 gx_display_color_table_set(&demo_display, demo_color_table, sizeof(demo_color_table) / sizeof(GX_COLOR));
281
282 /* Install the demo font table. */
283 gx_display_font_table_set(&demo_display, demo_font_table, sizeof(demo_font_table) / sizeof(GX_FONT *));
284
285 /* Install the demo pixelmap table. */
286 gx_display_pixelmap_table_set(&demo_display, demo_pixelmap_table, sizeof(demo_pixelmap_table) / sizeof(GX_PIXELMAP *));
287
288 /* Install the demo language table. */
289 gx_display_language_table_set_ext(&demo_display, language_table, 1, STRING_TABLE_MAX);
290 gx_system_active_language_set(0);
291
292 /* Create the default canvas. */
293 gx_canvas_create(&default_canvas, "demo canvas", &demo_display,
294 GX_CANVAS_MANAGED | GX_CANVAS_VISIBLE,
295 DEMO_DISPLAY_WIDTH, DEMO_DISPLAY_HEIGHT,
296 default_canvas_memory, sizeof(default_canvas_memory));
297
298 /* Define the size of the root window. */
299 gx_utility_rectangle_define(&root_window_size, 0, 0, DEMO_DISPLAY_WIDTH - 1, DEMO_DISPLAY_HEIGHT - 1);
300
301 /* Create a background root window and attach to the canvas. */
302 gx_window_root_create(&demo_root_window, "demo root window", &default_canvas,
303 GX_STYLE_BORDER_NONE, GX_ID_NONE, &root_window_size);
304
305 /* Set the root window to be black */
306 gx_widget_fill_color_set(&demo_root_window, GX_COLOR_ID_WHITE, GX_COLOR_ID_WHITE, GX_COLOR_ID_WHITE);
307
308 gx_widget_event_process_set((GX_WIDGET *)&demo_root_window, main_event_handler);
309
310 /* Define the size and the position of the progress bar. */
311 gx_utility_rectangle_define(&size, 200, 60, 389, 79);
312
313 /* Initialize the information of the progress bar. */
314 info.gx_progress_bar_info_max_val = 100;
315 info.gx_progress_bar_info_min_val = 0;
316 info.gx_progress_bar_info_current_val = 0;
317 info.gx_progress_bar_font_id = GX_FONT_ID_PROMPT;
318 info.gx_progress_bar_normal_text_color = GX_COLOR_ID_BLACK;
319 info.gx_progress_bar_selected_text_color = GX_COLOR_ID_BLACK;
320
321 /* Create the progress bar on top of the root window. */
322 gx_progress_bar_create(&progress_bar, NULL, &demo_root_window, &info, GX_STYLE_BORDER_THIN|GX_STYLE_PROGRESS_SEGMENTED_FILL|GX_STYLE_PROGRESS_TEXT_DRAW|GX_STYLE_PROGRESS_PERCENT, GX_ID_NONE, &size);
323
324 gx_utility_rectangle_define(&size, 55, 155, 215, 355);
325 gx_window_create(&border_style_window, "border style window", &demo_root_window, GX_STYLE_BORDER_NONE, GX_ID_NONE, &size);
326 gx_widget_fill_color_set(&border_style_window, GX_COLOR_ID_WHITE, GX_COLOR_ID_WHITE, GX_COLOR_ID_WHITE);
327 gx_widget_event_process_set((GX_WIDGET *)&border_style_window, border_win_event_handler);
328
329 gx_utility_rectangle_define(&size, 60, 160, 210, 190);
330 gx_prompt_create(&prompt_1, NULL, &border_style_window, BORDER_STYLE, GX_STYLE_BORDER_THIN|GX_STYLE_TEXT_LEFT, GX_ID_NONE, &size);
331 prompt_1.gx_widget_normal_fill_color = GX_COLOR_ID_WIDGET_FILL;
332 gx_prompt_text_color_set(&prompt_1, GX_COLOR_ID_WHITE, GX_COLOR_ID_WHITE, GX_COLOR_ID_WHITE);
333
334 /* Define the size and the position of the radio button for selecting the border style. */
335 gx_utility_rectangle_define(&size, 60, 200, 210, 230);
336 gx_radio_button_create(&radio_button_1, NULL, &border_style_window, RAISED_BORDER, GX_STYLE_TEXT_LEFT|GX_STYLE_ENABLED, ID_RAISED_BORDER, &size);
337
338 gx_utility_rectangle_define(&size, 60, 240, 210, 270);
339 gx_radio_button_create(&radio_button_2, NULL, &border_style_window, RECESSED_BORDER, GX_STYLE_TEXT_LEFT|GX_STYLE_ENABLED, ID_RECESSED_BORDER, &size);
340
341 gx_utility_rectangle_define(&size, 60, 280, 210, 310);
342 gx_radio_button_create(&radio_button_3, NULL, &border_style_window, THIN_BORDER, GX_STYLE_TEXT_LEFT|GX_STYLE_ENABLED|GX_STYLE_BUTTON_PUSHED, ID_THIN_BORDER, &size);
343
344 gx_utility_rectangle_define(&size, 60, 320, 210, 350);
345 gx_radio_button_create(&radio_button_4, NULL, &border_style_window, NO_BORDER, GX_STYLE_TEXT_LEFT|GX_STYLE_ENABLED, ID_NO_BORDER, &size);
346
347 gx_utility_rectangle_define(&size, 215, 155, 375, 315);
348 gx_window_create(&fill_style_window, "fill style window", &demo_root_window, GX_STYLE_BORDER_NONE, GX_ID_NONE, &size);
349 gx_widget_fill_color_set(&fill_style_window, GX_COLOR_ID_WHITE, GX_COLOR_ID_WHITE, GX_COLOR_ID_WHITE);
350 gx_widget_event_process_set((GX_WIDGET *)&fill_style_window, fill_win_event_handler);
351
352 gx_utility_rectangle_define(&size, 220, 160, 370, 190);
353 gx_prompt_create(&prompt_2, NULL, &fill_style_window, FILL_STYLE, GX_STYLE_BORDER_THIN|GX_STYLE_TEXT_LEFT, GX_ID_NONE, &size);
354 prompt_2.gx_widget_normal_fill_color = GX_COLOR_ID_WIDGET_FILL;
355 gx_prompt_text_color_set(&prompt_2, GX_COLOR_ID_WHITE, GX_COLOR_ID_WHITE, GX_COLOR_ID_WHITE);
356
357 /* Define the size and the position of the radio button for selecting the fill style. */
358 gx_utility_rectangle_define(&size, 220, 200, 370, 230);
359 gx_radio_button_create(&radio_button_5, NULL, &fill_style_window, SEGMENTED_FILL, GX_STYLE_TEXT_LEFT|GX_STYLE_ENABLED|GX_STYLE_BUTTON_PUSHED, ID_SEGMENTED_FILL, &size);
360
361 gx_utility_rectangle_define(&size, 220, 240, 370, 270);
362 gx_radio_button_create(&radio_button_6, NULL, &fill_style_window, SOLID_FILL, GX_STYLE_TEXT_LEFT|GX_STYLE_ENABLED, ID_SOLID_FILL, &size);
363
364 gx_utility_rectangle_define(&size, 220, 280, 370, 310);
365 gx_radio_button_create(&radio_button_7, NULL, &fill_style_window, PIXELMAP_FILL, GX_STYLE_TEXT_LEFT|GX_STYLE_ENABLED, ID_PIXELMAP_FILL, &size);
366
367 gx_utility_rectangle_define(&size, 380, 160, 480, 190);
368 gx_prompt_create(&prompt_3, NULL, &demo_root_window, TEXT, GX_STYLE_BORDER_THIN|GX_STYLE_TEXT_LEFT, GX_ID_NONE, &size);
369 prompt_3.gx_widget_normal_fill_color = GX_COLOR_ID_WIDGET_FILL;
370 gx_prompt_text_color_set(&prompt_3, GX_COLOR_ID_WHITE, GX_COLOR_ID_WHITE, GX_COLOR_ID_WHITE);
371
372 /* Define the size and the position of the checkbox button for selecting whether to show text or not. */
373 gx_utility_rectangle_define(&size, 380, 200, 480, 230);
374 gx_checkbox_create(&checkbox, NULL, &demo_root_window, SHOW_TEXT, GX_STYLE_TEXT_LEFT|GX_STYLE_ENABLED|GX_STYLE_BUTTON_PUSHED, ID_SHOW_TEXT, &size);
375 checkbox.gx_widget_normal_fill_color = GX_COLOR_ID_WHITE;
376
377 /* Show the root window. */
378 gx_widget_show(&demo_root_window);
379
380 /* start GUIX thread */
381 gx_system_start();
382 }
383
main_event_handler(GX_WIDGET * widget,GX_EVENT * myevent)384 UINT main_event_handler(GX_WIDGET *widget, GX_EVENT *myevent)
385 {
386 UINT status = 0;
387
388 switch(myevent -> gx_event_type)
389 {
390 case GX_EVENT_SHOW:
391 gx_widget_event_process(widget, myevent);
392 gx_system_timer_start((GX_WIDGET *)(&progress_bar), ID_PROGRESS_BAR_TIMER, 5, 5);
393 break;
394
395 case GX_EVENT_HIDE:
396 gx_widget_event_process(widget, myevent);
397 gx_system_timer_stop((GX_WIDGET *)(&progress_bar), 0);
398 break;
399
400 case GX_EVENT_TIMER:
401 if(myevent -> gx_event_payload.gx_event_timer_id == ID_PROGRESS_BAR_TIMER)
402 {
403 if(progress_bar.gx_progress_bar_info.gx_progress_bar_info_current_val < progress_bar.gx_progress_bar_info.gx_progress_bar_info_max_val)
404 {
405 progress_bar.gx_progress_bar_info.gx_progress_bar_info_current_val++;
406 }
407 else
408 {
409 progress_bar.gx_progress_bar_info.gx_progress_bar_info_current_val = progress_bar.gx_progress_bar_info.gx_progress_bar_info_min_val;
410 }
411 gx_system_dirty_mark(widget);
412 }
413 break;
414
415 case GX_SIGNAL(ID_SHOW_TEXT, GX_EVENT_TOGGLE_ON):
416 progress_bar.gx_widget_style |= GX_STYLE_PROGRESS_TEXT_DRAW;
417 gx_system_dirty_mark(widget);
418 break;
419
420 case GX_SIGNAL(ID_SHOW_TEXT, GX_EVENT_TOGGLE_OFF):
421 progress_bar.gx_widget_style &= ~GX_STYLE_PROGRESS_TEXT_DRAW;
422 gx_system_dirty_mark(widget);
423 break;
424
425 default:
426 status = gx_window_event_process((GX_WINDOW *)widget, myevent);
427 break;
428 }
429 return status;
430 }
431
border_win_event_handler(GX_WIDGET * widget,GX_EVENT * myevent)432 UINT border_win_event_handler(GX_WIDGET *widget, GX_EVENT *myevent)
433 {
434 UINT status = 0;
435
436 switch(myevent -> gx_event_type)
437 {
438 case GX_SIGNAL(ID_RAISED_BORDER, GX_EVENT_RADIO_SELECT):
439 progress_bar.gx_widget_style &= ~GX_STYLE_BORDER_MASK;
440 progress_bar.gx_widget_style |= GX_STYLE_BORDER_RAISED;
441 gx_system_dirty_mark((GX_WIDGET *)&demo_root_window);
442 break;
443
444 case GX_SIGNAL(ID_RECESSED_BORDER, GX_EVENT_RADIO_SELECT):
445 progress_bar.gx_widget_style &= ~GX_STYLE_BORDER_MASK;
446 progress_bar.gx_widget_style |= GX_STYLE_BORDER_RECESSED;
447 gx_system_dirty_mark((GX_WIDGET *)&demo_root_window);
448 break;
449
450 case GX_SIGNAL(ID_THIN_BORDER, GX_EVENT_RADIO_SELECT):
451 progress_bar.gx_widget_style &= ~GX_STYLE_BORDER_MASK;
452 progress_bar.gx_widget_style |= GX_STYLE_BORDER_THIN;
453 gx_system_dirty_mark((GX_WIDGET *)&demo_root_window);
454 break;
455
456 case GX_SIGNAL(ID_NO_BORDER, GX_EVENT_RADIO_SELECT):
457 progress_bar.gx_widget_style &= ~GX_STYLE_BORDER_MASK;
458 progress_bar.gx_widget_style |= GX_STYLE_BORDER_NONE;
459 gx_system_dirty_mark((GX_WIDGET *)&demo_root_window);
460 break;
461
462 default:
463 status = gx_window_event_process((GX_WINDOW *)widget, myevent);
464 break;
465 }
466 return status;
467 }
fill_win_event_handler(GX_WIDGET * widget,GX_EVENT * myevent)468 UINT fill_win_event_handler(GX_WIDGET *widget, GX_EVENT *myevent)
469 {
470 UINT status = 0;
471
472 switch(myevent -> gx_event_type)
473 {
474 case GX_SIGNAL(ID_SEGMENTED_FILL, GX_EVENT_RADIO_SELECT):
475 progress_bar.gx_widget_style |= GX_STYLE_PROGRESS_SEGMENTED_FILL;
476 progress_bar.gx_progress_bar_info.gx_progress_bar_fill_pixelmap = 0;
477 gx_system_dirty_mark((GX_WIDGET *)&demo_root_window);
478 break;
479
480 case GX_SIGNAL(ID_SOLID_FILL, GX_EVENT_RADIO_SELECT):
481 progress_bar.gx_widget_style &= ~GX_STYLE_PROGRESS_SEGMENTED_FILL;
482 progress_bar.gx_progress_bar_info.gx_progress_bar_fill_pixelmap = 0;
483 gx_system_dirty_mark((GX_WIDGET *)&demo_root_window);
484 break;
485
486 case GX_SIGNAL(ID_PIXELMAP_FILL, GX_EVENT_RADIO_SELECT):
487 progress_bar.gx_widget_style &= ~GX_STYLE_PROGRESS_SEGMENTED_FILL;
488 gx_progress_bar_pixelmap_set(&progress_bar, BID_PROMPT_FILL);
489 gx_system_dirty_mark((GX_WIDGET *)&demo_root_window);
490 break;
491
492 default:
493 status = gx_window_event_process((GX_WINDOW *)widget, myevent);
494 break;
495 }
496 return status;
497 }
498