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.1.1 */
9 /* Date (dd.mm.yyyy): 20. 4.2023 Time (hh:mm): 14:42 */
10 /*******************************************************************************/
11
12
13 #define GUIX_STUDIO_GENERATED_FILE
14 #include <stddef.h>
15 #include "jpeg_draw_16bpp_resources.h"
16 #include "jpeg_draw_16bpp_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[192000];
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 jpeg_draw_16bpp_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 800, /* 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 768000, /* canvas memory size in bytes */
45 0 /* rotation angle */
46 }
47 };
48
49
gx_studio_window_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)50 UINT gx_studio_window_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
51 {
52 UINT status;
53 GX_WINDOW *window = (GX_WINDOW *) control_block;
54 GX_WINDOW_PROPERTIES *props = (GX_WINDOW_PROPERTIES *) info->properties;
55 status = gx_window_create(window, info->widget_name, parent, info->style, info->widget_id, &info->size);
56 if (status == GX_SUCCESS)
57 {
58 if (props->wallpaper_id)
59 {
60 gx_window_wallpaper_set(window, props->wallpaper_id, info->style & GX_STYLE_TILE_WALLPAPER);
61 }
62 }
63 return status;
64 }
65 GX_WINDOW_PROPERTIES main_window_properties =
66 {
67 0 /* wallpaper pixelmap id */
68 };
69 GX_WINDOW_PROPERTIES main_window_pic_window_properties =
70 {
71 GX_PIXELMAP_ID_RED_APPLE /* wallpaper pixelmap id */
72 };
73 GX_WINDOW_PROPERTIES main_window_window_1_properties =
74 {
75 GX_PIXELMAP_ID_FISH /* wallpaper pixelmap id */
76 };
77
78 GX_CONST GX_STUDIO_WIDGET main_window_window_1_define =
79 {
80 "window_1",
81 GX_TYPE_WINDOW, /* widget type */
82 GX_ID_NONE, /* widget id */
83 #if defined(GX_WIDGET_USER_DATA)
84 0, /* user data */
85 #endif
86 GX_STYLE_BORDER_THIN, /* style flags */
87 GX_STATUS_ACCEPTS_FOCUS, /* status flags */
88 sizeof(GX_WINDOW), /* control block size */
89 GX_COLOR_ID_WINDOW_FILL, /* normal color id */
90 GX_COLOR_ID_WINDOW_FILL, /* selected color id */
91 GX_COLOR_ID_WINDOW_FILL, /* disabled color id */
92 gx_studio_window_create, /* create function */
93 GX_NULL, /* drawing function override */
94 GX_NULL, /* event function override */
95 {383, 56, 768, 405}, /* widget size */
96 GX_NULL, /* no next widget */
97 GX_NULL, /* no child widgets */
98 offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_window_1), /* control block */
99 (void *) &main_window_window_1_properties /* extended properties */
100 };
101
102 GX_CONST GX_STUDIO_WIDGET main_window_pic_window_define =
103 {
104 "pic_window",
105 GX_TYPE_WINDOW, /* widget type */
106 GX_ID_NONE, /* widget id */
107 #if defined(GX_WIDGET_USER_DATA)
108 0, /* user data */
109 #endif
110 GX_STYLE_BORDER_THIN|GX_STYLE_TRANSPARENT, /* style flags */
111 GX_STATUS_ACCEPTS_FOCUS, /* status flags */
112 sizeof(GX_WINDOW), /* control block size */
113 GX_COLOR_ID_WINDOW_FILL, /* normal color id */
114 GX_COLOR_ID_WINDOW_FILL, /* selected color id */
115 GX_COLOR_ID_WINDOW_FILL, /* disabled color id */
116 gx_studio_window_create, /* create function */
117 GX_NULL, /* drawing function override */
118 GX_NULL, /* event function override */
119 {80, 85, 275, 353}, /* widget size */
120 &main_window_window_1_define, /* next widget definition */
121 GX_NULL, /* no child widgets */
122 offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_pic_window), /* control block */
123 (void *) &main_window_pic_window_properties /* extended properties */
124 };
125
126 GX_CONST GX_STUDIO_WIDGET main_window_define =
127 {
128 "main_window",
129 GX_TYPE_WINDOW, /* widget type */
130 GX_ID_NONE, /* widget id */
131 #if defined(GX_WIDGET_USER_DATA)
132 0, /* user data */
133 #endif
134 GX_STYLE_BORDER_THIN, /* style flags */
135 GX_STATUS_ACCEPTS_FOCUS, /* status flags */
136 sizeof(MAIN_WINDOW_CONTROL_BLOCK), /* control block size */
137 GX_COLOR_ID_BTN_LOWER, /* normal color id */
138 GX_COLOR_ID_BTN_LOWER, /* selected color id */
139 GX_COLOR_ID_BTN_LOWER, /* disabled color id */
140 gx_studio_window_create, /* create function */
141 (VOID (*)(GX_WIDGET *)) main_window_draw, /* drawing function override */
142 GX_NULL, /* event function override */
143 {0, 0, 799, 479}, /* widget size */
144 GX_NULL, /* next widget */
145 &main_window_pic_window_define, /* child widget */
146 0, /* control block */
147 (void *) &main_window_properties /* extended properties */
148 };
149 GX_CONST GX_STUDIO_WIDGET_ENTRY jpeg_draw_16bpp_widget_table[] =
150 {
151 { &main_window_define, (GX_WIDGET *) &main_window },
152 {GX_NULL, GX_NULL}
153 };
154
gx_studio_nested_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)155 static GX_WIDGET *gx_studio_nested_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
156 {
157 UINT status = GX_SUCCESS;
158 GX_WIDGET *widget = GX_NULL;
159 GX_VALUE list_count = 0;
160 GX_VALUE list_total_count = 0;
161
162 if(parent && (parent->gx_widget_type == GX_TYPE_MENU))
163 {
164 list_total_count = ((GX_MENU *)parent)->gx_menu_list_total_count;
165 }
166
167 while(definition && status == GX_SUCCESS)
168 {
169 if (definition->create_function)
170 {
171 if (definition->style & GX_STYLE_DYNAMICALLY_ALLOCATED)
172 {
173 status = gx_widget_allocate(&widget, definition->control_block_size);
174 if (status != GX_SUCCESS)
175 {
176 return GX_NULL;
177 }
178 }
179 else
180 {
181 if (control == GX_NULL)
182 {
183 return GX_NULL;
184 }
185 widget = (GX_WIDGET *) (control + definition->control_block_offset);
186 }
187
188 status = definition->create_function(definition, widget, parent);
189
190 if(list_count < list_total_count)
191 {
192 gx_menu_insert((GX_MENU *)parent, widget);
193 ((GX_MENU *)parent)->gx_menu_list_total_count--;
194 list_count++;
195 }
196
197 if (status == GX_SUCCESS)
198 {
199 if (definition->widget_type != GX_TYPE_TEMPLATE)
200 {
201 #if defined(GUIX_5_4_0_COMPATIBILITY)
202 gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id);
203 #else
204 gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id, definition->disabled_fill_color_id);
205 #endif
206 }
207
208 if (!(definition->status & GX_STATUS_ACCEPTS_FOCUS))
209 {
210 gx_widget_status_remove(widget, GX_STATUS_ACCEPTS_FOCUS);
211 }
212
213 if (definition->draw_function)
214 {
215 gx_widget_draw_set(widget, definition->draw_function);
216 }
217 if (definition->event_function)
218 {
219 gx_widget_event_process_set(widget, definition->event_function);
220 }
221
222 #if defined(GX_WIDGET_USER_DATA)
223 widget->gx_widget_user_data = definition->user_data;
224 #endif
225
226 if (definition->child_widget)
227 {
228 gx_studio_nested_widget_create(control, definition->child_widget, widget);
229 }
230 }
231 definition = definition->next_widget;
232 }
233 }
234 return widget;
235 }
236
gx_studio_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)237 GX_WIDGET *gx_studio_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
238 {
239 GX_WIDGET *widget;
240 widget = gx_studio_nested_widget_create(control, definition, GX_NULL);
241
242 if (parent && widget)
243 {
244 gx_widget_attach(parent, widget);
245 }
246 return widget;
247 }
248
gx_studio_named_widget_create(char * name,GX_WIDGET * parent,GX_WIDGET ** new_widget)249 UINT gx_studio_named_widget_create(char *name, GX_WIDGET *parent, GX_WIDGET **new_widget)
250 {
251 UINT status = GX_FAILURE;
252 GX_CONST GX_STUDIO_WIDGET_ENTRY *entry = jpeg_draw_16bpp_widget_table;
253 GX_WIDGET *widget = GX_NULL;
254
255 while(entry->widget_information)
256 {
257 if (!strcmp(name, entry->widget_information->widget_name))
258 {
259 widget = gx_studio_widget_create((GX_BYTE *) entry->widget, entry->widget_information, parent);
260 if (widget)
261 {
262 status = GX_SUCCESS;
263 }
264 break;
265 }
266 entry++;
267 }
268
269 if (new_widget)
270 {
271 *new_widget = widget;
272 }
273 return status;
274 }
275
276
gx_studio_display_configure(USHORT display,UINT (* driver)(GX_DISPLAY *),GX_UBYTE language,USHORT theme,GX_WINDOW_ROOT ** return_root)277 UINT gx_studio_display_configure(USHORT display, UINT (*driver)(GX_DISPLAY *),
278 GX_UBYTE language, USHORT theme, GX_WINDOW_ROOT **return_root)
279 {
280 GX_CONST GX_THEME *theme_ptr;
281 GX_RECTANGLE size;
282
283 GX_STUDIO_DISPLAY_INFO *display_info = &jpeg_draw_16bpp_display_table[display];
284
285
286 /* create the requested display */
287
288 gx_display_create(display_info->display,
289 display_info->name,
290 driver,
291 (GX_VALUE) display_info->x_resolution,
292 (GX_VALUE) display_info->y_resolution);
293
294
295 /* install the request theme */
296
297 if(display_info->theme_table)
298 {
299 theme_ptr = display_info->theme_table[theme];
300 if(theme_ptr)
301 {
302 gx_display_color_table_set(display_info->display, theme_ptr->theme_color_table, theme_ptr->theme_color_table_size);
303
304 /* install the color palette if required */
305 if (display_info->display->gx_display_driver_palette_set &&
306 theme_ptr->theme_palette != NULL)
307 {
308 display_info->display->gx_display_driver_palette_set(display_info->display, theme_ptr->theme_palette, theme_ptr->theme_palette_size);
309 }
310
311 gx_display_font_table_set(display_info->display, theme_ptr->theme_font_table, theme_ptr->theme_font_table_size);
312 gx_display_pixelmap_table_set(display_info->display, theme_ptr->theme_pixelmap_table, theme_ptr->theme_pixelmap_table_size);
313 gx_system_scroll_appearance_set(theme_ptr->theme_vertical_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_vertical_scrollbar_appearance);
314 gx_system_scroll_appearance_set(theme_ptr->theme_horizontal_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_horizontal_scrollbar_appearance);
315 }
316 }
317
318 /* Install the language table. */
319
320 if(display_info->language_table)
321 {
322 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);
323 gx_display_active_language_set(display_info->display, language);
324 }
325
326 /* Set screen rotation angle. */
327
328 display_info->display->gx_display_rotation_angle = display_info->rotation_angle;
329
330 /* create the canvas for this display */
331
332 gx_canvas_create(display_info->canvas,
333 display_info->canvas_name,
334 display_info->display,
335 GX_CANVAS_MANAGED | GX_CANVAS_VISIBLE,
336 display_info->x_resolution,
337 display_info->y_resolution,
338 display_info->canvas_memory,
339 display_info->canvas_memory_size);
340
341 /* Create the root window for this canvas */
342
343 gx_utility_rectangle_define(&size,
344 0, 0,
345 (GX_VALUE) (display_info->x_resolution - 1),
346 (GX_VALUE) (display_info->y_resolution - 1));
347
348 gx_window_root_create(display_info->root_window,
349 display_info->name,
350 display_info->canvas, GX_STYLE_NONE, 0, &size);
351 if (return_root)
352 {
353 *return_root = display_info->root_window;
354 }
355 return GX_SUCCESS;
356 }
357 #undef GUIX_STUDIO_GENERATED_FILE
358