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.2.0.1                                               */
9 /*  Date (dd.mm.yyyy): 31.10.2022   Time (hh:mm): 14:08                        */
10 /*******************************************************************************/
11 
12 
13 #define GUIX_STUDIO_GENERATED_FILE
14 #include <stddef.h>
15 #include "alphamap_32bpp_resources.h"
16 #include "alphamap_32bpp_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 MAIN_WINDOW_CONTROL_BLOCK main_window;
20 GX_DISPLAY display_1_control_block;
21 GX_WINDOW_ROOT display_1_root_window;
22 GX_CANVAS  display_1_canvas_control_block;
23 ULONG      display_1_canvas_memory[307200];
24 
25 extern GX_CONST GX_THEME *display_1_theme_table[];
26 extern GX_CONST GX_STRING *display_1_language_table[];
27 
28 GX_STUDIO_DISPLAY_INFO alphamap_32bpp_display_table[1] =
29 {
30     {
31     "display_1",
32     "display_1_canvas",
33     display_1_theme_table,
34     display_1_language_table,
35     DISPLAY_1_THEME_TABLE_SIZE,
36     DISPLAY_1_LANGUAGE_TABLE_SIZE,
37     DISPLAY_1_STRING_TABLE_SIZE,
38     640,                                     /* x resolution                   */
39     480,                                     /* y resolution                   */
40     &display_1_control_block,
41     &display_1_canvas_control_block,
42     &display_1_root_window,
43     display_1_canvas_memory,                 /* canvas memory area             */
44     1228800,                                 /* canvas memory size in bytes    */
45     0                                        /* rotation angle                 */
46     }
47 };
48 
49 
gx_studio_radio_button_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)50 UINT gx_studio_radio_button_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
51 {
52     UINT status;
53     GX_RADIO_BUTTON *button = (GX_RADIO_BUTTON *) control_block;
54     GX_TEXT_BUTTON *text_button = (GX_TEXT_BUTTON *) button;
55     GX_RADIO_BUTTON_PROPERTIES *props = (GX_RADIO_BUTTON_PROPERTIES *) info->properties;
56     status = gx_radio_button_create(button, info->widget_name, parent, props->string_id, info->style, info->widget_id, &info->size);
57     if (status == GX_SUCCESS)
58     {
59         gx_text_button_font_set(text_button, props->font_id);
60 #if defined(GUIX_5_4_0_COMPATIBILITY)
61         gx_text_button_text_color_set(text_button, props->normal_text_color_id, props->selected_text_color_id);
62 #else
63         gx_text_button_text_color_set(text_button, props->normal_text_color_id, props->selected_text_color_id, props->disabled_text_color_id);
64 #endif
65 
66         if (props->off_pixelmap_id ||
67             props->on_pixelmap_id ||
68             props->off_disabled_pixelmap_id ||
69             props->on_disabled_pixelmap_id)
70         {
71             gx_radio_button_pixelmap_set(button,
72                                      props->off_pixelmap_id,
73                                      props->on_pixelmap_id,
74                                      props->off_disabled_pixelmap_id,
75                                      props->on_disabled_pixelmap_id);
76         }
77     }
78     return status;
79 }
80 
gx_studio_prompt_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)81 UINT gx_studio_prompt_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
82 {
83     UINT status;
84     GX_PROMPT *prompt = (GX_PROMPT *) control_block;
85     GX_PROMPT_PROPERTIES *props = (GX_PROMPT_PROPERTIES *) info->properties;
86     status = gx_prompt_create(prompt, info->widget_name, parent, props->string_id, info->style, info->widget_id, &info->size);
87     if (status == GX_SUCCESS)
88     {
89         gx_prompt_font_set(prompt, props->font_id);
90 #if defined(GUIX_5_4_0_COMPATIBILITY)
91         gx_prompt_text_color_set(prompt, props->normal_text_color_id, props->selected_text_color_id);
92 #else
93         gx_prompt_text_color_set(prompt, props->normal_text_color_id, props->selected_text_color_id, props->disabled_text_color_id);
94 #endif
95     }
96     return status;
97 }
98 
gx_studio_window_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)99 UINT gx_studio_window_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
100 {
101     UINT status;
102     GX_WINDOW *window = (GX_WINDOW *) control_block;
103     GX_WINDOW_PROPERTIES *props = (GX_WINDOW_PROPERTIES *) info->properties;
104     status = gx_window_create(window, info->widget_name, parent, info->style, info->widget_id, &info->size);
105     if (status == GX_SUCCESS)
106     {
107         if (props->wallpaper_id)
108         {
109             gx_window_wallpaper_set(window, props->wallpaper_id, info->style & GX_STYLE_TILE_WALLPAPER);
110         }
111     }
112     return status;
113 }
114 GX_WINDOW_PROPERTIES main_window_properties =
115 {
116     0                                        /* wallpaper pixelmap id          */
117 };
118 GX_WINDOW_PROPERTIES main_window_window_1_properties =
119 {
120     GX_PIXELMAP_ID_RED_APPLE_RAW             /* wallpaper pixelmap id          */
121 };
122 GX_PROMPT_PROPERTIES main_window_prompt_1_properties =
123 {
124     GX_STRING_ID_STRING_7,                   /* string id                      */
125     GX_FONT_ID_PROMPT,                       /* font id                        */
126     GX_COLOR_ID_TEXT,                        /* normal text color              */
127     GX_COLOR_ID_SELECTED_TEXT,               /* selected text color            */
128     GX_COLOR_ID_TEXT                         /* disabled text color            */
129 };
130 GX_PROMPT_PROPERTIES main_window_prompt_2_properties =
131 {
132     GX_STRING_ID_STRING_4,                   /* string id                      */
133     GX_FONT_ID_PROMPT,                       /* font id                        */
134     GX_COLOR_ID_TEXT,                        /* normal text color              */
135     GX_COLOR_ID_SELECTED_TEXT,               /* selected text color            */
136     GX_COLOR_ID_TEXT                         /* disabled text color            */
137 };
138 GX_WINDOW_PROPERTIES main_window_window_2_properties =
139 {
140     GX_PIXELMAP_ID_FOOT_COMPRESSED           /* wallpaper pixelmap id          */
141 };
142 GX_RADIO_BUTTON_PROPERTIES main_window_radio_button_1_properties =
143 {
144     GX_STRING_ID_STRING_10,                  /* string id                      */
145     GX_FONT_ID_BUTTON,                       /* font id                        */
146     GX_COLOR_ID_BTN_TEXT,                    /* normal text color              */
147     GX_COLOR_ID_BTN_TEXT,                    /* selected text color            */
148     GX_COLOR_ID_BTN_TEXT,                    /* disabled text color            */
149     0,                                       /* off pixelmap id                */
150     0,                                       /* on pixelmap id                 */
151     0,                                       /* off disabled pixelmap id       */
152     0                                        /* on disabled pixelmap id        */
153 };
154 GX_RADIO_BUTTON_PROPERTIES main_window_radio_button_2_properties =
155 {
156     GX_STRING_ID_STRING_11,                  /* string id                      */
157     GX_FONT_ID_BUTTON,                       /* font id                        */
158     GX_COLOR_ID_BTN_TEXT,                    /* normal text color              */
159     GX_COLOR_ID_BTN_TEXT,                    /* selected text color            */
160     GX_COLOR_ID_BTN_TEXT,                    /* disabled text color            */
161     0,                                       /* off pixelmap id                */
162     0,                                       /* on pixelmap id                 */
163     0,                                       /* off disabled pixelmap id       */
164     0                                        /* on disabled pixelmap id        */
165 };
166 GX_RADIO_BUTTON_PROPERTIES main_window_radio_button_4_properties =
167 {
168     GX_STRING_ID_STRING_12,                  /* string id                      */
169     GX_FONT_ID_BUTTON,                       /* font id                        */
170     GX_COLOR_ID_BTN_TEXT,                    /* normal text color              */
171     GX_COLOR_ID_BTN_TEXT,                    /* selected text color            */
172     GX_COLOR_ID_BTN_TEXT,                    /* disabled text color            */
173     0,                                       /* off pixelmap id                */
174     0,                                       /* on pixelmap id                 */
175     0,                                       /* off disabled pixelmap id       */
176     0                                        /* on disabled pixelmap id        */
177 };
178 
179 GX_CONST GX_STUDIO_WIDGET main_window_radio_button_4_define =
180 {
181     "radio_button_4",
182     GX_TYPE_RADIO_BUTTON,                    /* widget type                    */
183     ID_RADIO_BUTTON_GREEN,                   /* widget id                      */
184     #if defined(GX_WIDGET_USER_DATA)
185     0,                                       /* user data                      */
186     #endif
187     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_BUTTON_RADIO|GX_STYLE_TEXT_LEFT,   /* style flags */
188     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
189     sizeof(GX_RADIO_BUTTON),                 /* control block size             */
190     GX_COLOR_ID_BTN_LOWER,                   /* normal color id                */
191     GX_COLOR_ID_BTN_UPPER,                   /* selected color id              */
192     GX_COLOR_ID_BTN_LOWER,                   /* disabled color id              */
193     gx_studio_radio_button_create,           /* create function                */
194     GX_NULL,                                 /* drawing function override      */
195     GX_NULL,                                 /* event function override        */
196     {430, 410, 509, 433},                    /* widget size                    */
197     GX_NULL,                                 /* no next widget                 */
198     GX_NULL,                                 /* no child widgets               */
199     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_radio_button_4), /* control block */
200     (void *) &main_window_radio_button_4_properties /* extended properties     */
201 };
202 
203 GX_CONST GX_STUDIO_WIDGET main_window_radio_button_2_define =
204 {
205     "radio_button_2",
206     GX_TYPE_RADIO_BUTTON,                    /* widget type                    */
207     ID_RADIO_BUTTON_RED,                     /* widget id                      */
208     #if defined(GX_WIDGET_USER_DATA)
209     0,                                       /* user data                      */
210     #endif
211     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_BUTTON_RADIO|GX_STYLE_TEXT_LEFT,   /* style flags */
212     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
213     sizeof(GX_RADIO_BUTTON),                 /* control block size             */
214     GX_COLOR_ID_BTN_LOWER,                   /* normal color id                */
215     GX_COLOR_ID_BTN_UPPER,                   /* selected color id              */
216     GX_COLOR_ID_BTN_LOWER,                   /* disabled color id              */
217     gx_studio_radio_button_create,           /* create function                */
218     GX_NULL,                                 /* drawing function override      */
219     GX_NULL,                                 /* event function override        */
220     {279, 412, 358, 435},                    /* widget size                    */
221     &main_window_radio_button_4_define,      /* next widget definition         */
222     GX_NULL,                                 /* no child widgets               */
223     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_radio_button_2), /* control block */
224     (void *) &main_window_radio_button_2_properties /* extended properties     */
225 };
226 
227 GX_CONST GX_STUDIO_WIDGET main_window_radio_button_1_define =
228 {
229     "radio_button_1",
230     GX_TYPE_RADIO_BUTTON,                    /* widget type                    */
231     ID_RADIO_BUTTON_BLUE,                    /* widget id                      */
232     #if defined(GX_WIDGET_USER_DATA)
233     0,                                       /* user data                      */
234     #endif
235     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_BUTTON_PUSHED|GX_STYLE_BUTTON_RADIO|GX_STYLE_TEXT_LEFT,   /* style flags */
236     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
237     sizeof(GX_RADIO_BUTTON),                 /* control block size             */
238     GX_COLOR_ID_BTN_LOWER,                   /* normal color id                */
239     GX_COLOR_ID_BTN_UPPER,                   /* selected color id              */
240     GX_COLOR_ID_BTN_LOWER,                   /* disabled color id              */
241     gx_studio_radio_button_create,           /* create function                */
242     GX_NULL,                                 /* drawing function override      */
243     GX_NULL,                                 /* event function override        */
244     {128, 412, 207, 435},                    /* widget size                    */
245     &main_window_radio_button_2_define,      /* next widget definition         */
246     GX_NULL,                                 /* no child widgets               */
247     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_radio_button_1), /* control block */
248     (void *) &main_window_radio_button_1_properties /* extended properties     */
249 };
250 
251 GX_CONST GX_STUDIO_WIDGET main_window_window_2_define =
252 {
253     "window_2",
254     GX_TYPE_WINDOW,                          /* widget type                    */
255     GX_ID_NONE,                              /* widget id                      */
256     #if defined(GX_WIDGET_USER_DATA)
257     0,                                       /* user data                      */
258     #endif
259     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT,   /* style flags                */
260     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
261     sizeof(GX_WINDOW),                       /* control block size             */
262     GX_COLOR_ID_SELECTED_FILL,               /* normal color id                */
263     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
264     GX_COLOR_ID_SELECTED_FILL,               /* disabled color id              */
265     gx_studio_window_create,                 /* create function                */
266     (VOID (*)(GX_WIDGET *)) pixelmap_wnd_draw, /* drawing function override    */
267     GX_NULL,                                 /* event function override        */
268     {379, 139, 575, 287},                    /* widget size                    */
269     &main_window_radio_button_1_define,      /* next widget definition         */
270     GX_NULL,                                 /* no child widgets               */
271     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_window_2), /* control block */
272     (void *) &main_window_window_2_properties /* extended properties           */
273 };
274 
275 GX_CONST GX_STUDIO_WIDGET main_window_prompt_2_define =
276 {
277     "prompt_2",
278     GX_TYPE_PROMPT,                          /* widget type                    */
279     GX_ID_NONE,                              /* widget id                      */
280     #if defined(GX_WIDGET_USER_DATA)
281     0,                                       /* user data                      */
282     #endif
283     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_TEXT_CENTER,   /* style flags */
284     0,                                       /* status flags                   */
285     sizeof(GX_PROMPT),                       /* control block size             */
286     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
287     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
288     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
289     gx_studio_prompt_create,                 /* create function                */
290     GX_NULL,                                 /* drawing function override      */
291     GX_NULL,                                 /* event function override        */
292     {406, 40, 519, 63},                      /* widget size                    */
293     &main_window_window_2_define,            /* next widget definition         */
294     GX_NULL,                                 /* no child widgets               */
295     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_prompt_2), /* control block */
296     (void *) &main_window_prompt_2_properties /* extended properties           */
297 };
298 
299 GX_CONST GX_STUDIO_WIDGET main_window_prompt_1_define =
300 {
301     "prompt_1",
302     GX_TYPE_PROMPT,                          /* widget type                    */
303     GX_ID_NONE,                              /* widget id                      */
304     #if defined(GX_WIDGET_USER_DATA)
305     0,                                       /* user data                      */
306     #endif
307     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_TEXT_CENTER,   /* style flags */
308     0,                                       /* status flags                   */
309     sizeof(GX_PROMPT),                       /* control block size             */
310     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
311     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
312     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
313     gx_studio_prompt_create,                 /* create function                */
314     GX_NULL,                                 /* drawing function override      */
315     GX_NULL,                                 /* event function override        */
316     {127, 40, 206, 63},                      /* widget size                    */
317     &main_window_prompt_2_define,            /* next widget definition         */
318     GX_NULL,                                 /* no child widgets               */
319     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_prompt_1), /* control block */
320     (void *) &main_window_prompt_1_properties /* extended properties           */
321 };
322 
323 GX_CONST GX_STUDIO_WIDGET main_window_window_1_define =
324 {
325     "window_1",
326     GX_TYPE_WINDOW,                          /* widget type                    */
327     GX_ID_NONE,                              /* widget id                      */
328     #if defined(GX_WIDGET_USER_DATA)
329     0,                                       /* user data                      */
330     #endif
331     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT,   /* style flags                */
332     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
333     sizeof(GX_WINDOW),                       /* control block size             */
334     GX_COLOR_ID_SCROLL_FILL,                 /* normal color id                */
335     GX_COLOR_ID_SCROLL_FILL,                 /* selected color id              */
336     GX_COLOR_ID_SCROLL_FILL,                 /* disabled color id              */
337     gx_studio_window_create,                 /* create function                */
338     (VOID (*)(GX_WIDGET *)) pixelmap_wnd_draw, /* drawing function override    */
339     GX_NULL,                                 /* event function override        */
340     {83, 79, 279, 350},                      /* widget size                    */
341     &main_window_prompt_1_define,            /* next widget definition         */
342     GX_NULL,                                 /* no child widgets               */
343     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_window_1), /* control block */
344     (void *) &main_window_window_1_properties /* extended properties           */
345 };
346 
347 GX_CONST GX_STUDIO_WIDGET main_window_define =
348 {
349     "main_window",
350     GX_TYPE_WINDOW,                          /* widget type                    */
351     GX_ID_NONE,                              /* widget id                      */
352     #if defined(GX_WIDGET_USER_DATA)
353     0,                                       /* user data                      */
354     #endif
355     GX_STYLE_BORDER_THIN,                    /* style flags                    */
356     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
357     sizeof(MAIN_WINDOW_CONTROL_BLOCK),       /* control block size             */
358     GX_COLOR_ID_BTN_LOWER,                   /* normal color id                */
359     GX_COLOR_ID_BTN_LOWER,                   /* selected color id              */
360     GX_COLOR_ID_BTN_LOWER,                   /* disabled color id              */
361     gx_studio_window_create,                 /* create function                */
362     GX_NULL,                                 /* drawing function override      */
363     (UINT (*)(GX_WIDGET *, GX_EVENT *)) window_event_handler, /* event function override */
364     {0, 0, 638, 478},                        /* widget size                    */
365     GX_NULL,                                 /* next widget                    */
366     &main_window_window_1_define,            /* child widget                   */
367     0,                                       /* control block                  */
368     (void *) &main_window_properties         /* extended properties            */
369 };
370 GX_CONST GX_STUDIO_WIDGET_ENTRY alphamap_32bpp_widget_table[] =
371 {
372     { &main_window_define, (GX_WIDGET *) &main_window },
373     {GX_NULL, GX_NULL}
374 };
375 
gx_studio_nested_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)376 static GX_WIDGET *gx_studio_nested_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
377 {
378     UINT status = GX_SUCCESS;
379     GX_WIDGET *widget = GX_NULL;
380     GX_VALUE   list_count = 0;
381     GX_VALUE   list_total_count = 0;
382 
383     if(parent && (parent->gx_widget_type == GX_TYPE_MENU))
384     {
385         list_total_count = ((GX_MENU *)parent)->gx_menu_list_total_count;
386     }
387 
388     while(definition && status == GX_SUCCESS)
389     {
390         if (definition->create_function)
391         {
392             if (definition->style & GX_STYLE_DYNAMICALLY_ALLOCATED)
393             {
394                 status = gx_widget_allocate(&widget, definition->control_block_size);
395                 if (status != GX_SUCCESS)
396                 {
397                     return GX_NULL;
398                 }
399             }
400             else
401             {
402                 if (control == GX_NULL)
403                 {
404                     return GX_NULL;
405                 }
406                 widget = (GX_WIDGET *) (control + definition->control_block_offset);
407             }
408 
409             status = definition->create_function(definition, widget, parent);
410 
411             if(list_count < list_total_count)
412             {
413                 gx_menu_insert((GX_MENU *)parent, widget);
414                 ((GX_MENU *)parent)->gx_menu_list_total_count--;
415                 list_count++;
416             }
417 
418             if (status == GX_SUCCESS)
419             {
420                 if (definition->widget_type != GX_TYPE_TEMPLATE)
421                 {
422 #if defined(GUIX_5_4_0_COMPATIBILITY)
423                     gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id);
424 #else
425                     gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id, definition->disabled_fill_color_id);
426 #endif
427                 }
428 
429                 if (!(definition->status & GX_STATUS_ACCEPTS_FOCUS))
430                 {
431                     gx_widget_status_remove(widget, GX_STATUS_ACCEPTS_FOCUS);
432                 }
433 
434                 if (definition->draw_function)
435                 {
436                     gx_widget_draw_set(widget, definition->draw_function);
437                 }
438                 if (definition->event_function)
439                 {
440                     gx_widget_event_process_set(widget, definition->event_function);
441                 }
442 
443                 #if defined(GX_WIDGET_USER_DATA)
444                 widget->gx_widget_user_data = definition->user_data;
445                 #endif
446 
447                 if (definition->child_widget)
448                 {
449                     gx_studio_nested_widget_create(control, definition->child_widget, widget);
450                 }
451             }
452             definition = definition->next_widget;
453         }
454     }
455     return widget;
456 }
457 
gx_studio_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)458 GX_WIDGET *gx_studio_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
459 {
460     GX_WIDGET *widget;
461     widget = gx_studio_nested_widget_create(control, definition, GX_NULL);
462 
463     if (parent && widget)
464     {
465         gx_widget_attach(parent, widget);
466     }
467     return widget;
468 }
469 
gx_studio_named_widget_create(char * name,GX_WIDGET * parent,GX_WIDGET ** new_widget)470 UINT gx_studio_named_widget_create(char *name, GX_WIDGET *parent, GX_WIDGET **new_widget)
471 {
472     UINT status = GX_FAILURE;
473     GX_CONST GX_STUDIO_WIDGET_ENTRY *entry = alphamap_32bpp_widget_table;
474     GX_WIDGET *widget = GX_NULL;
475 
476     while(entry->widget_information)
477     {
478         if (!strcmp(name, entry->widget_information->widget_name))
479         {
480             widget = gx_studio_widget_create((GX_BYTE *) entry->widget, entry->widget_information, parent);
481             if (widget)
482             {
483                 status = GX_SUCCESS;
484             }
485             break;
486         }
487         entry++;
488     }
489 
490     if (new_widget)
491     {
492         *new_widget = widget;
493     }
494     return status;
495 }
496 
497 
gx_studio_display_configure(USHORT display,UINT (* driver)(GX_DISPLAY *),GX_UBYTE language,USHORT theme,GX_WINDOW_ROOT ** return_root)498 UINT gx_studio_display_configure(USHORT display, UINT (*driver)(GX_DISPLAY *),
499     GX_UBYTE language, USHORT theme, GX_WINDOW_ROOT **return_root)
500 {
501     GX_CONST GX_THEME *theme_ptr;
502     GX_RECTANGLE size;
503 
504     GX_STUDIO_DISPLAY_INFO *display_info = &alphamap_32bpp_display_table[display];
505 
506 
507 /* create the requested display                                                */
508 
509     gx_display_create(display_info->display,
510                       display_info->name,
511                       driver,
512                       (GX_VALUE) display_info->x_resolution,
513                       (GX_VALUE) display_info->y_resolution);
514 
515 
516 /* install the request theme                                                   */
517 
518     if(display_info->theme_table)
519     {
520         theme_ptr = display_info->theme_table[theme];
521         if(theme_ptr)
522         {
523             gx_display_color_table_set(display_info->display, theme_ptr->theme_color_table, theme_ptr->theme_color_table_size);
524 
525 /* install the color palette if required                                       */
526             if (display_info->display->gx_display_driver_palette_set &&
527                 theme_ptr->theme_palette != NULL)
528             {
529                 display_info->display->gx_display_driver_palette_set(display_info->display, theme_ptr->theme_palette, theme_ptr->theme_palette_size);
530             }
531 
532             gx_display_font_table_set(display_info->display, theme_ptr->theme_font_table, theme_ptr->theme_font_table_size);
533             gx_display_pixelmap_table_set(display_info->display, theme_ptr->theme_pixelmap_table, theme_ptr->theme_pixelmap_table_size);
534             gx_system_scroll_appearance_set(theme_ptr->theme_vertical_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_vertical_scrollbar_appearance);
535             gx_system_scroll_appearance_set(theme_ptr->theme_horizontal_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_horizontal_scrollbar_appearance);
536         }
537     }
538 
539 /* Install the language table.                                                 */
540 
541     if(display_info->language_table)
542     {
543         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);
544         gx_display_active_language_set(display_info->display, language);
545     }
546 
547 /* Set screen rotation angle.                                                  */
548 
549     display_info->display->gx_display_rotation_angle = display_info->rotation_angle;
550 
551 /* create the canvas for this display                                          */
552 
553     gx_canvas_create(display_info->canvas,
554                      display_info->canvas_name,
555                      display_info->display,
556                      GX_CANVAS_MANAGED | GX_CANVAS_VISIBLE,
557                      display_info->x_resolution,
558                      display_info->y_resolution,
559                      display_info->canvas_memory,
560                      display_info->canvas_memory_size);
561 
562 /* Create the root window for this canvas                                      */
563 
564     gx_utility_rectangle_define(&size,
565                                 0, 0,
566                                 (GX_VALUE) (display_info->x_resolution - 1),
567                                 (GX_VALUE) (display_info->y_resolution - 1));
568 
569     gx_window_root_create(display_info->root_window,
570                           display_info->name,
571                           display_info->canvas, GX_STYLE_NONE, 0, &size);
572     if (return_root)
573     {
574         *return_root = display_info->root_window;
575     }
576     return GX_SUCCESS;
577 }
578 #undef GUIX_STUDIO_GENERATED_FILE
579