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:23                        */
10 /*******************************************************************************/
11 
12 
13 #define GUIX_STUDIO_GENERATED_FILE
14 #include <stddef.h>
15 #include "guix_thermostat_resources.h"
16 #include "guix_thermostat_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 THERMOMETER_SCREEN_CONTROL_BLOCK thermometer_screen;
20 GX_DISPLAY main_display_control_block;
21 GX_WINDOW_ROOT main_display_root_window;
22 GX_CANVAS  main_display_canvas_control_block;
23 ULONG      main_display_canvas_memory[153600];
24 
25 extern GX_CONST GX_THEME *main_display_theme_table[];
26 extern GX_CONST GX_STRING *main_display_language_table[];
27 
28 GX_STUDIO_DISPLAY_INFO guix_thermostat_display_table[1] =
29 {
30     {
31     "main_display",
32     "main_display_canvas",
33     main_display_theme_table,
34     main_display_language_table,
35     MAIN_DISPLAY_THEME_TABLE_SIZE,
36     MAIN_DISPLAY_LANGUAGE_TABLE_SIZE,
37     MAIN_DISPLAY_STRING_TABLE_SIZE,
38     640,                                     /* x resolution                   */
39     480,                                     /* y resolution                   */
40     &main_display_control_block,
41     &main_display_canvas_control_block,
42     &main_display_root_window,
43     main_display_canvas_memory,              /* canvas memory area             */
44     614400,                                  /* canvas memory size in bytes    */
45     GX_SCREEN_ROTATION_NONE                  /* rotation angle                 */
46     }
47 };
48 
49 
gx_studio_pixelmap_button_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)50 UINT gx_studio_pixelmap_button_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
51 {
52     UINT status;
53     GX_PIXELMAP_BUTTON *button = (GX_PIXELMAP_BUTTON *) control_block;
54     GX_PIXELMAP_BUTTON_PROPERTIES *props = (GX_PIXELMAP_BUTTON_PROPERTIES *) info->properties;
55     status = gx_pixelmap_button_create(button, info->widget_name, parent,
56                props->normal_pixelmap_id,
57                props->selected_pixelmap_id,
58                props->disabled_pixelmap_id,
59                info->style, info->widget_id, &info->size);
60     return status;
61 }
62 
gx_studio_icon_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)63 UINT gx_studio_icon_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
64 {
65     UINT status;
66     GX_ICON *icon = (GX_ICON *) control_block;
67     GX_ICON_PROPERTIES *props = (GX_ICON_PROPERTIES *) info->properties;
68     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);
69     if (props->selected_pixelmap_id)
70     {
71         gx_icon_pixelmap_set(icon, props->normal_pixelmap_id, props->selected_pixelmap_id);
72     }
73     else
74     {
75         gx_widget_resize((GX_WIDGET *)icon, (GX_RECTANGLE *)&info->size);
76     }
77     return status;
78 }
79 
gx_studio_prompt_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)80 UINT gx_studio_prompt_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
81 {
82     UINT status;
83     GX_PROMPT *prompt = (GX_PROMPT *) control_block;
84     GX_PROMPT_PROPERTIES *props = (GX_PROMPT_PROPERTIES *) info->properties;
85     status = gx_prompt_create(prompt, info->widget_name, parent, props->string_id, info->style, info->widget_id, &info->size);
86     if (status == GX_SUCCESS)
87     {
88         gx_prompt_font_set(prompt, props->font_id);
89 #if defined(GUIX_5_4_0_COMPATIBILITY)
90         gx_prompt_text_color_set(prompt, props->normal_text_color_id, props->selected_text_color_id);
91 #else
92         gx_prompt_text_color_set(prompt, props->normal_text_color_id, props->selected_text_color_id, props->disabled_text_color_id);
93 #endif
94     }
95     return status;
96 }
97 
gx_studio_window_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)98 UINT gx_studio_window_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
99 {
100     UINT status;
101     GX_WINDOW *window = (GX_WINDOW *) control_block;
102     GX_WINDOW_PROPERTIES *props = (GX_WINDOW_PROPERTIES *) info->properties;
103     status = gx_window_create(window, info->widget_name, parent, info->style, info->widget_id, &info->size);
104     if (status == GX_SUCCESS)
105     {
106         if (props->wallpaper_id)
107         {
108             gx_window_wallpaper_set(window, props->wallpaper_id, info->style & GX_STYLE_TILE_WALLPAPER);
109         }
110     }
111     return status;
112 }
113 
gx_studio_circular_gauge_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)114 UINT gx_studio_circular_gauge_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
115 {
116     UINT status;
117     GX_CIRCULAR_GAUGE *gauge = (GX_CIRCULAR_GAUGE *) control_block;
118     GX_CIRCULAR_GAUGE_PROPERTIES *props = (GX_CIRCULAR_GAUGE_PROPERTIES *) info->properties;
119     GX_CIRCULAR_GAUGE_INFO gauge_info;
120     gauge_info.gx_circular_gauge_info_needle_pixelmap = props->needle_pixelmap_id;
121     gauge_info.gx_circular_gauge_info_needle_xpos = props->needle_xpos;
122     gauge_info.gx_circular_gauge_info_needle_ypos = props->needle_ypos;
123     gauge_info.gx_circular_gauge_info_needle_xcor = props->needle_xcor;
124     gauge_info.gx_circular_gauge_info_needle_ycor = props->needle_ycor;
125     gauge_info.gx_circular_gauge_info_animation_steps = props->animation_steps;
126     gauge_info.gx_circular_gauge_info_animation_delay = props->animation_delay;
127     gauge->gx_icon_normal_pixelmap = props->normal_pixelmap_id;
128     gauge->gx_icon_selected_pixelmap = props->selected_pixelmap_id;
129     status = gx_circular_gauge_create(gauge,
130                     info->widget_name,
131                     parent,
132                     &gauge_info,
133                     props->normal_pixelmap_id,
134                     info->style,
135                     info->widget_id,
136                     info->size.gx_rectangle_left,
137                     info->size.gx_rectangle_top);
138     return status;
139 }
140 GX_WINDOW_PROPERTIES thermometer_screen_properties =
141 {
142     0                                        /* wallpaper pixelmap id          */
143 };
144 GX_CIRCULAR_GAUGE_PROPERTIES thermometer_screen_gauge_properties =
145 {
146     0,                                       /* start angle                    */
147     0,                                       /* animation steps                */
148     0,                                       /* animation delay                */
149     111,                                     /* needle xpos                    */
150     113,                                     /* needle yos                     */
151     69,                                      /* needle xcor                    */
152     76,                                      /* needle ycor                    */
153     GX_PIXELMAP_ID_BACKGROUND,               /* normal pixelmap id             */
154     0,                                       /* selected pixelmap id           */
155     GX_PIXELMAP_ID_NEEDLE                    /* needle pixelmap id             */
156 };
157 GX_PROMPT_PROPERTIES thermometer_screen_value_prompt_properties =
158 {
159     GX_STRING_ID_STRING_5,                   /* string id                      */
160     GX_FONT_ID_LARGE_BOLD,                   /* font id                        */
161     GX_COLOR_ID_TEXT_INPUT_TEXT,             /* normal text color              */
162     GX_COLOR_ID_SELECTED_TEXT,               /* selected text color            */
163     GX_COLOR_ID_TEXT_INPUT_TEXT              /* disabled text color            */
164 };
165 GX_PROMPT_PROPERTIES thermometer_screen_prompt_properties =
166 {
167     GX_STRING_ID_STRING_7,                   /* string id                      */
168     GX_FONT_ID_BOLD,                         /* font id                        */
169     GX_COLOR_ID_TEXT_INPUT_FILL,             /* normal text color              */
170     GX_COLOR_ID_SELECTED_TEXT,               /* selected text color            */
171     GX_COLOR_ID_TEXT_INPUT_FILL              /* disabled text color            */
172 };
173 GX_PROMPT_PROPERTIES thermometer_screen_prompt_1_properties =
174 {
175     GX_STRING_ID_STRING_2,                   /* string id                      */
176     GX_FONT_ID_MIDDLE,                       /* font id                        */
177     GX_COLOR_ID_GREEN,                       /* normal text color              */
178     GX_COLOR_ID_SELECTED_TEXT,               /* selected text color            */
179     GX_COLOR_ID_GREEN                        /* disabled text color            */
180 };
181 GX_ICON_PROPERTIES thermometer_screen_icon_1_properties =
182 {
183     GX_PIXELMAP_ID_MS_AZURE_LOGO_SMALL,      /* normal pixelmap id             */
184     0                                        /* selected pixelmap id           */
185 };
186 GX_PIXELMAP_BUTTON_PROPERTIES thermometer_screen_minus_button_properties =
187 {
188     GX_PIXELMAP_ID_BUTTON,                   /* normal pixelmap id             */
189     GX_PIXELMAP_ID_BUTTON_ACTIVE,            /* selected pixelmap id           */
190     0                                        /* disabled pixelmap id           */
191 };
192 GX_PIXELMAP_BUTTON_PROPERTIES thermometer_screen_plus_button_properties =
193 {
194     GX_PIXELMAP_ID_BUTTON,                   /* normal pixelmap id             */
195     GX_PIXELMAP_ID_BUTTON_ACTIVE,            /* selected pixelmap id           */
196     0                                        /* disabled pixelmap id           */
197 };
198 
199 GX_CONST GX_STUDIO_WIDGET thermometer_screen_prompt_define =
200 {
201     "prompt",
202     GX_TYPE_PROMPT,                          /* widget type                    */
203     GX_ID_NONE,                              /* widget id                      */
204     #if defined(GX_WIDGET_USER_DATA)
205     0,                                       /* user data                      */
206     #endif
207     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_TEXT_CENTER,   /* style flags */
208     0,                                       /* status flags                   */
209     sizeof(GX_PROMPT),                       /* control block size             */
210     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
211     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
212     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
213     gx_studio_prompt_create,                 /* create function                */
214     GX_NULL,                                 /* drawing function override      */
215     GX_NULL,                                 /* event function override        */
216     {345, 225, 366, 258},                    /* widget size                    */
217     GX_NULL,                                 /* no next widget                 */
218     GX_NULL,                                 /* no child widgets               */
219     offsetof(THERMOMETER_SCREEN_CONTROL_BLOCK, thermometer_screen_prompt), /* control block */
220     (void *) &thermometer_screen_prompt_properties /* extended properties      */
221 };
222 
223 GX_CONST GX_STUDIO_WIDGET thermometer_screen_value_prompt_define =
224 {
225     "value_prompt",
226     GX_TYPE_PROMPT,                          /* widget type                    */
227     GX_ID_NONE,                              /* widget id                      */
228     #if defined(GX_WIDGET_USER_DATA)
229     0,                                       /* user data                      */
230     #endif
231     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_TEXT_CENTER,   /* style flags */
232     0,                                       /* status flags                   */
233     sizeof(GX_PROMPT),                       /* control block size             */
234     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
235     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
236     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
237     gx_studio_prompt_create,                 /* create function                */
238     GX_NULL,                                 /* drawing function override      */
239     GX_NULL,                                 /* event function override        */
240     {286, 233, 342, 277},                    /* widget size                    */
241     &thermometer_screen_prompt_define,       /* next widget definition         */
242     GX_NULL,                                 /* no child widgets               */
243     offsetof(THERMOMETER_SCREEN_CONTROL_BLOCK, thermometer_screen_value_prompt), /* control block */
244     (void *) &thermometer_screen_value_prompt_properties /* extended properties */
245 };
246 
247 GX_CONST GX_STUDIO_WIDGET thermometer_screen_plus_button_define =
248 {
249     "plus_button",
250     GX_TYPE_PIXELMAP_BUTTON,                 /* widget type                    */
251     ID_PLUS_BTN,                             /* widget id                      */
252     #if defined(GX_WIDGET_USER_DATA)
253     0,                                       /* user data                      */
254     #endif
255     GX_STYLE_BORDER_NONE|GX_STYLE_ENABLED|GX_STYLE_BUTTON_REPEAT,   /* style flags */
256     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
257     sizeof(GX_PIXELMAP_BUTTON),              /* control block size             */
258     GX_COLOR_ID_BTN_UPPER,                   /* normal color id                */
259     GX_COLOR_ID_BTN_UPPER,                   /* selected color id              */
260     GX_COLOR_ID_BTN_UPPER,                   /* disabled color id              */
261     gx_studio_pixelmap_button_create,        /* create function                */
262     (VOID (*)(GX_WIDGET *)) custom_pixelmap_button_draw, /* drawing function override */
263     GX_NULL,                                 /* event function override        */
264     {316, 382, 419, 445},                    /* widget size                    */
265     GX_NULL,                                 /* no next widget                 */
266     GX_NULL,                                 /* no child widgets               */
267     offsetof(THERMOMETER_SCREEN_CONTROL_BLOCK, thermometer_screen_plus_button), /* control block */
268     (void *) &thermometer_screen_plus_button_properties /* extended properties */
269 };
270 
271 GX_CONST GX_STUDIO_WIDGET thermometer_screen_minus_button_define =
272 {
273     "minus_button",
274     GX_TYPE_PIXELMAP_BUTTON,                 /* widget type                    */
275     ID_MINUS_BTN,                            /* widget id                      */
276     #if defined(GX_WIDGET_USER_DATA)
277     0,                                       /* user data                      */
278     #endif
279     GX_STYLE_BORDER_NONE|GX_STYLE_ENABLED|GX_STYLE_BUTTON_REPEAT,   /* style flags */
280     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
281     sizeof(GX_PIXELMAP_BUTTON),              /* control block size             */
282     GX_COLOR_ID_BTN_UPPER,                   /* normal color id                */
283     GX_COLOR_ID_BTN_UPPER,                   /* selected color id              */
284     GX_COLOR_ID_BTN_UPPER,                   /* disabled color id              */
285     gx_studio_pixelmap_button_create,        /* create function                */
286     (VOID (*)(GX_WIDGET *)) custom_pixelmap_button_draw, /* drawing function override */
287     GX_NULL,                                 /* event function override        */
288     {212, 382, 315, 445},                    /* widget size                    */
289     &thermometer_screen_plus_button_define,  /* next widget definition         */
290     GX_NULL,                                 /* no child widgets               */
291     offsetof(THERMOMETER_SCREEN_CONTROL_BLOCK, thermometer_screen_minus_button), /* control block */
292     (void *) &thermometer_screen_minus_button_properties /* extended properties */
293 };
294 
295 GX_CONST GX_STUDIO_WIDGET thermometer_screen_icon_1_define =
296 {
297     "icon_1",
298     GX_TYPE_ICON,                            /* widget type                    */
299     GX_ID_NONE,                              /* widget id                      */
300     #if defined(GX_WIDGET_USER_DATA)
301     0,                                       /* user data                      */
302     #endif
303     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_HALIGN_LEFT|GX_STYLE_VALIGN_TOP,   /* style flags */
304     0,                                       /* status flags                   */
305     sizeof(GX_ICON),                         /* control block size             */
306     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
307     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
308     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
309     gx_studio_icon_create,                   /* create function                */
310     GX_NULL,                                 /* drawing function override      */
311     GX_NULL,                                 /* event function override        */
312     {20, 20, 208, 49},                       /* widget size                    */
313     &thermometer_screen_minus_button_define, /* next widget definition         */
314     GX_NULL,                                 /* no child widgets               */
315     offsetof(THERMOMETER_SCREEN_CONTROL_BLOCK, thermometer_screen_icon_1), /* control block */
316     (void *) &thermometer_screen_icon_1_properties /* extended properties      */
317 };
318 
319 GX_CONST GX_STUDIO_WIDGET thermometer_screen_prompt_1_define =
320 {
321     "prompt_1",
322     GX_TYPE_PROMPT,                          /* widget type                    */
323     GX_ID_NONE,                              /* widget id                      */
324     #if defined(GX_WIDGET_USER_DATA)
325     0,                                       /* user data                      */
326     #endif
327     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_TEXT_CENTER,   /* style flags */
328     0,                                       /* status flags                   */
329     sizeof(GX_PROMPT),                       /* control block size             */
330     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
331     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
332     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
333     gx_studio_prompt_create,                 /* create function                */
334     GX_NULL,                                 /* drawing function override      */
335     GX_NULL,                                 /* event function override        */
336     {149, 89, 511, 117},                     /* widget size                    */
337     &thermometer_screen_icon_1_define,       /* next widget definition         */
338     GX_NULL,                                 /* no child widgets               */
339     offsetof(THERMOMETER_SCREEN_CONTROL_BLOCK, thermometer_screen_prompt_1), /* control block */
340     (void *) &thermometer_screen_prompt_1_properties /* extended properties    */
341 };
342 
343 GX_CONST GX_STUDIO_WIDGET thermometer_screen_gauge_define =
344 {
345     "gauge",
346     GX_TYPE_CIRCULAR_GAUGE,                  /* widget type                    */
347     GX_ID_NONE,                              /* widget id                      */
348     #if defined(GX_WIDGET_USER_DATA)
349     0,                                       /* user data                      */
350     #endif
351     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED,   /* style flags */
352     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
353     sizeof(GX_CIRCULAR_GAUGE),               /* control block size             */
354     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
355     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
356     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
357     gx_studio_circular_gauge_create,         /* create function                */
358     GX_NULL,                                 /* drawing function override      */
359     GX_NULL,                                 /* event function override        */
360     {207, 138, 426, 357},                    /* widget size                    */
361     &thermometer_screen_prompt_1_define,     /* next widget definition         */
362     &thermometer_screen_value_prompt_define, /* child widget definition        */
363     offsetof(THERMOMETER_SCREEN_CONTROL_BLOCK, thermometer_screen_gauge), /* control block */
364     (void *) &thermometer_screen_gauge_properties /* extended properties       */
365 };
366 
367 GX_CONST GX_STUDIO_WIDGET thermometer_screen_define =
368 {
369     "thermometer_screen",
370     GX_TYPE_WINDOW,                          /* widget type                    */
371     GX_ID_NONE,                              /* widget id                      */
372     #if defined(GX_WIDGET_USER_DATA)
373     0,                                       /* user data                      */
374     #endif
375     GX_STYLE_BORDER_NONE,                    /* style flags                    */
376     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
377     sizeof(THERMOMETER_SCREEN_CONTROL_BLOCK), /* control block size            */
378     GX_COLOR_ID_TEXT,                        /* normal color id                */
379     GX_COLOR_ID_TEXT,                        /* selected color id              */
380     GX_COLOR_ID_TEXT,                        /* disabled color id              */
381     gx_studio_window_create,                 /* create function                */
382     GX_NULL,                                 /* drawing function override      */
383     (UINT (*)(GX_WIDGET *, GX_EVENT *)) thermo_screen_event_handler, /* event function override */
384     {0, 0, 639, 479},                        /* widget size                    */
385     GX_NULL,                                 /* next widget                    */
386     &thermometer_screen_gauge_define,        /* child widget                   */
387     0,                                       /* control block                  */
388     (void *) &thermometer_screen_properties  /* extended properties            */
389 };
390 GX_CONST GX_STUDIO_WIDGET_ENTRY guix_thermostat_widget_table[] =
391 {
392     { &thermometer_screen_define, (GX_WIDGET *) &thermometer_screen },
393     {GX_NULL, GX_NULL}
394 };
395 
gx_studio_nested_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)396 static GX_WIDGET *gx_studio_nested_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
397 {
398     UINT status = GX_SUCCESS;
399     GX_WIDGET *widget = GX_NULL;
400     GX_VALUE   list_count = 0;
401     GX_VALUE   list_total_count = 0;
402 
403     if(parent && (parent->gx_widget_type == GX_TYPE_MENU))
404     {
405         list_total_count = ((GX_MENU *)parent)->gx_menu_list_total_count;
406     }
407 
408     while(definition && status == GX_SUCCESS)
409     {
410         if (definition->create_function)
411         {
412             if (definition->style & GX_STYLE_DYNAMICALLY_ALLOCATED)
413             {
414                 status = gx_widget_allocate(&widget, definition->control_block_size);
415                 if (status != GX_SUCCESS)
416                 {
417                     return GX_NULL;
418                 }
419             }
420             else
421             {
422                 if (control == GX_NULL)
423                 {
424                     return GX_NULL;
425                 }
426                 widget = (GX_WIDGET *) (control + definition->control_block_offset);
427             }
428 
429             status = definition->create_function(definition, widget, parent);
430 
431             if(list_count < list_total_count)
432             {
433                 gx_menu_insert((GX_MENU *)parent, widget);
434                 ((GX_MENU *)parent)->gx_menu_list_total_count--;
435                 list_count++;
436             }
437 
438             if (status == GX_SUCCESS)
439             {
440                 if (definition->widget_type != GX_TYPE_TEMPLATE)
441                 {
442 #if defined(GUIX_5_4_0_COMPATIBILITY)
443                     gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id);
444 #else
445                     gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id, definition->disabled_fill_color_id);
446 #endif
447                 }
448 
449                 if (!(definition->status & GX_STATUS_ACCEPTS_FOCUS))
450                 {
451                     gx_widget_status_remove(widget, GX_STATUS_ACCEPTS_FOCUS);
452                 }
453 
454                 if (definition->draw_function)
455                 {
456                     gx_widget_draw_set(widget, definition->draw_function);
457                 }
458                 if (definition->event_function)
459                 {
460                     gx_widget_event_process_set(widget, definition->event_function);
461                 }
462 
463                 #if defined(GX_WIDGET_USER_DATA)
464                 widget->gx_widget_user_data = definition->user_data;
465                 #endif
466 
467                 if (definition->child_widget)
468                 {
469                     gx_studio_nested_widget_create(control, definition->child_widget, widget);
470                 }
471             }
472             definition = definition->next_widget;
473         }
474     }
475     return widget;
476 }
477 
gx_studio_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)478 GX_WIDGET *gx_studio_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
479 {
480     GX_WIDGET *widget;
481     widget = gx_studio_nested_widget_create(control, definition, GX_NULL);
482 
483     if (parent && widget)
484     {
485         gx_widget_attach(parent, widget);
486     }
487     return widget;
488 }
489 
gx_studio_named_widget_create(char * name,GX_WIDGET * parent,GX_WIDGET ** new_widget)490 UINT gx_studio_named_widget_create(char *name, GX_WIDGET *parent, GX_WIDGET **new_widget)
491 {
492     UINT status = GX_FAILURE;
493     GX_CONST GX_STUDIO_WIDGET_ENTRY *entry = guix_thermostat_widget_table;
494     GX_WIDGET *widget = GX_NULL;
495 
496     while(entry->widget_information)
497     {
498         if (!strcmp(name, entry->widget_information->widget_name))
499         {
500             widget = gx_studio_widget_create((GX_BYTE *) entry->widget, entry->widget_information, parent);
501             if (widget)
502             {
503                 status = GX_SUCCESS;
504             }
505             break;
506         }
507         entry++;
508     }
509 
510     if (new_widget)
511     {
512         *new_widget = widget;
513     }
514     return status;
515 }
516 
517 
gx_studio_display_configure(USHORT display,UINT (* driver)(GX_DISPLAY *),GX_UBYTE language,USHORT theme,GX_WINDOW_ROOT ** return_root)518 UINT gx_studio_display_configure(USHORT display, UINT (*driver)(GX_DISPLAY *),
519     GX_UBYTE language, USHORT theme, GX_WINDOW_ROOT **return_root)
520 {
521     GX_CONST GX_THEME *theme_ptr;
522     GX_RECTANGLE size;
523 
524     GX_STUDIO_DISPLAY_INFO *display_info = &guix_thermostat_display_table[display];
525 
526 
527 /* create the requested display                                                */
528 
529     gx_display_create(display_info->display,
530                       display_info->name,
531                       driver,
532                       (GX_VALUE) display_info->x_resolution,
533                       (GX_VALUE) display_info->y_resolution);
534 
535 
536 /* install the request theme                                                   */
537 
538     if(display_info->theme_table)
539     {
540         theme_ptr = display_info->theme_table[theme];
541         if(theme_ptr)
542         {
543             gx_display_color_table_set(display_info->display, theme_ptr->theme_color_table, theme_ptr->theme_color_table_size);
544 
545 /* install the color palette if required                                       */
546             if (display_info->display->gx_display_driver_palette_set &&
547                 theme_ptr->theme_palette != NULL)
548             {
549                 display_info->display->gx_display_driver_palette_set(display_info->display, theme_ptr->theme_palette, theme_ptr->theme_palette_size);
550             }
551 
552             gx_display_font_table_set(display_info->display, theme_ptr->theme_font_table, theme_ptr->theme_font_table_size);
553             gx_display_pixelmap_table_set(display_info->display, theme_ptr->theme_pixelmap_table, theme_ptr->theme_pixelmap_table_size);
554             gx_system_scroll_appearance_set(theme_ptr->theme_vertical_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_vertical_scrollbar_appearance);
555             gx_system_scroll_appearance_set(theme_ptr->theme_horizontal_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_horizontal_scrollbar_appearance);
556         }
557     }
558 
559 /* Install the language table.                                                 */
560 
561     if(display_info->language_table)
562     {
563         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);
564         gx_display_active_language_set(display_info->display, language);
565     }
566 
567 /* Set screen rotation angle.                                                  */
568 
569     display_info->display->gx_display_rotation_angle = display_info->rotation_angle;
570 
571 /* create the canvas for this display                                          */
572 
573     gx_canvas_create(display_info->canvas,
574                      display_info->canvas_name,
575                      display_info->display,
576                      GX_CANVAS_MANAGED | GX_CANVAS_VISIBLE,
577                      display_info->x_resolution,
578                      display_info->y_resolution,
579                      display_info->canvas_memory,
580                      display_info->canvas_memory_size);
581 
582 /* Create the root window for this canvas                                      */
583 
584     gx_utility_rectangle_define(&size,
585                                 0, 0,
586                                 (GX_VALUE) (display_info->x_resolution - 1),
587                                 (GX_VALUE) (display_info->y_resolution - 1));
588 
589     gx_window_root_create(display_info->root_window,
590                           display_info->name,
591                           display_info->canvas, GX_STYLE_NONE, 0, &size);
592     if (return_root)
593     {
594         *return_root = display_info->root_window;
595     }
596     return GX_SUCCESS;
597 }
598 #undef GUIX_STUDIO_GENERATED_FILE
599