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 "extended_unicode_resources.h"
16 #include "extended_unicode_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 SCREEN_BASE_CONTROL_BLOCK screen_base;
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[307200];
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 extended_unicode_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 1228800, /* 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 screen_base_properties =
84 {
85 0 /* wallpaper pixelmap id */
86 };
87 GX_PROMPT_PROPERTIES screen_base_prompt_1_properties =
88 {
89 GX_STRING_ID_EXTENDED_UNICODES, /* string id */
90 GX_FONT_ID_OLD_ITALIC_8BPP, /* font id */
91 GX_COLOR_ID_TEXT, /* normal text color */
92 GX_COLOR_ID_SELECTED_TEXT, /* selected text color */
93 GX_COLOR_ID_TEXT /* disabled text color */
94 };
95 GX_PROMPT_PROPERTIES screen_base_prompt_properties =
96 {
97 GX_STRING_ID_EXTENDED_UNICODES, /* string id */
98 GX_FONT_ID_OLD_ITALIC_1BPP, /* font id */
99 GX_COLOR_ID_TEXT, /* normal text color */
100 GX_COLOR_ID_SELECTED_TEXT, /* selected text color */
101 GX_COLOR_ID_TEXT /* disabled text color */
102 };
103 GX_PROMPT_PROPERTIES screen_base_prompt_2_properties =
104 {
105 GX_STRING_ID_EXTENDED_UNICODES, /* string id */
106 GX_FONT_ID_OLD_ITALIC_4BPP, /* font id */
107 GX_COLOR_ID_TEXT, /* normal text color */
108 GX_COLOR_ID_SELECTED_TEXT, /* selected text color */
109 GX_COLOR_ID_TEXT /* disabled text color */
110 };
111
112 GX_CONST GX_STUDIO_WIDGET screen_base_prompt_2_define =
113 {
114 "prompt_2",
115 GX_TYPE_PROMPT, /* widget type */
116 GX_ID_NONE, /* widget id */
117 #if defined(GX_WIDGET_USER_DATA)
118 0, /* user data */
119 #endif
120 GX_STYLE_BORDER_THIN|GX_STYLE_TEXT_CENTER, /* style flags */
121 0, /* status flags */
122 sizeof(GX_PROMPT), /* control block size */
123 GX_COLOR_ID_WIDGET_FILL, /* normal color id */
124 GX_COLOR_ID_SELECTED_FILL, /* selected color id */
125 GX_COLOR_ID_WIDGET_FILL, /* disabled color id */
126 gx_studio_prompt_create, /* create function */
127 GX_NULL, /* drawing function override */
128 GX_NULL, /* event function override */
129 {22, 247, 631, 321}, /* widget size */
130 GX_NULL, /* no next widget */
131 GX_NULL, /* no child widgets */
132 offsetof(SCREEN_BASE_CONTROL_BLOCK, screen_base_prompt_2), /* control block */
133 (void *) &screen_base_prompt_2_properties /* extended properties */
134 };
135
136 GX_CONST GX_STUDIO_WIDGET screen_base_prompt_define =
137 {
138 "prompt",
139 GX_TYPE_PROMPT, /* widget type */
140 GX_ID_NONE, /* widget id */
141 #if defined(GX_WIDGET_USER_DATA)
142 0, /* user data */
143 #endif
144 GX_STYLE_BORDER_THIN|GX_STYLE_TEXT_CENTER, /* style flags */
145 0, /* status flags */
146 sizeof(GX_PROMPT), /* control block size */
147 GX_COLOR_ID_WIDGET_FILL, /* normal color id */
148 GX_COLOR_ID_SELECTED_FILL, /* selected color id */
149 GX_COLOR_ID_WIDGET_FILL, /* disabled color id */
150 gx_studio_prompt_create, /* create function */
151 GX_NULL, /* drawing function override */
152 GX_NULL, /* event function override */
153 {20, 123, 629, 197}, /* widget size */
154 &screen_base_prompt_2_define, /* next widget definition */
155 GX_NULL, /* no child widgets */
156 offsetof(SCREEN_BASE_CONTROL_BLOCK, screen_base_prompt), /* control block */
157 (void *) &screen_base_prompt_properties /* extended properties */
158 };
159
160 GX_CONST GX_STUDIO_WIDGET screen_base_prompt_1_define =
161 {
162 "prompt_1",
163 GX_TYPE_PROMPT, /* widget type */
164 GX_ID_NONE, /* widget id */
165 #if defined(GX_WIDGET_USER_DATA)
166 0, /* user data */
167 #endif
168 GX_STYLE_BORDER_THIN|GX_STYLE_TEXT_CENTER, /* style flags */
169 0, /* status flags */
170 sizeof(GX_PROMPT), /* control block size */
171 GX_COLOR_ID_WIDGET_FILL, /* normal color id */
172 GX_COLOR_ID_SELECTED_FILL, /* selected color id */
173 GX_COLOR_ID_WIDGET_FILL, /* disabled color id */
174 gx_studio_prompt_create, /* create function */
175 GX_NULL, /* drawing function override */
176 GX_NULL, /* event function override */
177 {19, 14, 628, 88}, /* widget size */
178 &screen_base_prompt_define, /* next widget definition */
179 GX_NULL, /* no child widgets */
180 offsetof(SCREEN_BASE_CONTROL_BLOCK, screen_base_prompt_1), /* control block */
181 (void *) &screen_base_prompt_1_properties /* extended properties */
182 };
183
184 GX_CONST GX_STUDIO_WIDGET screen_base_define =
185 {
186 "screen_base",
187 GX_TYPE_WINDOW, /* widget type */
188 ID_SCREEN_BASE, /* widget id */
189 #if defined(GX_WIDGET_USER_DATA)
190 0, /* user data */
191 #endif
192 GX_STYLE_BORDER_NONE, /* style flags */
193 GX_STATUS_ACCEPTS_FOCUS, /* status flags */
194 sizeof(SCREEN_BASE_CONTROL_BLOCK), /* control block size */
195 GX_COLOR_ID_WINDOW_FILL, /* normal color id */
196 GX_COLOR_ID_WINDOW_FILL, /* selected color id */
197 GX_COLOR_ID_WINDOW_FILL, /* disabled color id */
198 gx_studio_window_create, /* create function */
199 GX_NULL, /* drawing function override */
200 GX_NULL, /* event function override */
201 {0, 0, 639, 479}, /* widget size */
202 GX_NULL, /* next widget */
203 &screen_base_prompt_1_define, /* child widget */
204 0, /* control block */
205 (void *) &screen_base_properties /* extended properties */
206 };
207 GX_CONST GX_STUDIO_WIDGET_ENTRY extended_unicode_widget_table[] =
208 {
209 { &screen_base_define, (GX_WIDGET *) &screen_base },
210 {GX_NULL, GX_NULL}
211 };
212
gx_studio_nested_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)213 static GX_WIDGET *gx_studio_nested_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
214 {
215 UINT status = GX_SUCCESS;
216 GX_WIDGET *widget = GX_NULL;
217 GX_VALUE list_count = 0;
218 GX_VALUE list_total_count = 0;
219
220 if(parent && (parent->gx_widget_type == GX_TYPE_MENU))
221 {
222 list_total_count = ((GX_MENU *)parent)->gx_menu_list_total_count;
223 }
224
225 while(definition && status == GX_SUCCESS)
226 {
227 if (definition->create_function)
228 {
229 if (definition->style & GX_STYLE_DYNAMICALLY_ALLOCATED)
230 {
231 status = gx_widget_allocate(&widget, definition->control_block_size);
232 if (status != GX_SUCCESS)
233 {
234 return GX_NULL;
235 }
236 }
237 else
238 {
239 if (control == GX_NULL)
240 {
241 return GX_NULL;
242 }
243 widget = (GX_WIDGET *) (control + definition->control_block_offset);
244 }
245
246 status = definition->create_function(definition, widget, parent);
247
248 if(list_count < list_total_count)
249 {
250 gx_menu_insert((GX_MENU *)parent, widget);
251 ((GX_MENU *)parent)->gx_menu_list_total_count--;
252 list_count++;
253 }
254
255 if (status == GX_SUCCESS)
256 {
257 if (definition->widget_type != GX_TYPE_TEMPLATE)
258 {
259 #if defined(GUIX_5_4_0_COMPATIBILITY)
260 gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id);
261 #else
262 gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id, definition->disabled_fill_color_id);
263 #endif
264 }
265
266 if (!(definition->status & GX_STATUS_ACCEPTS_FOCUS))
267 {
268 gx_widget_status_remove(widget, GX_STATUS_ACCEPTS_FOCUS);
269 }
270
271 if (definition->draw_function)
272 {
273 gx_widget_draw_set(widget, definition->draw_function);
274 }
275 if (definition->event_function)
276 {
277 gx_widget_event_process_set(widget, definition->event_function);
278 }
279
280 #if defined(GX_WIDGET_USER_DATA)
281 widget->gx_widget_user_data = definition->user_data;
282 #endif
283
284 if (definition->child_widget)
285 {
286 gx_studio_nested_widget_create(control, definition->child_widget, widget);
287 }
288 }
289 definition = definition->next_widget;
290 }
291 }
292 return widget;
293 }
294
gx_studio_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)295 GX_WIDGET *gx_studio_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
296 {
297 GX_WIDGET *widget;
298 widget = gx_studio_nested_widget_create(control, definition, GX_NULL);
299
300 if (parent && widget)
301 {
302 gx_widget_attach(parent, widget);
303 }
304 return widget;
305 }
306
gx_studio_named_widget_create(char * name,GX_WIDGET * parent,GX_WIDGET ** new_widget)307 UINT gx_studio_named_widget_create(char *name, GX_WIDGET *parent, GX_WIDGET **new_widget)
308 {
309 UINT status = GX_FAILURE;
310 GX_CONST GX_STUDIO_WIDGET_ENTRY *entry = extended_unicode_widget_table;
311 GX_WIDGET *widget = GX_NULL;
312
313 while(entry->widget_information)
314 {
315 if (!strcmp(name, entry->widget_information->widget_name))
316 {
317 widget = gx_studio_widget_create((GX_BYTE *) entry->widget, entry->widget_information, parent);
318 if (widget)
319 {
320 status = GX_SUCCESS;
321 }
322 break;
323 }
324 entry++;
325 }
326
327 if (new_widget)
328 {
329 *new_widget = widget;
330 }
331 return status;
332 }
333
334
gx_studio_display_configure(USHORT display,UINT (* driver)(GX_DISPLAY *),GX_UBYTE language,USHORT theme,GX_WINDOW_ROOT ** return_root)335 UINT gx_studio_display_configure(USHORT display, UINT (*driver)(GX_DISPLAY *),
336 GX_UBYTE language, USHORT theme, GX_WINDOW_ROOT **return_root)
337 {
338 GX_CONST GX_THEME *theme_ptr;
339 GX_RECTANGLE size;
340
341 GX_STUDIO_DISPLAY_INFO *display_info = &extended_unicode_display_table[display];
342
343
344 /* create the requested display */
345
346 gx_display_create(display_info->display,
347 display_info->name,
348 driver,
349 (GX_VALUE) display_info->x_resolution,
350 (GX_VALUE) display_info->y_resolution);
351
352
353 /* install the request theme */
354
355 if(display_info->theme_table)
356 {
357 theme_ptr = display_info->theme_table[theme];
358 if(theme_ptr)
359 {
360 gx_display_color_table_set(display_info->display, theme_ptr->theme_color_table, theme_ptr->theme_color_table_size);
361
362 /* install the color palette if required */
363 if (display_info->display->gx_display_driver_palette_set &&
364 theme_ptr->theme_palette != NULL)
365 {
366 display_info->display->gx_display_driver_palette_set(display_info->display, theme_ptr->theme_palette, theme_ptr->theme_palette_size);
367 }
368
369 gx_display_font_table_set(display_info->display, theme_ptr->theme_font_table, theme_ptr->theme_font_table_size);
370 gx_display_pixelmap_table_set(display_info->display, theme_ptr->theme_pixelmap_table, theme_ptr->theme_pixelmap_table_size);
371 gx_system_scroll_appearance_set(theme_ptr->theme_vertical_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_vertical_scrollbar_appearance);
372 gx_system_scroll_appearance_set(theme_ptr->theme_horizontal_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_horizontal_scrollbar_appearance);
373 }
374 }
375
376 /* Install the language table. */
377
378 if(display_info->language_table)
379 {
380 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);
381 gx_display_active_language_set(display_info->display, language);
382 }
383
384 /* Set screen rotation angle. */
385
386 display_info->display->gx_display_rotation_angle = display_info->rotation_angle;
387
388 /* create the canvas for this display */
389
390 gx_canvas_create(display_info->canvas,
391 display_info->canvas_name,
392 display_info->display,
393 GX_CANVAS_MANAGED | GX_CANVAS_VISIBLE,
394 display_info->x_resolution,
395 display_info->y_resolution,
396 display_info->canvas_memory,
397 display_info->canvas_memory_size);
398
399 /* Create the root window for this canvas */
400
401 gx_utility_rectangle_define(&size,
402 0, 0,
403 (GX_VALUE) (display_info->x_resolution - 1),
404 (GX_VALUE) (display_info->y_resolution - 1));
405
406 gx_window_root_create(display_info->root_window,
407 display_info->name,
408 display_info->canvas, GX_STYLE_NONE, 0, &size);
409 if (return_root)
410 {
411 *return_root = display_info->root_window;
412 }
413 return GX_SUCCESS;
414 }
415 #undef GUIX_STUDIO_GENERATED_FILE
416