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:11 */
10 /*******************************************************************************/
11
12
13 #define GUIX_STUDIO_GENERATED_FILE
14 #include <stddef.h>
15 #include "palette_32bpp_resources.h"
16 #include "palette_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[76800];
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 palette_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 320, /* x resolution */
39 240, /* 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 307200, /* canvas memory size in bytes */
45 0 /* rotation angle */
46 }
47 };
48
49
gx_studio_checkbox_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)50 UINT gx_studio_checkbox_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
51 {
52 UINT status;
53 GX_CHECKBOX *button = (GX_CHECKBOX *) control_block;
54 GX_TEXT_BUTTON *text_button = (GX_TEXT_BUTTON *) button;
55 GX_CHECKBOX_PROPERTIES *props = (GX_CHECKBOX_PROPERTIES *) info->properties;
56 status = gx_checkbox_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->unchecked_pixelmap_id ||
67 props->checked_pixelmap_id ||
68 props->unchecked_disabled_pixelmap_id ||
69 props->checked_disabled_pixelmap_id)
70 {
71 gx_checkbox_pixelmap_set(button,
72 props->unchecked_pixelmap_id,
73 props->checked_pixelmap_id,
74 props->unchecked_disabled_pixelmap_id,
75 props->checked_disabled_pixelmap_id);
76 }
77 }
78 return status;
79 }
80
gx_studio_window_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)81 UINT gx_studio_window_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
82 {
83 UINT status;
84 GX_WINDOW *window = (GX_WINDOW *) control_block;
85 GX_WINDOW_PROPERTIES *props = (GX_WINDOW_PROPERTIES *) info->properties;
86 status = gx_window_create(window, info->widget_name, parent, info->style, info->widget_id, &info->size);
87 if (status == GX_SUCCESS)
88 {
89 if (props->wallpaper_id)
90 {
91 gx_window_wallpaper_set(window, props->wallpaper_id, info->style & GX_STYLE_TILE_WALLPAPER);
92 }
93 }
94 return status;
95 }
96 GX_WINDOW_PROPERTIES main_window_properties =
97 {
98 0 /* wallpaper pixelmap id */
99 };
100 GX_WINDOW_PROPERTIES main_window_pic_window_properties =
101 {
102 GX_PIXELMAP_ID_ICON_FOOT_ALPHA /* wallpaper pixelmap id */
103 };
104 GX_CHECKBOX_PROPERTIES main_window_transparent_box_properties =
105 {
106 GX_STRING_ID_STRING_6, /* string id */
107 GX_FONT_ID_BUTTON, /* font id */
108 GX_COLOR_ID_BTN_TEXT, /* normal text color */
109 GX_COLOR_ID_BTN_TEXT, /* selected text color */
110 GX_COLOR_ID_BTN_TEXT, /* disabled text color */
111 0, /* unchecked pixelmap id */
112 0, /* checked pixelmap id */
113 0, /* unchecked disabled pixelmap id */
114 0 /* checked disabled pixelmap id */
115 };
116 GX_CHECKBOX_PROPERTIES main_window_compressed_box_properties =
117 {
118 GX_STRING_ID_STRING_4, /* string id */
119 GX_FONT_ID_BUTTON, /* font id */
120 GX_COLOR_ID_BTN_TEXT, /* normal text color */
121 GX_COLOR_ID_BTN_TEXT, /* selected text color */
122 GX_COLOR_ID_BTN_TEXT, /* disabled text color */
123 0, /* unchecked pixelmap id */
124 0, /* checked pixelmap id */
125 0, /* unchecked disabled pixelmap id */
126 0 /* checked disabled pixelmap id */
127 };
128
129 GX_CONST GX_STUDIO_WIDGET main_window_compressed_box_define =
130 {
131 "compressed_box",
132 GX_TYPE_CHECKBOX, /* widget type */
133 ID_COMPRESSED, /* widget id */
134 #if defined(GX_WIDGET_USER_DATA)
135 0, /* user data */
136 #endif
137 GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_BUTTON_TOGGLE|GX_STYLE_TEXT_LEFT, /* style flags */
138 GX_STATUS_ACCEPTS_FOCUS, /* status flags */
139 sizeof(GX_CHECKBOX), /* control block size */
140 GX_COLOR_ID_BTN_LOWER, /* normal color id */
141 GX_COLOR_ID_BTN_UPPER, /* selected color id */
142 GX_COLOR_ID_BTN_LOWER, /* disabled color id */
143 gx_studio_checkbox_create, /* create function */
144 GX_NULL, /* drawing function override */
145 GX_NULL, /* event function override */
146 {168, 207, 288, 224}, /* widget size */
147 GX_NULL, /* no next widget */
148 GX_NULL, /* no child widgets */
149 offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_compressed_box), /* control block */
150 (void *) &main_window_compressed_box_properties /* extended properties */
151 };
152
153 GX_CONST GX_STUDIO_WIDGET main_window_transparent_box_define =
154 {
155 "transparent_box",
156 GX_TYPE_CHECKBOX, /* widget type */
157 ID_TRANSPARENT, /* widget id */
158 #if defined(GX_WIDGET_USER_DATA)
159 0, /* user data */
160 #endif
161 GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_BUTTON_TOGGLE|GX_STYLE_TEXT_LEFT, /* style flags */
162 GX_STATUS_ACCEPTS_FOCUS, /* status flags */
163 sizeof(GX_CHECKBOX), /* control block size */
164 GX_COLOR_ID_SELECTED_TEXT, /* normal color id */
165 GX_COLOR_ID_BTN_UPPER, /* selected color id */
166 GX_COLOR_ID_SELECTED_TEXT, /* disabled color id */
167 gx_studio_checkbox_create, /* create function */
168 GX_NULL, /* drawing function override */
169 GX_NULL, /* event function override */
170 {32, 203, 149, 226}, /* widget size */
171 &main_window_compressed_box_define, /* next widget definition */
172 GX_NULL, /* no child widgets */
173 offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_transparent_box), /* control block */
174 (void *) &main_window_transparent_box_properties /* extended properties */
175 };
176
177 GX_CONST GX_STUDIO_WIDGET main_window_pic_window_define =
178 {
179 "pic_window",
180 GX_TYPE_WINDOW, /* widget type */
181 ID_PIC_WINDOW, /* widget id */
182 #if defined(GX_WIDGET_USER_DATA)
183 0, /* user data */
184 #endif
185 GX_STYLE_BORDER_THIN|GX_STYLE_TRANSPARENT, /* style flags */
186 GX_STATUS_ACCEPTS_FOCUS, /* status flags */
187 sizeof(GX_WINDOW), /* control block size */
188 GX_COLOR_ID_WINDOW_FILL, /* normal color id */
189 GX_COLOR_ID_WINDOW_FILL, /* selected color id */
190 GX_COLOR_ID_WINDOW_FILL, /* disabled color id */
191 gx_studio_window_create, /* create function */
192 (VOID (*)(GX_WIDGET *)) pic_win_draw, /* drawing function override */
193 GX_NULL, /* event function override */
194 {29, 25, 274, 186}, /* widget size */
195 &main_window_transparent_box_define, /* next widget definition */
196 GX_NULL, /* no child widgets */
197 offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_pic_window), /* control block */
198 (void *) &main_window_pic_window_properties /* extended properties */
199 };
200
201 GX_CONST GX_STUDIO_WIDGET main_window_define =
202 {
203 "main_window",
204 GX_TYPE_WINDOW, /* widget type */
205 GX_ID_NONE, /* widget id */
206 #if defined(GX_WIDGET_USER_DATA)
207 0, /* user data */
208 #endif
209 GX_STYLE_BORDER_THIN, /* style flags */
210 GX_STATUS_ACCEPTS_FOCUS, /* status flags */
211 sizeof(MAIN_WINDOW_CONTROL_BLOCK), /* control block size */
212 GX_COLOR_ID_SHADOW, /* normal color id */
213 GX_COLOR_ID_SHADOW, /* selected color id */
214 GX_COLOR_ID_SHADOW, /* disabled color id */
215 gx_studio_window_create, /* create function */
216 GX_NULL, /* drawing function override */
217 (UINT (*)(GX_WIDGET *, GX_EVENT *)) main_event_handler, /* event function override */
218 {0, 0, 319, 479}, /* widget size */
219 GX_NULL, /* next widget */
220 &main_window_pic_window_define, /* child widget */
221 0, /* control block */
222 (void *) &main_window_properties /* extended properties */
223 };
224 GX_CONST GX_STUDIO_WIDGET_ENTRY palette_32bpp_widget_table[] =
225 {
226 { &main_window_define, (GX_WIDGET *) &main_window },
227 {GX_NULL, GX_NULL}
228 };
229
gx_studio_nested_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)230 static GX_WIDGET *gx_studio_nested_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
231 {
232 UINT status = GX_SUCCESS;
233 GX_WIDGET *widget = GX_NULL;
234 GX_VALUE list_count = 0;
235 GX_VALUE list_total_count = 0;
236
237 if(parent && (parent->gx_widget_type == GX_TYPE_MENU))
238 {
239 list_total_count = ((GX_MENU *)parent)->gx_menu_list_total_count;
240 }
241
242 while(definition && status == GX_SUCCESS)
243 {
244 if (definition->create_function)
245 {
246 if (definition->style & GX_STYLE_DYNAMICALLY_ALLOCATED)
247 {
248 status = gx_widget_allocate(&widget, definition->control_block_size);
249 if (status != GX_SUCCESS)
250 {
251 return GX_NULL;
252 }
253 }
254 else
255 {
256 if (control == GX_NULL)
257 {
258 return GX_NULL;
259 }
260 widget = (GX_WIDGET *) (control + definition->control_block_offset);
261 }
262
263 status = definition->create_function(definition, widget, parent);
264
265 if(list_count < list_total_count)
266 {
267 gx_menu_insert((GX_MENU *)parent, widget);
268 ((GX_MENU *)parent)->gx_menu_list_total_count--;
269 list_count++;
270 }
271
272 if (status == GX_SUCCESS)
273 {
274 if (definition->widget_type != GX_TYPE_TEMPLATE)
275 {
276 #if defined(GUIX_5_4_0_COMPATIBILITY)
277 gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id);
278 #else
279 gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id, definition->disabled_fill_color_id);
280 #endif
281 }
282
283 if (!(definition->status & GX_STATUS_ACCEPTS_FOCUS))
284 {
285 gx_widget_status_remove(widget, GX_STATUS_ACCEPTS_FOCUS);
286 }
287
288 if (definition->draw_function)
289 {
290 gx_widget_draw_set(widget, definition->draw_function);
291 }
292 if (definition->event_function)
293 {
294 gx_widget_event_process_set(widget, definition->event_function);
295 }
296
297 #if defined(GX_WIDGET_USER_DATA)
298 widget->gx_widget_user_data = definition->user_data;
299 #endif
300
301 if (definition->child_widget)
302 {
303 gx_studio_nested_widget_create(control, definition->child_widget, widget);
304 }
305 }
306 definition = definition->next_widget;
307 }
308 }
309 return widget;
310 }
311
gx_studio_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)312 GX_WIDGET *gx_studio_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
313 {
314 GX_WIDGET *widget;
315 widget = gx_studio_nested_widget_create(control, definition, GX_NULL);
316
317 if (parent && widget)
318 {
319 gx_widget_attach(parent, widget);
320 }
321 return widget;
322 }
323
gx_studio_named_widget_create(char * name,GX_WIDGET * parent,GX_WIDGET ** new_widget)324 UINT gx_studio_named_widget_create(char *name, GX_WIDGET *parent, GX_WIDGET **new_widget)
325 {
326 UINT status = GX_FAILURE;
327 GX_CONST GX_STUDIO_WIDGET_ENTRY *entry = palette_32bpp_widget_table;
328 GX_WIDGET *widget = GX_NULL;
329
330 while(entry->widget_information)
331 {
332 if (!strcmp(name, entry->widget_information->widget_name))
333 {
334 widget = gx_studio_widget_create((GX_BYTE *) entry->widget, entry->widget_information, parent);
335 if (widget)
336 {
337 status = GX_SUCCESS;
338 }
339 break;
340 }
341 entry++;
342 }
343
344 if (new_widget)
345 {
346 *new_widget = widget;
347 }
348 return status;
349 }
350
351
gx_studio_display_configure(USHORT display,UINT (* driver)(GX_DISPLAY *),GX_UBYTE language,USHORT theme,GX_WINDOW_ROOT ** return_root)352 UINT gx_studio_display_configure(USHORT display, UINT (*driver)(GX_DISPLAY *),
353 GX_UBYTE language, USHORT theme, GX_WINDOW_ROOT **return_root)
354 {
355 GX_CONST GX_THEME *theme_ptr;
356 GX_RECTANGLE size;
357
358 GX_STUDIO_DISPLAY_INFO *display_info = &palette_32bpp_display_table[display];
359
360
361 /* create the requested display */
362
363 gx_display_create(display_info->display,
364 display_info->name,
365 driver,
366 (GX_VALUE) display_info->x_resolution,
367 (GX_VALUE) display_info->y_resolution);
368
369
370 /* install the request theme */
371
372 if(display_info->theme_table)
373 {
374 theme_ptr = display_info->theme_table[theme];
375 if(theme_ptr)
376 {
377 gx_display_color_table_set(display_info->display, theme_ptr->theme_color_table, theme_ptr->theme_color_table_size);
378
379 /* install the color palette if required */
380 if (display_info->display->gx_display_driver_palette_set &&
381 theme_ptr->theme_palette != NULL)
382 {
383 display_info->display->gx_display_driver_palette_set(display_info->display, theme_ptr->theme_palette, theme_ptr->theme_palette_size);
384 }
385
386 gx_display_font_table_set(display_info->display, theme_ptr->theme_font_table, theme_ptr->theme_font_table_size);
387 gx_display_pixelmap_table_set(display_info->display, theme_ptr->theme_pixelmap_table, theme_ptr->theme_pixelmap_table_size);
388 gx_system_scroll_appearance_set(theme_ptr->theme_vertical_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_vertical_scrollbar_appearance);
389 gx_system_scroll_appearance_set(theme_ptr->theme_horizontal_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_horizontal_scrollbar_appearance);
390 }
391 }
392
393 /* Install the language table. */
394
395 if(display_info->language_table)
396 {
397 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);
398 gx_display_active_language_set(display_info->display, language);
399 }
400
401 /* Set screen rotation angle. */
402
403 display_info->display->gx_display_rotation_angle = display_info->rotation_angle;
404
405 /* create the canvas for this display */
406
407 gx_canvas_create(display_info->canvas,
408 display_info->canvas_name,
409 display_info->display,
410 GX_CANVAS_MANAGED | GX_CANVAS_VISIBLE,
411 display_info->x_resolution,
412 display_info->y_resolution,
413 display_info->canvas_memory,
414 display_info->canvas_memory_size);
415
416 /* Create the root window for this canvas */
417
418 gx_utility_rectangle_define(&size,
419 0, 0,
420 (GX_VALUE) (display_info->x_resolution - 1),
421 (GX_VALUE) (display_info->y_resolution - 1));
422
423 gx_window_root_create(display_info->root_window,
424 display_info->name,
425 display_info->canvas, GX_STYLE_NONE, 0, &size);
426 if (return_root)
427 {
428 *return_root = display_info->root_window;
429 }
430 return GX_SUCCESS;
431 }
432 #undef GUIX_STUDIO_GENERATED_FILE
433