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:09                        */
10 /*******************************************************************************/
11 
12 
13 #define GUIX_STUDIO_GENERATED_FILE
14 #include <stddef.h>
15 #include "glyph_draw_resources.h"
16 #include "glyph_draw_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_SCREEN_CONTROL_BLOCK main_screen;
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[153600];
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 glyph_draw_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     614400,                                  /* canvas memory size in bytes    */
45     0                                        /* rotation angle                 */
46     }
47 };
48 
49 
gx_studio_prompt_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)50 UINT gx_studio_prompt_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
51 {
52     UINT status;
53     GX_PROMPT *prompt = (GX_PROMPT *) control_block;
54     GX_PROMPT_PROPERTIES *props = (GX_PROMPT_PROPERTIES *) info->properties;
55     status = gx_prompt_create(prompt, info->widget_name, parent, props->string_id, info->style, info->widget_id, &info->size);
56     if (status == GX_SUCCESS)
57     {
58         gx_prompt_font_set(prompt, props->font_id);
59 #if defined(GUIX_5_4_0_COMPATIBILITY)
60         gx_prompt_text_color_set(prompt, props->normal_text_color_id, props->selected_text_color_id);
61 #else
62         gx_prompt_text_color_set(prompt, props->normal_text_color_id, props->selected_text_color_id, props->disabled_text_color_id);
63 #endif
64     }
65     return status;
66 }
67 
gx_studio_window_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)68 UINT gx_studio_window_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
69 {
70     UINT status;
71     GX_WINDOW *window = (GX_WINDOW *) control_block;
72     GX_WINDOW_PROPERTIES *props = (GX_WINDOW_PROPERTIES *) info->properties;
73     status = gx_window_create(window, info->widget_name, parent, info->style, info->widget_id, &info->size);
74     if (status == GX_SUCCESS)
75     {
76         if (props->wallpaper_id)
77         {
78             gx_window_wallpaper_set(window, props->wallpaper_id, info->style & GX_STYLE_TILE_WALLPAPER);
79         }
80     }
81     return status;
82 }
83 GX_WINDOW_PROPERTIES main_screen_properties =
84 {
85     0                                        /* wallpaper pixelmap id          */
86 };
87 GX_PROMPT_PROPERTIES main_screen_prompt_properties =
88 {
89     GX_STRING_ID_TEST_STRING_1,              /* string id                      */
90     GX_FONT_ID_NOTOSANSHANS,                 /* font id                        */
91     GX_COLOR_ID_TEXT,                        /* normal text color              */
92     GX_COLOR_ID_TEXT,                        /* selected text color            */
93     GX_COLOR_ID_TEXT                         /* disabled text color            */
94 };
95 GX_PROMPT_PROPERTIES main_screen_prompt_1_properties =
96 {
97     GX_STRING_ID_TEST_STRING_2,              /* string id                      */
98     GX_FONT_ID_NOTOSANSHANS,                 /* font id                        */
99     GX_COLOR_ID_TEXT,                        /* normal text color              */
100     GX_COLOR_ID_TEXT,                        /* selected text color            */
101     GX_COLOR_ID_TEXT                         /* disabled text color            */
102 };
103 GX_PROMPT_PROPERTIES main_screen_prompt_2_properties =
104 {
105     GX_STRING_ID_TEST_STRING_3,              /* string id                      */
106     GX_FONT_ID_NOTOSANSHANS,                 /* font id                        */
107     GX_COLOR_ID_TEXT,                        /* normal text color              */
108     GX_COLOR_ID_TEXT,                        /* selected text color            */
109     GX_COLOR_ID_TEXT                         /* disabled text color            */
110 };
111 GX_PROMPT_PROPERTIES main_screen_prompt_3_properties =
112 {
113     GX_STRING_ID_TEST_STRING_ARABIC,         /* string id                      */
114     GX_FONT_ID_ARABIC,                       /* font id                        */
115     GX_COLOR_ID_TEXT,                        /* normal text color              */
116     GX_COLOR_ID_TEXT,                        /* selected text color            */
117     GX_COLOR_ID_TEXT                         /* disabled text color            */
118 };
119 GX_PROMPT_PROPERTIES main_screen_prompt_4_properties =
120 {
121     GX_STRING_ID_TEST_STRING_THAI,           /* string id                      */
122     GX_FONT_ID_TAHI,                         /* font id                        */
123     GX_COLOR_ID_TEXT,                        /* normal text color              */
124     GX_COLOR_ID_TEXT,                        /* selected text color            */
125     GX_COLOR_ID_TEXT                         /* disabled text color            */
126 };
127 
128 GX_CONST GX_STUDIO_WIDGET main_screen_prompt_4_define =
129 {
130     "prompt_4",
131     GX_TYPE_PROMPT,                          /* widget type                    */
132     GX_ID_NONE,                              /* widget id                      */
133     #if defined(GX_WIDGET_USER_DATA)
134     0,                                       /* user data                      */
135     #endif
136     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_TEXT_LEFT,   /* style flags */
137     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
138     sizeof(GX_PROMPT),                       /* control block size             */
139     GX_COLOR_ID_SELECTED_FILL,               /* normal color id                */
140     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
141     GX_COLOR_ID_DISABLED_FILL,               /* disabled color id              */
142     gx_studio_prompt_create,                 /* create function                */
143     GX_NULL,                                 /* drawing function override      */
144     GX_NULL,                                 /* event function override        */
145     {88, 364, 187, 389},                     /* widget size                    */
146     GX_NULL,                                 /* no next widget                 */
147     GX_NULL,                                 /* no child widgets               */
148     offsetof(MAIN_SCREEN_CONTROL_BLOCK, main_screen_prompt_4), /* control block */
149     (void *) &main_screen_prompt_4_properties /* extended properties           */
150 };
151 
152 GX_CONST GX_STUDIO_WIDGET main_screen_prompt_3_define =
153 {
154     "prompt_3",
155     GX_TYPE_PROMPT,                          /* widget type                    */
156     GX_ID_NONE,                              /* widget id                      */
157     #if defined(GX_WIDGET_USER_DATA)
158     0,                                       /* user data                      */
159     #endif
160     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_TEXT_LEFT,   /* style flags */
161     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
162     sizeof(GX_PROMPT),                       /* control block size             */
163     GX_COLOR_ID_SELECTED_FILL,               /* normal color id                */
164     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
165     GX_COLOR_ID_DISABLED_FILL,               /* disabled color id              */
166     gx_studio_prompt_create,                 /* create function                */
167     GX_NULL,                                 /* drawing function override      */
168     GX_NULL,                                 /* event function override        */
169     {82, 310, 537, 339},                     /* widget size                    */
170     &main_screen_prompt_4_define,            /* next widget definition         */
171     GX_NULL,                                 /* no child widgets               */
172     offsetof(MAIN_SCREEN_CONTROL_BLOCK, main_screen_prompt_3), /* control block */
173     (void *) &main_screen_prompt_3_properties /* extended properties           */
174 };
175 
176 GX_CONST GX_STUDIO_WIDGET main_screen_prompt_2_define =
177 {
178     "prompt_2",
179     GX_TYPE_PROMPT,                          /* widget type                    */
180     GX_ID_NONE,                              /* widget id                      */
181     #if defined(GX_WIDGET_USER_DATA)
182     0,                                       /* user data                      */
183     #endif
184     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_TEXT_LEFT,   /* style flags */
185     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
186     sizeof(GX_PROMPT),                       /* control block size             */
187     GX_COLOR_ID_SELECTED_FILL,               /* normal color id                */
188     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
189     GX_COLOR_ID_DISABLED_FILL,               /* disabled color id              */
190     gx_studio_prompt_create,                 /* create function                */
191     GX_NULL,                                 /* drawing function override      */
192     GX_NULL,                                 /* event function override        */
193     {83, 255, 508, 278},                     /* widget size                    */
194     &main_screen_prompt_3_define,            /* next widget definition         */
195     GX_NULL,                                 /* no child widgets               */
196     offsetof(MAIN_SCREEN_CONTROL_BLOCK, main_screen_prompt_2), /* control block */
197     (void *) &main_screen_prompt_2_properties /* extended properties           */
198 };
199 
200 GX_CONST GX_STUDIO_WIDGET main_screen_prompt_1_define =
201 {
202     "prompt_1",
203     GX_TYPE_PROMPT,                          /* widget type                    */
204     GX_ID_NONE,                              /* widget id                      */
205     #if defined(GX_WIDGET_USER_DATA)
206     0,                                       /* user data                      */
207     #endif
208     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_TEXT_LEFT,   /* style flags */
209     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
210     sizeof(GX_PROMPT),                       /* control block size             */
211     GX_COLOR_ID_TEXT_INPUT_FILL,             /* normal color id                */
212     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
213     GX_COLOR_ID_DISABLED_FILL,               /* disabled color id              */
214     gx_studio_prompt_create,                 /* create function                */
215     GX_NULL,                                 /* drawing function override      */
216     GX_NULL,                                 /* event function override        */
217     {79, 136, 158, 157},                     /* widget size                    */
218     &main_screen_prompt_2_define,            /* next widget definition         */
219     GX_NULL,                                 /* no child widgets               */
220     offsetof(MAIN_SCREEN_CONTROL_BLOCK, main_screen_prompt_1), /* control block */
221     (void *) &main_screen_prompt_1_properties /* extended properties           */
222 };
223 
224 GX_CONST GX_STUDIO_WIDGET main_screen_prompt_define =
225 {
226     "prompt",
227     GX_TYPE_PROMPT,                          /* widget type                    */
228     GX_ID_NONE,                              /* widget id                      */
229     #if defined(GX_WIDGET_USER_DATA)
230     0,                                       /* user data                      */
231     #endif
232     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_TEXT_LEFT,   /* style flags */
233     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
234     sizeof(GX_PROMPT),                       /* control block size             */
235     GX_COLOR_ID_SELECTED_FILL,               /* normal color id                */
236     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
237     GX_COLOR_ID_DISABLED_FILL,               /* disabled color id              */
238     gx_studio_prompt_create,                 /* create function                */
239     GX_NULL,                                 /* drawing function override      */
240     GX_NULL,                                 /* event function override        */
241     {82, 40, 621, 61},                       /* widget size                    */
242     &main_screen_prompt_1_define,            /* next widget definition         */
243     GX_NULL,                                 /* no child widgets               */
244     offsetof(MAIN_SCREEN_CONTROL_BLOCK, main_screen_prompt), /* control block  */
245     (void *) &main_screen_prompt_properties  /* extended properties            */
246 };
247 
248 GX_CONST GX_STUDIO_WIDGET main_screen_define =
249 {
250     "main_screen",
251     GX_TYPE_WINDOW,                          /* widget type                    */
252     GX_ID_NONE,                              /* widget id                      */
253     #if defined(GX_WIDGET_USER_DATA)
254     0,                                       /* user data                      */
255     #endif
256     GX_STYLE_BORDER_THIN|GX_STYLE_ENABLED,   /* style flags                    */
257     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
258     sizeof(MAIN_SCREEN_CONTROL_BLOCK),       /* control block size             */
259     GX_COLOR_ID_WINDOW_FILL,                 /* normal color id                */
260     GX_COLOR_ID_WINDOW_FILL,                 /* selected color id              */
261     GX_COLOR_ID_DISABLED_FILL,               /* disabled color id              */
262     gx_studio_window_create,                 /* create function                */
263     GX_NULL,                                 /* drawing function override      */
264     GX_NULL,                                 /* event function override        */
265     {0, 0, 639, 479},                        /* widget size                    */
266     GX_NULL,                                 /* next widget                    */
267     &main_screen_prompt_define,              /* child widget                   */
268     0,                                       /* control block                  */
269     (void *) &main_screen_properties         /* extended properties            */
270 };
271 GX_CONST GX_STUDIO_WIDGET_ENTRY glyph_draw_widget_table[] =
272 {
273     { &main_screen_define, (GX_WIDGET *) &main_screen },
274     {GX_NULL, GX_NULL}
275 };
276 
gx_studio_nested_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)277 static GX_WIDGET *gx_studio_nested_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
278 {
279     UINT status = GX_SUCCESS;
280     GX_WIDGET *widget = GX_NULL;
281     GX_VALUE   list_count = 0;
282     GX_VALUE   list_total_count = 0;
283 
284     if(parent && (parent->gx_widget_type == GX_TYPE_MENU))
285     {
286         list_total_count = ((GX_MENU *)parent)->gx_menu_list_total_count;
287     }
288 
289     while(definition && status == GX_SUCCESS)
290     {
291         if (definition->create_function)
292         {
293             if (definition->style & GX_STYLE_DYNAMICALLY_ALLOCATED)
294             {
295                 status = gx_widget_allocate(&widget, definition->control_block_size);
296                 if (status != GX_SUCCESS)
297                 {
298                     return GX_NULL;
299                 }
300             }
301             else
302             {
303                 if (control == GX_NULL)
304                 {
305                     return GX_NULL;
306                 }
307                 widget = (GX_WIDGET *) (control + definition->control_block_offset);
308             }
309 
310             status = definition->create_function(definition, widget, parent);
311 
312             if(list_count < list_total_count)
313             {
314                 gx_menu_insert((GX_MENU *)parent, widget);
315                 ((GX_MENU *)parent)->gx_menu_list_total_count--;
316                 list_count++;
317             }
318 
319             if (status == GX_SUCCESS)
320             {
321                 if (definition->widget_type != GX_TYPE_TEMPLATE)
322                 {
323 #if defined(GUIX_5_4_0_COMPATIBILITY)
324                     gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id);
325 #else
326                     gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id, definition->disabled_fill_color_id);
327 #endif
328                 }
329 
330                 if (!(definition->status & GX_STATUS_ACCEPTS_FOCUS))
331                 {
332                     gx_widget_status_remove(widget, GX_STATUS_ACCEPTS_FOCUS);
333                 }
334 
335                 if (definition->draw_function)
336                 {
337                     gx_widget_draw_set(widget, definition->draw_function);
338                 }
339                 if (definition->event_function)
340                 {
341                     gx_widget_event_process_set(widget, definition->event_function);
342                 }
343 
344                 #if defined(GX_WIDGET_USER_DATA)
345                 widget->gx_widget_user_data = definition->user_data;
346                 #endif
347 
348                 if (definition->child_widget)
349                 {
350                     gx_studio_nested_widget_create(control, definition->child_widget, widget);
351                 }
352             }
353             definition = definition->next_widget;
354         }
355     }
356     return widget;
357 }
358 
gx_studio_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)359 GX_WIDGET *gx_studio_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
360 {
361     GX_WIDGET *widget;
362     widget = gx_studio_nested_widget_create(control, definition, GX_NULL);
363 
364     if (parent && widget)
365     {
366         gx_widget_attach(parent, widget);
367     }
368     return widget;
369 }
370 
gx_studio_named_widget_create(char * name,GX_WIDGET * parent,GX_WIDGET ** new_widget)371 UINT gx_studio_named_widget_create(char *name, GX_WIDGET *parent, GX_WIDGET **new_widget)
372 {
373     UINT status = GX_FAILURE;
374     GX_CONST GX_STUDIO_WIDGET_ENTRY *entry = glyph_draw_widget_table;
375     GX_WIDGET *widget = GX_NULL;
376 
377     while(entry->widget_information)
378     {
379         if (!strcmp(name, entry->widget_information->widget_name))
380         {
381             widget = gx_studio_widget_create((GX_BYTE *) entry->widget, entry->widget_information, parent);
382             if (widget)
383             {
384                 status = GX_SUCCESS;
385             }
386             break;
387         }
388         entry++;
389     }
390 
391     if (new_widget)
392     {
393         *new_widget = widget;
394     }
395     return status;
396 }
397 
398 
gx_studio_display_configure(USHORT display,UINT (* driver)(GX_DISPLAY *),GX_UBYTE language,USHORT theme,GX_WINDOW_ROOT ** return_root)399 UINT gx_studio_display_configure(USHORT display, UINT (*driver)(GX_DISPLAY *),
400     GX_UBYTE language, USHORT theme, GX_WINDOW_ROOT **return_root)
401 {
402     GX_CONST GX_THEME *theme_ptr;
403     GX_RECTANGLE size;
404 
405     GX_STUDIO_DISPLAY_INFO *display_info = &glyph_draw_display_table[display];
406 
407 
408 /* create the requested display                                                */
409 
410     gx_display_create(display_info->display,
411                       display_info->name,
412                       driver,
413                       (GX_VALUE) display_info->x_resolution,
414                       (GX_VALUE) display_info->y_resolution);
415 
416 
417 /* install the request theme                                                   */
418 
419     if(display_info->theme_table)
420     {
421         theme_ptr = display_info->theme_table[theme];
422         if(theme_ptr)
423         {
424             gx_display_color_table_set(display_info->display, theme_ptr->theme_color_table, theme_ptr->theme_color_table_size);
425 
426 /* install the color palette if required                                       */
427             if (display_info->display->gx_display_driver_palette_set &&
428                 theme_ptr->theme_palette != NULL)
429             {
430                 display_info->display->gx_display_driver_palette_set(display_info->display, theme_ptr->theme_palette, theme_ptr->theme_palette_size);
431             }
432 
433             gx_display_font_table_set(display_info->display, theme_ptr->theme_font_table, theme_ptr->theme_font_table_size);
434             gx_display_pixelmap_table_set(display_info->display, theme_ptr->theme_pixelmap_table, theme_ptr->theme_pixelmap_table_size);
435             gx_system_scroll_appearance_set(theme_ptr->theme_vertical_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_vertical_scrollbar_appearance);
436             gx_system_scroll_appearance_set(theme_ptr->theme_horizontal_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_horizontal_scrollbar_appearance);
437         }
438     }
439 
440 /* Install the language table.                                                 */
441 
442     if(display_info->language_table)
443     {
444         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);
445         gx_display_active_language_set(display_info->display, language);
446     }
447 
448 /* Set screen rotation angle.                                                  */
449 
450     display_info->display->gx_display_rotation_angle = display_info->rotation_angle;
451 
452 /* create the canvas for this display                                          */
453 
454     gx_canvas_create(display_info->canvas,
455                      display_info->canvas_name,
456                      display_info->display,
457                      GX_CANVAS_MANAGED | GX_CANVAS_VISIBLE,
458                      display_info->x_resolution,
459                      display_info->y_resolution,
460                      display_info->canvas_memory,
461                      display_info->canvas_memory_size);
462 
463 /* Create the root window for this canvas                                      */
464 
465     gx_utility_rectangle_define(&size,
466                                 0, 0,
467                                 (GX_VALUE) (display_info->x_resolution - 1),
468                                 (GX_VALUE) (display_info->y_resolution - 1));
469 
470     gx_window_root_create(display_info->root_window,
471                           display_info->name,
472                           display_info->canvas, GX_STYLE_NONE, 0, &size);
473     if (return_root)
474     {
475         *return_root = display_info->root_window;
476     }
477     return GX_SUCCESS;
478 }
479 #undef GUIX_STUDIO_GENERATED_FILE
480