1 /*******************************************************************************/
2 /*  This file is auto-generated by Azure RTOS GUIX Studio. Do not edit this    */
3 /*  file by hand. Modifications to this file should only be made by running    */
4 /*  the Azure RTOS GUIX Studio application and re-generating the application   */
5 /*  specification file(s). For more information please refer to the Azure RTOS */
6 /*  GUIX Studio User Guide, or visit our web site at azure.com/rtos            */
7 /*                                                                             */
8 /*  GUIX Studio Revision 6.1.12.0                                              */
9 /*  Date (dd.mm.yyyy): 25. 8.2022   Time (hh:mm): 18:43                        */
10 /*******************************************************************************/
11 
12 
13 #define GUIX_STUDIO_GENERATED_FILE
14 #include <stddef.h>
15 #include "demo_guix_binres_resources.h"
16 #include "demo_guix_binres_specifications.h"
17 
18 static GX_WIDGET *gx_studio_nested_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent);
19 SIMPLE_WINDOW_CONTROL_BLOCK simple_window;
20 GX_DISPLAY main_display_control_block;
21 GX_WINDOW_ROOT main_display_root_window;
22 GX_CANVAS  main_display_canvas_control_block;
23 
24 GX_STUDIO_DISPLAY_INFO demo_guix_binres_display_table[1] =
25 {
26     {
27     "main_display",
28     "main_display_canvas",
29     GX_NULL,
30     GX_NULL,
31     0,
32     0,
33     0,
34     640,                                     /* x resolution                   */
35     480,                                     /* y resolution                   */
36     &main_display_control_block,
37     &main_display_canvas_control_block,
38     &main_display_root_window,
39     GX_NULL,                                 /* canvas memory area             */
40     614400,                                  /* canvas memory size in bytes    */
41     GX_SCREEN_ROTATION_NONE                  /* rotation angle                 */
42     }
43 };
44 
45 
gx_studio_radio_button_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)46 UINT gx_studio_radio_button_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
47 {
48     UINT status;
49     GX_RADIO_BUTTON *button = (GX_RADIO_BUTTON *) control_block;
50     GX_TEXT_BUTTON *text_button = (GX_TEXT_BUTTON *) button;
51     GX_RADIO_BUTTON_PROPERTIES *props = (GX_RADIO_BUTTON_PROPERTIES *) info->properties;
52     status = gx_radio_button_create(button, info->widget_name, parent, props->string_id, info->style, info->widget_id, &info->size);
53     if (status == GX_SUCCESS)
54     {
55         gx_text_button_font_set(text_button, props->font_id);
56 #if defined(GUIX_5_4_0_COMPATIBILITY)
57         gx_text_button_text_color_set(text_button, props->normal_text_color_id, props->selected_text_color_id);
58 #else
59         gx_text_button_text_color_set(text_button, props->normal_text_color_id, props->selected_text_color_id, props->disabled_text_color_id);
60 #endif
61 
62         if (props->off_pixelmap_id ||
63             props->on_pixelmap_id ||
64             props->off_disabled_pixelmap_id ||
65             props->on_disabled_pixelmap_id)
66         {
67             gx_radio_button_pixelmap_set(button,
68                                      props->off_pixelmap_id,
69                                      props->on_pixelmap_id,
70                                      props->off_disabled_pixelmap_id,
71                                      props->on_disabled_pixelmap_id);
72         }
73     }
74     return status;
75 }
76 
gx_studio_pixelmap_button_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)77 UINT gx_studio_pixelmap_button_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
78 {
79     UINT status;
80     GX_PIXELMAP_BUTTON *button = (GX_PIXELMAP_BUTTON *) control_block;
81     GX_PIXELMAP_BUTTON_PROPERTIES *props = (GX_PIXELMAP_BUTTON_PROPERTIES *) info->properties;
82     status = gx_pixelmap_button_create(button, info->widget_name, parent,
83                props->normal_pixelmap_id,
84                props->selected_pixelmap_id,
85                props->disabled_pixelmap_id,
86                info->style, info->widget_id, &info->size);
87     return status;
88 }
89 
gx_studio_icon_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)90 UINT gx_studio_icon_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
91 {
92     UINT status;
93     GX_ICON *icon = (GX_ICON *) control_block;
94     GX_ICON_PROPERTIES *props = (GX_ICON_PROPERTIES *) info->properties;
95     status = gx_icon_create(icon, info->widget_name, parent, props->normal_pixelmap_id, info->style, info->widget_id, info->size.gx_rectangle_left, info->size.gx_rectangle_top);
96     if (props->selected_pixelmap_id)
97     {
98         gx_icon_pixelmap_set(icon, props->normal_pixelmap_id, props->selected_pixelmap_id);
99     }
100     else
101     {
102         gx_widget_resize((GX_WIDGET *)icon, (GX_RECTANGLE *)&info->size);
103     }
104     return status;
105 }
106 
gx_studio_prompt_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)107 UINT gx_studio_prompt_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
108 {
109     UINT status;
110     GX_PROMPT *prompt = (GX_PROMPT *) control_block;
111     GX_PROMPT_PROPERTIES *props = (GX_PROMPT_PROPERTIES *) info->properties;
112     status = gx_prompt_create(prompt, info->widget_name, parent, props->string_id, info->style, info->widget_id, &info->size);
113     if (status == GX_SUCCESS)
114     {
115         gx_prompt_font_set(prompt, props->font_id);
116 #if defined(GUIX_5_4_0_COMPATIBILITY)
117         gx_prompt_text_color_set(prompt, props->normal_text_color_id, props->selected_text_color_id);
118 #else
119         gx_prompt_text_color_set(prompt, props->normal_text_color_id, props->selected_text_color_id, props->disabled_text_color_id);
120 #endif
121     }
122     return status;
123 }
124 
gx_studio_window_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)125 UINT gx_studio_window_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
126 {
127     UINT status;
128     GX_WINDOW *window = (GX_WINDOW *) control_block;
129     GX_WINDOW_PROPERTIES *props = (GX_WINDOW_PROPERTIES *) info->properties;
130     status = gx_window_create(window, info->widget_name, parent, info->style, info->widget_id, &info->size);
131     if (status == GX_SUCCESS)
132     {
133         if (props->wallpaper_id)
134         {
135             gx_window_wallpaper_set(window, props->wallpaper_id, info->style & GX_STYLE_TILE_WALLPAPER);
136         }
137     }
138     return status;
139 }
140 
gx_studio_horizontal_scrollbar_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)141 UINT gx_studio_horizontal_scrollbar_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
142 {
143     UINT status;
144     GX_SCROLLBAR *scroll = (GX_SCROLLBAR *) control_block;
145     GX_SCROLLBAR_APPEARANCE *appearance = (GX_SCROLLBAR_APPEARANCE *) info->properties;
146     status = gx_horizontal_scrollbar_create(scroll, info->widget_name, parent, appearance, info->style);
147     return status;
148 }
149 
gx_studio_vertical_scrollbar_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)150 UINT gx_studio_vertical_scrollbar_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
151 {
152     UINT status;
153     GX_SCROLLBAR *scroll = (GX_SCROLLBAR *) control_block;
154     GX_SCROLLBAR_APPEARANCE *appearance = (GX_SCROLLBAR_APPEARANCE *) info->properties;
155     status = gx_vertical_scrollbar_create(scroll, info->widget_name, parent, appearance, info->style);
156     return status;
157 }
158 GX_WINDOW_PROPERTIES simple_window_properties =
159 {
160     0                                        /* wallpaper pixelmap id          */
161 };
162 GX_PIXELMAP_BUTTON_PROPERTIES simple_window_simple_button_properties =
163 {
164     GX_PIXELMAP_ID_BUTTON,                   /* normal pixelmap id             */
165     GX_PIXELMAP_ID_BUTTON_ACTIVE,            /* selected pixelmap id           */
166     0                                        /* disabled pixelmap id           */
167 };
168 GX_PROMPT_PROPERTIES simple_window_button_text_properties =
169 {
170     GX_STRING_ID_STRING_22,                  /* string id                      */
171     GX_FONT_ID_SYSTEM,                       /* font id                        */
172     GX_COLOR_ID_TEXT,                        /* normal text color              */
173     GX_COLOR_ID_SELECTED_TEXT,               /* selected text color            */
174     GX_COLOR_ID_TEXT                         /* disabled text color            */
175 };
176 GX_WINDOW_PROPERTIES simple_window_scroll_frame_properties =
177 {
178     0                                        /* wallpaper pixelmap id          */
179 };
180 GX_WINDOW_PROPERTIES simple_window_window_properties =
181 {
182     GX_PIXELMAP_ID_RED_APPLE                 /* wallpaper pixelmap id          */
183 };
184 GX_SCROLLBAR_APPEARANCE  simple_window_vertical_scroll_properties =
185 {
186     20,                                      /* scroll width                   */
187     12,                                      /* thumb width                    */
188     20,                                      /* thumb travel min               */
189     20,                                      /* thumb travel max               */
190     4,                                       /* thumb border style             */
191     0,                                       /* scroll fill pixelmap           */
192     0,                                       /* scroll thumb pixelmap          */
193     0,                                       /* scroll up pixelmap             */
194     0,                                       /* scroll down pixelmap           */
195     GX_COLOR_ID_ORANGE,                      /* scroll thumb color             */
196     GX_COLOR_ID_SCROLL_BUTTON,               /* scroll thumb border color      */
197     GX_COLOR_ID_BLUE,                        /* scroll button color            */
198 };
199 GX_SCROLLBAR_APPEARANCE  simple_window_hscroll_properties =
200 {
201     20,                                      /* scroll width                   */
202     10,                                      /* thumb width                    */
203     2,                                       /* thumb travel min               */
204     2,                                       /* thumb travel max               */
205     4,                                       /* thumb border style             */
206     0,                                       /* scroll fill pixelmap           */
207     0,                                       /* scroll thumb pixelmap          */
208     0,                                       /* scroll up pixelmap             */
209     0,                                       /* scroll down pixelmap           */
210     GX_COLOR_ID_ORANGE,                      /* scroll thumb color             */
211     GX_COLOR_ID_SCROLL_BUTTON,               /* scroll thumb border color      */
212     GX_COLOR_ID_BTN_UPPER,                   /* scroll button color            */
213 };
214 GX_WINDOW_PROPERTIES simple_window_window_theme_setting_properties =
215 {
216     0                                        /* wallpaper pixelmap id          */
217 };
218 GX_RADIO_BUTTON_PROPERTIES simple_window_radio_button_theme_1_properties =
219 {
220     GX_STRING_ID_STRING_12,                  /* string id                      */
221     GX_FONT_ID_SYSTEM,                       /* font id                        */
222     GX_COLOR_ID_TEXT_COLOR,                  /* normal text color              */
223     GX_COLOR_ID_TEXT_COLOR,                  /* selected text color            */
224     GX_COLOR_ID_TEXT_COLOR,                  /* disabled text color            */
225     0,                                       /* off pixelmap id                */
226     0,                                       /* on pixelmap id                 */
227     0,                                       /* off disabled pixelmap id       */
228     0                                        /* on disabled pixelmap id        */
229 };
230 GX_PROMPT_PROPERTIES simple_window_prompt_Themes_properties =
231 {
232     GX_STRING_ID_STRING_11,                  /* string id                      */
233     GX_FONT_ID_PROMPT,                       /* font id                        */
234     GX_COLOR_ID_TEXT,                        /* normal text color              */
235     GX_COLOR_ID_SELECTED_TEXT,               /* selected text color            */
236     GX_COLOR_ID_TEXT                         /* disabled text color            */
237 };
238 GX_RADIO_BUTTON_PROPERTIES simple_window_radio_button_theme_2_properties =
239 {
240     GX_STRING_ID_STRING_13,                  /* string id                      */
241     GX_FONT_ID_SYSTEM,                       /* font id                        */
242     GX_COLOR_ID_TEXT_COLOR,                  /* normal text color              */
243     GX_COLOR_ID_TEXT_COLOR,                  /* selected text color            */
244     GX_COLOR_ID_TEXT_COLOR,                  /* disabled text color            */
245     0,                                       /* off pixelmap id                */
246     0,                                       /* on pixelmap id                 */
247     0,                                       /* off disabled pixelmap id       */
248     0                                        /* on disabled pixelmap id        */
249 };
250 GX_WINDOW_PROPERTIES simple_window_window_language_setting_properties =
251 {
252     0                                        /* wallpaper pixelmap id          */
253 };
254 GX_RADIO_BUTTON_PROPERTIES simple_window_radio_button_English_properties =
255 {
256     GX_STRING_ID_STRING_1,                   /* string id                      */
257     GX_FONT_ID_SYSTEM,                       /* font id                        */
258     GX_COLOR_ID_TEXT_COLOR,                  /* normal text color              */
259     GX_COLOR_ID_TEXT_COLOR,                  /* selected text color            */
260     GX_COLOR_ID_TEXT_COLOR,                  /* disabled text color            */
261     0,                                       /* off pixelmap id                */
262     0,                                       /* on pixelmap id                 */
263     0,                                       /* off disabled pixelmap id       */
264     0                                        /* on disabled pixelmap id        */
265 };
266 GX_PROMPT_PROPERTIES simple_window_prompt_Languages_properties =
267 {
268     GX_STRING_ID_STRING_17,                  /* string id                      */
269     GX_FONT_ID_PROMPT,                       /* font id                        */
270     GX_COLOR_ID_TEXT,                        /* normal text color              */
271     GX_COLOR_ID_SELECTED_TEXT,               /* selected text color            */
272     GX_COLOR_ID_TEXT                         /* disabled text color            */
273 };
274 GX_RADIO_BUTTON_PROPERTIES simple_window_radio_button_Chinese_properties =
275 {
276     GX_STRING_ID_STRING_3,                   /* string id                      */
277     GX_FONT_ID_SYSTEM,                       /* font id                        */
278     GX_COLOR_ID_TEXT_COLOR,                  /* normal text color              */
279     GX_COLOR_ID_TEXT_COLOR,                  /* selected text color            */
280     GX_COLOR_ID_TEXT_COLOR,                  /* disabled text color            */
281     0,                                       /* off pixelmap id                */
282     0,                                       /* on pixelmap id                 */
283     0,                                       /* off disabled pixelmap id       */
284     0                                        /* on disabled pixelmap id        */
285 };
286 GX_ICON_PROPERTIES simple_window_logo_properties =
287 {
288     GX_PIXELMAP_ID_MS_AZURE_LOGO_SMALL,      /* normal pixelmap id             */
289     0                                        /* selected pixelmap id           */
290 };
291 
292 GX_CONST GX_STUDIO_WIDGET simple_window_button_text_define =
293 {
294     "button_text",
295     GX_TYPE_PROMPT,                          /* widget type                    */
296     GX_ID_NONE,                              /* widget id                      */
297     #if defined(GX_WIDGET_USER_DATA)
298     0,                                       /* user data                      */
299     #endif
300     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_TEXT_CENTER,   /* style flags */
301     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
302     sizeof(GX_PROMPT),                       /* control block size             */
303     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
304     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
305     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
306     gx_studio_prompt_create,                 /* create function                */
307     GX_NULL,                                 /* drawing function override      */
308     GX_NULL,                                 /* event function override        */
309     {441, 134, 526, 151},                    /* widget size                    */
310     GX_NULL,                                 /* no next widget                 */
311     GX_NULL,                                 /* no child widgets               */
312     offsetof(SIMPLE_WINDOW_CONTROL_BLOCK, simple_window_button_text), /* control block */
313     (void *) &simple_window_button_text_properties /* extended properties      */
314 };
315 
316 GX_CONST GX_STUDIO_WIDGET simple_window_hscroll_define =
317 {
318     "hscroll",
319     GX_TYPE_HORIZONTAL_SCROLL,               /* widget type                    */
320     ID_HORIZONTAL_SCROLLBAR,                 /* widget id                      */
321     #if defined(GX_WIDGET_USER_DATA)
322     0,                                       /* user data                      */
323     #endif
324     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_TILE_BACKGROUND|GX_SCROLLBAR_RELATIVE_THUMB|GX_SCROLLBAR_HORIZONTAL,   /* style flags */
325     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
326     sizeof(GX_SCROLLBAR),                    /* control block size             */
327     GX_COLOR_ID_ORANGE,                      /* normal color id                */
328     GX_COLOR_ID_SCROLL_FILL,                 /* selected color id              */
329     GX_COLOR_ID_ORANGE,                      /* disabled color id              */
330     gx_studio_horizontal_scrollbar_create,     /* create function              */
331     GX_NULL,                                 /* drawing function override      */
332     GX_NULL,                                 /* event function override        */
333     {161, 187, 350, 206},                    /* widget size                    */
334     GX_NULL,                                 /* no next widget                 */
335     GX_NULL,                                 /* no child widgets               */
336     offsetof(SIMPLE_WINDOW_CONTROL_BLOCK, simple_window_hscroll), /* control block */
337     (void *) &simple_window_hscroll_properties /* extended properties          */
338 };
339 
340 GX_CONST GX_STUDIO_WIDGET simple_window_vertical_scroll_define =
341 {
342     "vertical_scroll",
343     GX_TYPE_VERTICAL_SCROLL,                 /* widget type                    */
344     ID_VERTICAL_SCROLLBAR,                   /* widget id                      */
345     #if defined(GX_WIDGET_USER_DATA)
346     0,                                       /* user data                      */
347     #endif
348     GX_STYLE_BORDER_THIN|GX_SCROLLBAR_RELATIVE_THUMB|GX_SCROLLBAR_END_BUTTONS|GX_SCROLLBAR_VERTICAL,   /* style flags */
349     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
350     sizeof(GX_SCROLLBAR),                    /* control block size             */
351     GX_COLOR_ID_SCROLL_FILL,                 /* normal color id                */
352     GX_COLOR_ID_SCROLL_FILL,                 /* selected color id              */
353     GX_COLOR_ID_SCROLL_FILL,                 /* disabled color id              */
354     gx_studio_vertical_scrollbar_create,     /* create function                */
355     GX_NULL,                                 /* drawing function override      */
356     GX_NULL,                                 /* event function override        */
357     {351, 73, 370, 206},                     /* widget size                    */
358     &simple_window_hscroll_define,           /* next widget definition         */
359     GX_NULL,                                 /* no child widgets               */
360     offsetof(SIMPLE_WINDOW_CONTROL_BLOCK, simple_window_vertical_scroll), /* control block */
361     (void *) &simple_window_vertical_scroll_properties /* extended properties  */
362 };
363 
364 GX_CONST GX_STUDIO_WIDGET simple_window_window_define =
365 {
366     "window",
367     GX_TYPE_WINDOW,                          /* widget type                    */
368     GX_ID_NONE,                              /* widget id                      */
369     #if defined(GX_WIDGET_USER_DATA)
370     0,                                       /* user data                      */
371     #endif
372     GX_STYLE_BORDER_THIN,                    /* style flags                    */
373     0,                                       /* status flags                   */
374     sizeof(GX_WINDOW),                       /* control block size             */
375     GX_COLOR_ID_WINDOW_FILL,                 /* normal color id                */
376     GX_COLOR_ID_WINDOW_FILL,                 /* selected color id              */
377     GX_COLOR_ID_WINDOW_FILL,                 /* disabled color id              */
378     gx_studio_window_create,                 /* create function                */
379     GX_NULL,                                 /* drawing function override      */
380     GX_NULL,                                 /* event function override        */
381     {160, 72, 354, 338},                     /* widget size                    */
382     &simple_window_vertical_scroll_define,   /* next widget definition         */
383     GX_NULL,                                 /* no child widgets               */
384     offsetof(SIMPLE_WINDOW_CONTROL_BLOCK, simple_window_window), /* control block */
385     (void *) &simple_window_window_properties /* extended properties           */
386 };
387 
388 GX_CONST GX_STUDIO_WIDGET simple_window_radio_button_theme_2_define =
389 {
390     "radio_button_theme_2",
391     GX_TYPE_RADIO_BUTTON,                    /* widget type                    */
392     ID_THEME_2,                              /* widget id                      */
393     #if defined(GX_WIDGET_USER_DATA)
394     0,                                       /* user data                      */
395     #endif
396     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_BUTTON_RADIO|GX_STYLE_TEXT_LEFT,   /* style flags */
397     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
398     sizeof(GX_RADIO_BUTTON),                 /* control block size             */
399     GX_COLOR_ID_BTN_LOWER,                   /* normal color id                */
400     GX_COLOR_ID_BTN_UPPER,                   /* selected color id              */
401     GX_COLOR_ID_BTN_LOWER,                   /* disabled color id              */
402     gx_studio_radio_button_create,           /* create function                */
403     GX_NULL,                                 /* drawing function override      */
404     GX_NULL,                                 /* event function override        */
405     {164, 345, 261, 374},                    /* widget size                    */
406     GX_NULL,                                 /* no next widget                 */
407     GX_NULL,                                 /* no child widgets               */
408     offsetof(SIMPLE_WINDOW_CONTROL_BLOCK, simple_window_radio_button_theme_2), /* control block */
409     (void *) &simple_window_radio_button_theme_2_properties /* extended properties */
410 };
411 
412 GX_CONST GX_STUDIO_WIDGET simple_window_prompt_Themes_define =
413 {
414     "prompt_Themes",
415     GX_TYPE_PROMPT,                          /* widget type                    */
416     GX_ID_NONE,                              /* widget id                      */
417     #if defined(GX_WIDGET_USER_DATA)
418     0,                                       /* user data                      */
419     #endif
420     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_TEXT_CENTER,   /* style flags */
421     0,                                       /* status flags                   */
422     sizeof(GX_PROMPT),                       /* control block size             */
423     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
424     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
425     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
426     gx_studio_prompt_create,                 /* create function                */
427     GX_NULL,                                 /* drawing function override      */
428     GX_NULL,                                 /* event function override        */
429     {159, 271, 238, 294},                    /* widget size                    */
430     &simple_window_radio_button_theme_2_define, /* next widget definition      */
431     GX_NULL,                                 /* no child widgets               */
432     offsetof(SIMPLE_WINDOW_CONTROL_BLOCK, simple_window_prompt_Themes), /* control block */
433     (void *) &simple_window_prompt_Themes_properties /* extended properties    */
434 };
435 
436 GX_CONST GX_STUDIO_WIDGET simple_window_radio_button_theme_1_define =
437 {
438     "radio_button_theme_1",
439     GX_TYPE_RADIO_BUTTON,                    /* widget type                    */
440     ID_THEME_1,                              /* widget id                      */
441     #if defined(GX_WIDGET_USER_DATA)
442     0,                                       /* user data                      */
443     #endif
444     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_BUTTON_PUSHED|GX_STYLE_BUTTON_RADIO|GX_STYLE_TEXT_LEFT,   /* style flags */
445     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
446     sizeof(GX_RADIO_BUTTON),                 /* control block size             */
447     GX_COLOR_ID_BTN_UPPER,                   /* normal color id                */
448     GX_COLOR_ID_BTN_UPPER,                   /* selected color id              */
449     GX_COLOR_ID_BTN_UPPER,                   /* disabled color id              */
450     gx_studio_radio_button_create,           /* create function                */
451     GX_NULL,                                 /* drawing function override      */
452     GX_NULL,                                 /* event function override        */
453     {164, 306, 261, 333},                    /* widget size                    */
454     &simple_window_prompt_Themes_define,     /* next widget definition         */
455     GX_NULL,                                 /* no child widgets               */
456     offsetof(SIMPLE_WINDOW_CONTROL_BLOCK, simple_window_radio_button_theme_1), /* control block */
457     (void *) &simple_window_radio_button_theme_1_properties /* extended properties */
458 };
459 
460 GX_CONST GX_STUDIO_WIDGET simple_window_radio_button_Chinese_define =
461 {
462     "radio_button_Chinese",
463     GX_TYPE_RADIO_BUTTON,                    /* widget type                    */
464     ID_SPANISH,                              /* widget id                      */
465     #if defined(GX_WIDGET_USER_DATA)
466     0,                                       /* user data                      */
467     #endif
468     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_BUTTON_RADIO|GX_STYLE_TEXT_LEFT,   /* style flags */
469     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
470     sizeof(GX_RADIO_BUTTON),                 /* control block size             */
471     GX_COLOR_ID_BTN_LOWER,                   /* normal color id                */
472     GX_COLOR_ID_BTN_UPPER,                   /* selected color id              */
473     GX_COLOR_ID_BTN_LOWER,                   /* disabled color id              */
474     gx_studio_radio_button_create,           /* create function                */
475     GX_NULL,                                 /* drawing function override      */
476     GX_NULL,                                 /* event function override        */
477     {351, 343, 477, 371},                    /* widget size                    */
478     GX_NULL,                                 /* no next widget                 */
479     GX_NULL,                                 /* no child widgets               */
480     offsetof(SIMPLE_WINDOW_CONTROL_BLOCK, simple_window_radio_button_Chinese), /* control block */
481     (void *) &simple_window_radio_button_Chinese_properties /* extended properties */
482 };
483 
484 GX_CONST GX_STUDIO_WIDGET simple_window_prompt_Languages_define =
485 {
486     "prompt_Languages",
487     GX_TYPE_PROMPT,                          /* widget type                    */
488     GX_ID_NONE,                              /* widget id                      */
489     #if defined(GX_WIDGET_USER_DATA)
490     0,                                       /* user data                      */
491     #endif
492     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_TEXT_CENTER,   /* style flags */
493     0,                                       /* status flags                   */
494     sizeof(GX_PROMPT),                       /* control block size             */
495     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
496     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
497     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
498     gx_studio_prompt_create,                 /* create function                */
499     GX_NULL,                                 /* drawing function override      */
500     GX_NULL,                                 /* event function override        */
501     {346, 270, 458, 293},                    /* widget size                    */
502     &simple_window_radio_button_Chinese_define, /* next widget definition      */
503     GX_NULL,                                 /* no child widgets               */
504     offsetof(SIMPLE_WINDOW_CONTROL_BLOCK, simple_window_prompt_Languages), /* control block */
505     (void *) &simple_window_prompt_Languages_properties /* extended properties */
506 };
507 
508 GX_CONST GX_STUDIO_WIDGET simple_window_radio_button_English_define =
509 {
510     "radio_button_English",
511     GX_TYPE_RADIO_BUTTON,                    /* widget type                    */
512     ID_ENGLISH,                              /* widget id                      */
513     #if defined(GX_WIDGET_USER_DATA)
514     0,                                       /* user data                      */
515     #endif
516     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_BUTTON_PUSHED|GX_STYLE_BUTTON_RADIO|GX_STYLE_TEXT_LEFT,   /* style flags */
517     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
518     sizeof(GX_RADIO_BUTTON),                 /* control block size             */
519     GX_COLOR_ID_BTN_LOWER,                   /* normal color id                */
520     GX_COLOR_ID_BTN_UPPER,                   /* selected color id              */
521     GX_COLOR_ID_BTN_LOWER,                   /* disabled color id              */
522     gx_studio_radio_button_create,           /* create function                */
523     GX_NULL,                                 /* drawing function override      */
524     GX_NULL,                                 /* event function override        */
525     {351, 305, 477, 333},                    /* widget size                    */
526     &simple_window_prompt_Languages_define,  /* next widget definition         */
527     GX_NULL,                                 /* no child widgets               */
528     offsetof(SIMPLE_WINDOW_CONTROL_BLOCK, simple_window_radio_button_English), /* control block */
529     (void *) &simple_window_radio_button_English_properties /* extended properties */
530 };
531 
532 GX_CONST GX_STUDIO_WIDGET simple_window_logo_define =
533 {
534     "logo",
535     GX_TYPE_ICON,                            /* widget type                    */
536     GX_ID_NONE,                              /* widget id                      */
537     #if defined(GX_WIDGET_USER_DATA)
538     0,                                       /* user data                      */
539     #endif
540     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_HALIGN_LEFT|GX_STYLE_VALIGN_TOP,   /* style flags */
541     0,                                       /* status flags                   */
542     sizeof(GX_ICON),                         /* control block size             */
543     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
544     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
545     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
546     gx_studio_icon_create,                   /* create function                */
547     GX_NULL,                                 /* drawing function override      */
548     GX_NULL,                                 /* event function override        */
549     {15, 15, 203, 44},                       /* widget size                    */
550     GX_NULL,                                 /* no next widget                 */
551     GX_NULL,                                 /* no child widgets               */
552     offsetof(SIMPLE_WINDOW_CONTROL_BLOCK, simple_window_logo), /* control block */
553     (void *) &simple_window_logo_properties  /* extended properties            */
554 };
555 
556 GX_CONST GX_STUDIO_WIDGET simple_window_window_language_setting_define =
557 {
558     "window_language_setting",
559     GX_TYPE_WINDOW,                          /* widget type                    */
560     GX_ID_NONE,                              /* widget id                      */
561     #if defined(GX_WIDGET_USER_DATA)
562     0,                                       /* user data                      */
563     #endif
564     GX_STYLE_BORDER_NONE,                    /* style flags                    */
565     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
566     sizeof(GX_WINDOW),                       /* control block size             */
567     GX_COLOR_ID_WINDOW_FILL,                 /* normal color id                */
568     GX_COLOR_ID_WINDOW_FILL,                 /* selected color id              */
569     GX_COLOR_ID_WINDOW_FILL,                 /* disabled color id              */
570     gx_studio_window_create,                 /* create function                */
571     GX_NULL,                                 /* drawing function override      */
572     GX_NULL,                                 /* event function override        */
573     {337, 256, 492, 387},                    /* widget size                    */
574     &simple_window_logo_define,              /* next widget definition         */
575     &simple_window_radio_button_English_define, /* child widget definition     */
576     offsetof(SIMPLE_WINDOW_CONTROL_BLOCK, simple_window_window_language_setting), /* control block */
577     (void *) &simple_window_window_language_setting_properties /* extended properties */
578 };
579 
580 GX_CONST GX_STUDIO_WIDGET simple_window_window_theme_setting_define =
581 {
582     "window_theme_setting",
583     GX_TYPE_WINDOW,                          /* widget type                    */
584     GX_ID_NONE,                              /* widget id                      */
585     #if defined(GX_WIDGET_USER_DATA)
586     0,                                       /* user data                      */
587     #endif
588     GX_STYLE_BORDER_NONE,                    /* style flags                    */
589     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
590     sizeof(GX_WINDOW),                       /* control block size             */
591     GX_COLOR_ID_WINDOW_FILL,                 /* normal color id                */
592     GX_COLOR_ID_WINDOW_FILL,                 /* selected color id              */
593     GX_COLOR_ID_WINDOW_FILL,                 /* disabled color id              */
594     gx_studio_window_create,                 /* create function                */
595     GX_NULL,                                 /* drawing function override      */
596     GX_NULL,                                 /* event function override        */
597     {150, 257, 318, 385},                    /* widget size                    */
598     &simple_window_window_language_setting_define, /* next widget definition   */
599     &simple_window_radio_button_theme_1_define, /* child widget definition     */
600     offsetof(SIMPLE_WINDOW_CONTROL_BLOCK, simple_window_window_theme_setting), /* control block */
601     (void *) &simple_window_window_theme_setting_properties /* extended properties */
602 };
603 
604 GX_CONST GX_STUDIO_WIDGET simple_window_scroll_frame_define =
605 {
606     "scroll_frame",
607     GX_TYPE_WINDOW,                          /* widget type                    */
608     GX_ID_NONE,                              /* widget id                      */
609     #if defined(GX_WIDGET_USER_DATA)
610     0,                                       /* user data                      */
611     #endif
612     GX_STYLE_BORDER_THIN,                    /* style flags                    */
613     0,                                       /* status flags                   */
614     sizeof(GX_WINDOW),                       /* control block size             */
615     GX_COLOR_ID_SCROLL_FILL,                 /* normal color id                */
616     GX_COLOR_ID_SCROLL_FILL,                 /* selected color id              */
617     GX_COLOR_ID_SCROLL_FILL,                 /* disabled color id              */
618     gx_studio_window_create,                 /* create function                */
619     GX_NULL,                                 /* drawing function override      */
620     GX_NULL,                                 /* event function override        */
621     {160, 72, 371, 207},                     /* widget size                    */
622     &simple_window_window_theme_setting_define, /* next widget definition      */
623     &simple_window_window_define,            /* child widget definition        */
624     offsetof(SIMPLE_WINDOW_CONTROL_BLOCK, simple_window_scroll_frame), /* control block */
625     (void *) &simple_window_scroll_frame_properties /* extended properties     */
626 };
627 
628 GX_CONST GX_STUDIO_WIDGET simple_window_simple_button_define =
629 {
630     "simple_button",
631     GX_TYPE_PIXELMAP_BUTTON,                 /* widget type                    */
632     GX_ID_NONE,                              /* widget id                      */
633     #if defined(GX_WIDGET_USER_DATA)
634     0,                                       /* user data                      */
635     #endif
636     GX_STYLE_BORDER_NONE|GX_STYLE_ENABLED,   /* style flags                    */
637     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
638     sizeof(GX_PIXELMAP_BUTTON),              /* control block size             */
639     GX_COLOR_ID_BTN_LOWER,                   /* normal color id                */
640     GX_COLOR_ID_BTN_UPPER,                   /* selected color id              */
641     GX_COLOR_ID_BTN_LOWER,                   /* disabled color id              */
642     gx_studio_pixelmap_button_create,        /* create function                */
643     GX_NULL,                                 /* drawing function override      */
644     GX_NULL,                                 /* event function override        */
645     {414, 121, 553, 164},                    /* widget size                    */
646     &simple_window_scroll_frame_define,      /* next widget definition         */
647     &simple_window_button_text_define,       /* child widget definition        */
648     offsetof(SIMPLE_WINDOW_CONTROL_BLOCK, simple_window_simple_button), /* control block */
649     (void *) &simple_window_simple_button_properties /* extended properties    */
650 };
651 
652 GX_CONST GX_STUDIO_WIDGET simple_window_define =
653 {
654     "simple_window",
655     GX_TYPE_WINDOW,                          /* widget type                    */
656     GX_ID_NONE,                              /* widget id                      */
657     #if defined(GX_WIDGET_USER_DATA)
658     0,                                       /* user data                      */
659     #endif
660     GX_STYLE_BORDER_NONE,                    /* style flags                    */
661     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
662     sizeof(SIMPLE_WINDOW_CONTROL_BLOCK),     /* control block size             */
663     GX_COLOR_ID_WINDOW_FILL,                 /* normal color id                */
664     GX_COLOR_ID_WINDOW_FILL,                 /* selected color id              */
665     GX_COLOR_ID_WINDOW_FILL,                 /* disabled color id              */
666     gx_studio_window_create,                 /* create function                */
667     GX_NULL,                                 /* drawing function override      */
668     (UINT (*)(GX_WIDGET *, GX_EVENT *)) simple_window_event_handler, /* event function override */
669     {0, 0, 639, 479},                        /* widget size                    */
670     GX_NULL,                                 /* next widget                    */
671     &simple_window_simple_button_define,     /* child widget                   */
672     0,                                       /* control block                  */
673     (void *) &simple_window_properties       /* extended properties            */
674 };
675 GX_CONST GX_STUDIO_WIDGET_ENTRY demo_guix_binres_widget_table[] =
676 {
677     { &simple_window_define, (GX_WIDGET *) &simple_window },
678     {GX_NULL, GX_NULL}
679 };
680 
gx_studio_nested_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)681 static GX_WIDGET *gx_studio_nested_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
682 {
683     UINT status = GX_SUCCESS;
684     GX_WIDGET *widget = GX_NULL;
685     GX_VALUE   list_count = 0;
686     GX_VALUE   list_total_count = 0;
687 
688     if(parent && (parent->gx_widget_type == GX_TYPE_MENU))
689     {
690         list_total_count = ((GX_MENU *)parent)->gx_menu_list_total_count;
691     }
692 
693     while(definition && status == GX_SUCCESS)
694     {
695         if (definition->create_function)
696         {
697             if (definition->style & GX_STYLE_DYNAMICALLY_ALLOCATED)
698             {
699                 status = gx_widget_allocate(&widget, definition->control_block_size);
700                 if (status != GX_SUCCESS)
701                 {
702                     return GX_NULL;
703                 }
704             }
705             else
706             {
707                 if (control == GX_NULL)
708                 {
709                     return GX_NULL;
710                 }
711                 widget = (GX_WIDGET *) (control + definition->control_block_offset);
712             }
713 
714             status = definition->create_function(definition, widget, parent);
715 
716             if(list_count < list_total_count)
717             {
718                 gx_menu_insert((GX_MENU *)parent, widget);
719                 ((GX_MENU *)parent)->gx_menu_list_total_count--;
720                 list_count++;
721             }
722 
723             if (status == GX_SUCCESS)
724             {
725                 if (definition->widget_type != GX_TYPE_TEMPLATE)
726                 {
727 #if defined(GUIX_5_4_0_COMPATIBILITY)
728                     gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id);
729 #else
730                     gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id, definition->disabled_fill_color_id);
731 #endif
732                 }
733 
734                 if (!(definition->status & GX_STATUS_ACCEPTS_FOCUS))
735                 {
736                     gx_widget_status_remove(widget, GX_STATUS_ACCEPTS_FOCUS);
737                 }
738 
739                 if (definition->draw_function)
740                 {
741                     gx_widget_draw_set(widget, definition->draw_function);
742                 }
743                 if (definition->event_function)
744                 {
745                     gx_widget_event_process_set(widget, definition->event_function);
746                 }
747 
748                 #if defined(GX_WIDGET_USER_DATA)
749                 widget->gx_widget_user_data = definition->user_data;
750                 #endif
751 
752                 if (definition->child_widget)
753                 {
754                     gx_studio_nested_widget_create(control, definition->child_widget, widget);
755                 }
756             }
757             definition = definition->next_widget;
758         }
759     }
760     return widget;
761 }
762 
gx_studio_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)763 GX_WIDGET *gx_studio_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
764 {
765     GX_WIDGET *widget;
766     widget = gx_studio_nested_widget_create(control, definition, GX_NULL);
767 
768     if (parent && widget)
769     {
770         gx_widget_attach(parent, widget);
771     }
772     return widget;
773 }
774 
gx_studio_named_widget_create(char * name,GX_WIDGET * parent,GX_WIDGET ** new_widget)775 UINT gx_studio_named_widget_create(char *name, GX_WIDGET *parent, GX_WIDGET **new_widget)
776 {
777     UINT status = GX_FAILURE;
778     GX_CONST GX_STUDIO_WIDGET_ENTRY *entry = demo_guix_binres_widget_table;
779     GX_WIDGET *widget = GX_NULL;
780 
781     while(entry->widget_information)
782     {
783         if (!strcmp(name, entry->widget_information->widget_name))
784         {
785             widget = gx_studio_widget_create((GX_BYTE *) entry->widget, entry->widget_information, parent);
786             if (widget)
787             {
788                 status = GX_SUCCESS;
789             }
790             break;
791         }
792         entry++;
793     }
794 
795     if (new_widget)
796     {
797         *new_widget = widget;
798     }
799     return status;
800 }
801 
802 
gx_studio_display_configure(USHORT display,UINT (* driver)(GX_DISPLAY *),GX_UBYTE language,USHORT theme,GX_WINDOW_ROOT ** return_root)803 UINT gx_studio_display_configure(USHORT display, UINT (*driver)(GX_DISPLAY *),
804     GX_UBYTE language, USHORT theme, GX_WINDOW_ROOT **return_root)
805 {
806     GX_CONST GX_THEME *theme_ptr;
807     GX_RECTANGLE size;
808 
809     GX_STUDIO_DISPLAY_INFO *display_info = &demo_guix_binres_display_table[display];
810 
811 
812 /* create the requested display                                                */
813 
814     gx_display_create(display_info->display,
815                       display_info->name,
816                       driver,
817                       (GX_VALUE) display_info->x_resolution,
818                       (GX_VALUE) display_info->y_resolution);
819 
820 
821 /* install the request theme                                                   */
822 
823     if(display_info->theme_table)
824     {
825         theme_ptr = display_info->theme_table[theme];
826         if(theme_ptr)
827         {
828             gx_display_color_table_set(display_info->display, theme_ptr->theme_color_table, theme_ptr->theme_color_table_size);
829 
830 /* install the color palette if required                                       */
831             if (display_info->display->gx_display_driver_palette_set &&
832                 theme_ptr->theme_palette != NULL)
833             {
834                 display_info->display->gx_display_driver_palette_set(display_info->display, theme_ptr->theme_palette, theme_ptr->theme_palette_size);
835             }
836 
837             gx_display_font_table_set(display_info->display, theme_ptr->theme_font_table, theme_ptr->theme_font_table_size);
838             gx_display_pixelmap_table_set(display_info->display, theme_ptr->theme_pixelmap_table, theme_ptr->theme_pixelmap_table_size);
839             gx_system_scroll_appearance_set(theme_ptr->theme_vertical_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_vertical_scrollbar_appearance);
840             gx_system_scroll_appearance_set(theme_ptr->theme_horizontal_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_horizontal_scrollbar_appearance);
841         }
842     }
843 
844 /* Install the language table.                                                 */
845 
846     if(display_info->language_table)
847     {
848         gx_display_language_table_set_ext(display_info->display, display_info->language_table, (GX_UBYTE) display_info->language_table_size, display_info->string_table_size);
849         gx_display_active_language_set(display_info->display, language);
850     }
851 
852 /* Set screen rotation angle.                                                  */
853 
854     display_info->display->gx_display_rotation_angle = display_info->rotation_angle;
855 
856 /* create the canvas for this display                                          */
857 
858     gx_canvas_create(display_info->canvas,
859                      display_info->canvas_name,
860                      display_info->display,
861                      GX_CANVAS_MANAGED | GX_CANVAS_VISIBLE,
862                      display_info->x_resolution,
863                      display_info->y_resolution,
864                      display_info->canvas_memory,
865                      display_info->canvas_memory_size);
866 
867 /* Create the root window for this canvas                                      */
868 
869     gx_utility_rectangle_define(&size,
870                                 0, 0,
871                                 (GX_VALUE) (display_info->x_resolution - 1),
872                                 (GX_VALUE) (display_info->y_resolution - 1));
873 
874     gx_window_root_create(display_info->root_window,
875                           display_info->name,
876                           display_info->canvas, GX_STYLE_NONE, 0, &size);
877     if (return_root)
878     {
879         *return_root = display_info->root_window;
880     }
881     return GX_SUCCESS;
882 }
883 #undef GUIX_STUDIO_GENERATED_FILE
884