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 "pixelmap_32bpp_resources.h"
16 #include "pixelmap_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 pixelmap_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_slider_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)81 UINT gx_studio_slider_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
82 {
83 UINT status;
84 GX_SLIDER *slider = (GX_SLIDER *) control_block;
85 GX_SLIDER_PROPERTIES *props = (GX_SLIDER_PROPERTIES *) info->properties;
86 GX_SLIDER_INFO slider_info;
87 slider_info.gx_slider_info_min_val = props->minval;
88 slider_info.gx_slider_info_max_val = props->maxval;
89 slider_info.gx_slider_info_current_val = props->current_val;
90 slider_info.gx_slider_info_increment = props->increment;
91 slider_info.gx_slider_info_min_travel = props->min_travel;
92 slider_info.gx_slider_info_max_travel = props->max_travel;
93 slider_info.gx_slider_info_needle_width = props->needle_width;
94 slider_info.gx_slider_info_needle_height = props->needle_height;
95 slider_info.gx_slider_info_needle_inset = props->needle_inset;
96 slider_info.gx_slider_info_needle_hotspot_offset = props->needle_hotspot;
97 status = gx_slider_create(slider,
98 info->widget_name,
99 parent,
100 props->tickmark_count,
101 &slider_info,
102 info->style,
103 info->widget_id,
104 &info->size);
105 return status;
106 }
107
gx_studio_window_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)108 UINT gx_studio_window_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
109 {
110 UINT status;
111 GX_WINDOW *window = (GX_WINDOW *) control_block;
112 GX_WINDOW_PROPERTIES *props = (GX_WINDOW_PROPERTIES *) info->properties;
113 status = gx_window_create(window, info->widget_name, parent, info->style, info->widget_id, &info->size);
114 if (status == GX_SUCCESS)
115 {
116 if (props->wallpaper_id)
117 {
118 gx_window_wallpaper_set(window, props->wallpaper_id, info->style & GX_STYLE_TILE_WALLPAPER);
119 }
120 }
121 return status;
122 }
123 GX_WINDOW_PROPERTIES main_window_properties =
124 {
125 0 /* wallpaper pixelmap id */
126 };
127 GX_WINDOW_PROPERTIES main_window_pic_window_properties =
128 {
129 0 /* wallpaper pixelmap id */
130 };
131 GX_CHECKBOX_PROPERTIES main_window_alpha_box_properties =
132 {
133 GX_STRING_ID_STRING_2, /* string id */
134 GX_FONT_ID_BUTTON, /* font id */
135 GX_COLOR_ID_BTN_TEXT, /* normal text color */
136 GX_COLOR_ID_BTN_TEXT, /* selected text color */
137 GX_COLOR_ID_BTN_TEXT, /* disabled text color */
138 0, /* unchecked pixelmap id */
139 0, /* checked pixelmap id */
140 0, /* unchecked disabled pixelmap id */
141 0 /* checked disabled pixelmap id */
142 };
143 GX_CHECKBOX_PROPERTIES main_window_compressed_box_properties =
144 {
145 GX_STRING_ID_STRING_4, /* string id */
146 GX_FONT_ID_BUTTON, /* font id */
147 GX_COLOR_ID_BTN_TEXT, /* normal text color */
148 GX_COLOR_ID_BTN_TEXT, /* selected text color */
149 GX_COLOR_ID_BTN_TEXT, /* disabled text color */
150 0, /* unchecked pixelmap id */
151 0, /* checked pixelmap id */
152 0, /* unchecked disabled pixelmap id */
153 0 /* checked disabled pixelmap id */
154 };
155 GX_SLIDER_PROPERTIES main_window_slider_1_properties =
156 {
157 9, /* tickmark count */
158 1, /* mimimun value */
159 9, /* maximum value */
160 5, /* current value */
161 10, /* increment */
162 1, /* minimum travel */
163 1, /* maximum travel */
164 5, /* needle width */
165 10, /* needle height */
166 5, /* needle inset */
167 2 /* needle hotspot */
168 };
169 GX_SLIDER_PROPERTIES main_window_slider_2_properties =
170 {
171 9, /* tickmark count */
172 1, /* mimimun value */
173 9, /* maximum value */
174 5, /* current value */
175 10, /* increment */
176 1, /* minimum travel */
177 1, /* maximum travel */
178 15, /* needle width */
179 5, /* needle height */
180 5, /* needle inset */
181 2 /* needle hotspot */
182 };
183
184 GX_CONST GX_STUDIO_WIDGET main_window_slider_2_define =
185 {
186 "slider_2",
187 GX_TYPE_SLIDER, /* widget type */
188 ID_VERTICALMOVE, /* widget id */
189 #if defined(GX_WIDGET_USER_DATA)
190 0, /* user data */
191 #endif
192 GX_STYLE_BORDER_NONE|GX_STYLE_ENABLED|GX_STYLE_SHOW_NEEDLE|GX_STYLE_SHOW_TICKMARKS|GX_STYLE_SLIDER_VERTICAL, /* style flags */
193 GX_STATUS_ACCEPTS_FOCUS, /* status flags */
194 sizeof(GX_SLIDER), /* control block size */
195 GX_COLOR_ID_BTN_UPPER, /* normal color id */
196 GX_COLOR_ID_BTN_UPPER, /* selected color id */
197 GX_COLOR_ID_BTN_UPPER, /* disabled color id */
198 gx_studio_slider_create, /* create function */
199 GX_NULL, /* drawing function override */
200 GX_NULL, /* event function override */
201 {258, 25, 270, 174}, /* widget size */
202 GX_NULL, /* no next widget */
203 GX_NULL, /* no child widgets */
204 offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_slider_2), /* control block */
205 (void *) &main_window_slider_2_properties /* extended properties */
206 };
207
208 GX_CONST GX_STUDIO_WIDGET main_window_slider_1_define =
209 {
210 "slider_1",
211 GX_TYPE_SLIDER, /* widget type */
212 ID_HORIZONTALMOVE, /* widget id */
213 #if defined(GX_WIDGET_USER_DATA)
214 0, /* user data */
215 #endif
216 GX_STYLE_BORDER_NONE|GX_STYLE_ENABLED|GX_STYLE_SHOW_NEEDLE|GX_STYLE_SHOW_TICKMARKS, /* style flags */
217 GX_STATUS_ACCEPTS_FOCUS, /* status flags */
218 sizeof(GX_SLIDER), /* control block size */
219 GX_COLOR_ID_BTN_UPPER, /* normal color id */
220 GX_COLOR_ID_BTN_UPPER, /* selected color id */
221 GX_COLOR_ID_BTN_UPPER, /* disabled color id */
222 gx_studio_slider_create, /* create function */
223 GX_NULL, /* drawing function override */
224 GX_NULL, /* event function override */
225 {45, 180, 204, 197}, /* widget size */
226 &main_window_slider_2_define, /* next widget definition */
227 GX_NULL, /* no child widgets */
228 offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_slider_1), /* control block */
229 (void *) &main_window_slider_1_properties /* extended properties */
230 };
231
232 GX_CONST GX_STUDIO_WIDGET main_window_compressed_box_define =
233 {
234 "compressed_box",
235 GX_TYPE_CHECKBOX, /* widget type */
236 ID_COMPRESSED, /* widget id */
237 #if defined(GX_WIDGET_USER_DATA)
238 0, /* user data */
239 #endif
240 GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_BUTTON_TOGGLE|GX_STYLE_TEXT_LEFT, /* style flags */
241 GX_STATUS_ACCEPTS_FOCUS, /* status flags */
242 sizeof(GX_CHECKBOX), /* control block size */
243 GX_COLOR_ID_BTN_LOWER, /* normal color id */
244 GX_COLOR_ID_BTN_UPPER, /* selected color id */
245 GX_COLOR_ID_BTN_LOWER, /* disabled color id */
246 gx_studio_checkbox_create, /* create function */
247 GX_NULL, /* drawing function override */
248 GX_NULL, /* event function override */
249 {128, 209, 248, 226}, /* widget size */
250 &main_window_slider_1_define, /* next widget definition */
251 GX_NULL, /* no child widgets */
252 offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_compressed_box), /* control block */
253 (void *) &main_window_compressed_box_properties /* extended properties */
254 };
255
256 GX_CONST GX_STUDIO_WIDGET main_window_alpha_box_define =
257 {
258 "alpha_box",
259 GX_TYPE_CHECKBOX, /* widget type */
260 ID_ALPHA, /* widget id */
261 #if defined(GX_WIDGET_USER_DATA)
262 0, /* user data */
263 #endif
264 GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_BUTTON_TOGGLE|GX_STYLE_TEXT_LEFT, /* style flags */
265 GX_STATUS_ACCEPTS_FOCUS, /* status flags */
266 sizeof(GX_CHECKBOX), /* control block size */
267 GX_COLOR_ID_SELECTED_TEXT, /* normal color id */
268 GX_COLOR_ID_BTN_UPPER, /* selected color id */
269 GX_COLOR_ID_SELECTED_TEXT, /* disabled color id */
270 gx_studio_checkbox_create, /* create function */
271 GX_NULL, /* drawing function override */
272 GX_NULL, /* event function override */
273 {27, 206, 95, 229}, /* widget size */
274 &main_window_compressed_box_define, /* next widget definition */
275 GX_NULL, /* no child widgets */
276 offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_alpha_box), /* control block */
277 (void *) &main_window_alpha_box_properties /* extended properties */
278 };
279
280 GX_CONST GX_STUDIO_WIDGET main_window_pic_window_define =
281 {
282 "pic_window",
283 GX_TYPE_WINDOW, /* widget type */
284 ID_PIC_WINDOW, /* widget id */
285 #if defined(GX_WIDGET_USER_DATA)
286 0, /* user data */
287 #endif
288 GX_STYLE_BORDER_THIN|GX_STYLE_TRANSPARENT, /* style flags */
289 GX_STATUS_ACCEPTS_FOCUS, /* status flags */
290 sizeof(GX_WINDOW), /* control block size */
291 GX_COLOR_ID_WINDOW_FILL, /* normal color id */
292 GX_COLOR_ID_WINDOW_FILL, /* selected color id */
293 GX_COLOR_ID_WINDOW_FILL, /* disabled color id */
294 gx_studio_window_create, /* create function */
295 (VOID (*)(GX_WIDGET *)) pic_win_draw, /* drawing function override */
296 GX_NULL, /* event function override */
297 {29, 25, 228, 157}, /* widget size */
298 &main_window_alpha_box_define, /* next widget definition */
299 GX_NULL, /* no child widgets */
300 offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_pic_window), /* control block */
301 (void *) &main_window_pic_window_properties /* extended properties */
302 };
303
304 GX_CONST GX_STUDIO_WIDGET main_window_define =
305 {
306 "main_window",
307 GX_TYPE_WINDOW, /* widget type */
308 GX_ID_NONE, /* widget id */
309 #if defined(GX_WIDGET_USER_DATA)
310 0, /* user data */
311 #endif
312 GX_STYLE_BORDER_THIN, /* style flags */
313 GX_STATUS_ACCEPTS_FOCUS, /* status flags */
314 sizeof(MAIN_WINDOW_CONTROL_BLOCK), /* control block size */
315 GX_COLOR_ID_BTN_LOWER, /* normal color id */
316 GX_COLOR_ID_BTN_LOWER, /* selected color id */
317 GX_COLOR_ID_BTN_LOWER, /* disabled color id */
318 gx_studio_window_create, /* create function */
319 GX_NULL, /* drawing function override */
320 (UINT (*)(GX_WIDGET *, GX_EVENT *)) main_event_handler, /* event function override */
321 {0, 0, 319, 479}, /* widget size */
322 GX_NULL, /* next widget */
323 &main_window_pic_window_define, /* child widget */
324 0, /* control block */
325 (void *) &main_window_properties /* extended properties */
326 };
327 GX_CONST GX_STUDIO_WIDGET_ENTRY pixelmap_32bpp_widget_table[] =
328 {
329 { &main_window_define, (GX_WIDGET *) &main_window },
330 {GX_NULL, GX_NULL}
331 };
332
gx_studio_nested_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)333 static GX_WIDGET *gx_studio_nested_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
334 {
335 UINT status = GX_SUCCESS;
336 GX_WIDGET *widget = GX_NULL;
337 GX_VALUE list_count = 0;
338 GX_VALUE list_total_count = 0;
339
340 if(parent && (parent->gx_widget_type == GX_TYPE_MENU))
341 {
342 list_total_count = ((GX_MENU *)parent)->gx_menu_list_total_count;
343 }
344
345 while(definition && status == GX_SUCCESS)
346 {
347 if (definition->create_function)
348 {
349 if (definition->style & GX_STYLE_DYNAMICALLY_ALLOCATED)
350 {
351 status = gx_widget_allocate(&widget, definition->control_block_size);
352 if (status != GX_SUCCESS)
353 {
354 return GX_NULL;
355 }
356 }
357 else
358 {
359 if (control == GX_NULL)
360 {
361 return GX_NULL;
362 }
363 widget = (GX_WIDGET *) (control + definition->control_block_offset);
364 }
365
366 status = definition->create_function(definition, widget, parent);
367
368 if(list_count < list_total_count)
369 {
370 gx_menu_insert((GX_MENU *)parent, widget);
371 ((GX_MENU *)parent)->gx_menu_list_total_count--;
372 list_count++;
373 }
374
375 if (status == GX_SUCCESS)
376 {
377 if (definition->widget_type != GX_TYPE_TEMPLATE)
378 {
379 #if defined(GUIX_5_4_0_COMPATIBILITY)
380 gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id);
381 #else
382 gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id, definition->disabled_fill_color_id);
383 #endif
384 }
385
386 if (!(definition->status & GX_STATUS_ACCEPTS_FOCUS))
387 {
388 gx_widget_status_remove(widget, GX_STATUS_ACCEPTS_FOCUS);
389 }
390
391 if (definition->draw_function)
392 {
393 gx_widget_draw_set(widget, definition->draw_function);
394 }
395 if (definition->event_function)
396 {
397 gx_widget_event_process_set(widget, definition->event_function);
398 }
399
400 #if defined(GX_WIDGET_USER_DATA)
401 widget->gx_widget_user_data = definition->user_data;
402 #endif
403
404 if (definition->child_widget)
405 {
406 gx_studio_nested_widget_create(control, definition->child_widget, widget);
407 }
408 }
409 definition = definition->next_widget;
410 }
411 }
412 return widget;
413 }
414
gx_studio_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)415 GX_WIDGET *gx_studio_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
416 {
417 GX_WIDGET *widget;
418 widget = gx_studio_nested_widget_create(control, definition, GX_NULL);
419
420 if (parent && widget)
421 {
422 gx_widget_attach(parent, widget);
423 }
424 return widget;
425 }
426
gx_studio_named_widget_create(char * name,GX_WIDGET * parent,GX_WIDGET ** new_widget)427 UINT gx_studio_named_widget_create(char *name, GX_WIDGET *parent, GX_WIDGET **new_widget)
428 {
429 UINT status = GX_FAILURE;
430 GX_CONST GX_STUDIO_WIDGET_ENTRY *entry = pixelmap_32bpp_widget_table;
431 GX_WIDGET *widget = GX_NULL;
432
433 while(entry->widget_information)
434 {
435 if (!strcmp(name, entry->widget_information->widget_name))
436 {
437 widget = gx_studio_widget_create((GX_BYTE *) entry->widget, entry->widget_information, parent);
438 if (widget)
439 {
440 status = GX_SUCCESS;
441 }
442 break;
443 }
444 entry++;
445 }
446
447 if (new_widget)
448 {
449 *new_widget = widget;
450 }
451 return status;
452 }
453
454
gx_studio_display_configure(USHORT display,UINT (* driver)(GX_DISPLAY *),GX_UBYTE language,USHORT theme,GX_WINDOW_ROOT ** return_root)455 UINT gx_studio_display_configure(USHORT display, UINT (*driver)(GX_DISPLAY *),
456 GX_UBYTE language, USHORT theme, GX_WINDOW_ROOT **return_root)
457 {
458 GX_CONST GX_THEME *theme_ptr;
459 GX_RECTANGLE size;
460
461 GX_STUDIO_DISPLAY_INFO *display_info = &pixelmap_32bpp_display_table[display];
462
463
464 /* create the requested display */
465
466 gx_display_create(display_info->display,
467 display_info->name,
468 driver,
469 (GX_VALUE) display_info->x_resolution,
470 (GX_VALUE) display_info->y_resolution);
471
472
473 /* install the request theme */
474
475 if(display_info->theme_table)
476 {
477 theme_ptr = display_info->theme_table[theme];
478 if(theme_ptr)
479 {
480 gx_display_color_table_set(display_info->display, theme_ptr->theme_color_table, theme_ptr->theme_color_table_size);
481
482 /* install the color palette if required */
483 if (display_info->display->gx_display_driver_palette_set &&
484 theme_ptr->theme_palette != NULL)
485 {
486 display_info->display->gx_display_driver_palette_set(display_info->display, theme_ptr->theme_palette, theme_ptr->theme_palette_size);
487 }
488
489 gx_display_font_table_set(display_info->display, theme_ptr->theme_font_table, theme_ptr->theme_font_table_size);
490 gx_display_pixelmap_table_set(display_info->display, theme_ptr->theme_pixelmap_table, theme_ptr->theme_pixelmap_table_size);
491 gx_system_scroll_appearance_set(theme_ptr->theme_vertical_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_vertical_scrollbar_appearance);
492 gx_system_scroll_appearance_set(theme_ptr->theme_horizontal_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_horizontal_scrollbar_appearance);
493 }
494 }
495
496 /* Install the language table. */
497
498 if(display_info->language_table)
499 {
500 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);
501 gx_display_active_language_set(display_info->display, language);
502 }
503
504 /* Set screen rotation angle. */
505
506 display_info->display->gx_display_rotation_angle = display_info->rotation_angle;
507
508 /* create the canvas for this display */
509
510 gx_canvas_create(display_info->canvas,
511 display_info->canvas_name,
512 display_info->display,
513 GX_CANVAS_MANAGED | GX_CANVAS_VISIBLE,
514 display_info->x_resolution,
515 display_info->y_resolution,
516 display_info->canvas_memory,
517 display_info->canvas_memory_size);
518
519 /* Create the root window for this canvas */
520
521 gx_utility_rectangle_define(&size,
522 0, 0,
523 (GX_VALUE) (display_info->x_resolution - 1),
524 (GX_VALUE) (display_info->y_resolution - 1));
525
526 gx_window_root_create(display_info->root_window,
527 display_info->name,
528 display_info->canvas, GX_STYLE_NONE, 0, &size);
529 if (return_root)
530 {
531 *return_root = display_info->root_window;
532 }
533 return GX_SUCCESS;
534 }
535 #undef GUIX_STUDIO_GENERATED_FILE
536