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.3.0.0 */
9 /* Date (dd.mm.yyyy): 24.11.2023 Time (hh:mm): 16:56 */
10 /*******************************************************************************/
11
12
13 #define GUIX_STUDIO_GENERATED_FILE
14 #include <stddef.h>
15 #include "mcu_rx_resources.h"
16 #include "mcu_rx_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 WINDOW_CONTROL_BLOCK 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[38400];
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 mcu_rx_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 240, /* x resolution */
39 320, /* 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 153600, /* canvas memory size in bytes */
45 GX_SCREEN_ROTATION_CW /* 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 window_properties =
66 {
67 0 /* wallpaper pixelmap id */
68 };
69 GX_WINDOW_PROPERTIES window_window_1_properties =
70 {
71 0 /* wallpaper pixelmap id */
72 };
73
74 GX_CONST GX_STUDIO_WIDGET window_window_1_define =
75 {
76 "window_1",
77 GX_TYPE_WINDOW, /* widget type */
78 GX_ID_NONE, /* widget id */
79 #if defined(GX_WIDGET_USER_DATA)
80 0, /* user data */
81 #endif
82 GX_STYLE_BORDER_THIN|GX_STYLE_ENABLED, /* style flags */
83 GX_STATUS_ACCEPTS_FOCUS, /* status flags */
84 sizeof(GX_WINDOW), /* control block size */
85 GX_COLOR_ID_CANVAS, /* normal color id */
86 GX_COLOR_ID_WINDOW_FILL, /* selected color id */
87 GX_COLOR_ID_DISABLED_FILL, /* disabled color id */
88 gx_studio_window_create, /* create function */
89 GX_NULL, /* drawing function override */
90 GX_NULL, /* event function override */
91 {80, 60, 239, 179}, /* widget size */
92 GX_NULL, /* no next widget */
93 GX_NULL, /* no child widgets */
94 offsetof(WINDOW_CONTROL_BLOCK, window_window_1), /* control block */
95 (void *) &window_window_1_properties /* extended properties */
96 };
97
98 GX_CONST GX_STUDIO_WIDGET window_define =
99 {
100 "window",
101 GX_TYPE_WINDOW, /* widget type */
102 GX_ID_NONE, /* widget id */
103 #if defined(GX_WIDGET_USER_DATA)
104 0, /* user data */
105 #endif
106 GX_STYLE_BORDER_THIN|GX_STYLE_ENABLED, /* style flags */
107 GX_STATUS_ACCEPTS_FOCUS, /* status flags */
108 sizeof(WINDOW_CONTROL_BLOCK), /* control block size */
109 GX_COLOR_ID_WINDOW_FILL, /* normal color id */
110 GX_COLOR_ID_WINDOW_FILL, /* selected color id */
111 GX_COLOR_ID_DISABLED_FILL, /* disabled color id */
112 gx_studio_window_create, /* create function */
113 GX_NULL, /* drawing function override */
114 GX_NULL, /* event function override */
115 {0, 0, 319, 239}, /* widget size */
116 GX_NULL, /* next widget */
117 &window_window_1_define, /* child widget */
118 0, /* control block */
119 (void *) &window_properties /* extended properties */
120 };
121 GX_CONST GX_STUDIO_WIDGET_ENTRY mcu_rx_widget_table[] =
122 {
123 { &window_define, (GX_WIDGET *) &window },
124 {GX_NULL, GX_NULL}
125 };
126
gx_studio_nested_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)127 static GX_WIDGET *gx_studio_nested_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
128 {
129 UINT status = GX_SUCCESS;
130 GX_WIDGET *widget = GX_NULL;
131 GX_VALUE list_count = 0;
132 GX_VALUE list_total_count = 0;
133
134 if(parent && (parent->gx_widget_type == GX_TYPE_MENU))
135 {
136 list_total_count = ((GX_MENU *)parent)->gx_menu_list_total_count;
137 }
138
139 while(definition && status == GX_SUCCESS)
140 {
141 if (definition->create_function)
142 {
143 if (definition->style & GX_STYLE_DYNAMICALLY_ALLOCATED)
144 {
145 status = gx_widget_allocate(&widget, definition->control_block_size);
146 if (status != GX_SUCCESS)
147 {
148 return GX_NULL;
149 }
150 }
151 else
152 {
153 if (control == GX_NULL)
154 {
155 return GX_NULL;
156 }
157 widget = (GX_WIDGET *) (control + definition->control_block_offset);
158 }
159
160 status = definition->create_function(definition, widget, parent);
161
162 if(list_count < list_total_count)
163 {
164 gx_menu_insert((GX_MENU *)parent, widget);
165 ((GX_MENU *)parent)->gx_menu_list_total_count--;
166 list_count++;
167 }
168
169 if (status == GX_SUCCESS)
170 {
171 if (definition->widget_type != GX_TYPE_TEMPLATE)
172 {
173 #if defined(GUIX_5_4_0_COMPATIBILITY)
174 gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id);
175 #else
176 gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id, definition->disabled_fill_color_id);
177 #endif
178 }
179
180 if (!(definition->status & GX_STATUS_ACCEPTS_FOCUS))
181 {
182 gx_widget_status_remove(widget, GX_STATUS_ACCEPTS_FOCUS);
183 }
184
185 if (definition->draw_function)
186 {
187 gx_widget_draw_set(widget, definition->draw_function);
188 }
189 if (definition->event_function)
190 {
191 gx_widget_event_process_set(widget, definition->event_function);
192 }
193
194 #if defined(GX_WIDGET_USER_DATA)
195 widget->gx_widget_user_data = definition->user_data;
196 #endif
197
198 if (definition->child_widget)
199 {
200 gx_studio_nested_widget_create(control, definition->child_widget, widget);
201 }
202 }
203 definition = definition->next_widget;
204 }
205 }
206 return widget;
207 }
208
gx_studio_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)209 GX_WIDGET *gx_studio_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
210 {
211 GX_WIDGET *widget;
212 widget = gx_studio_nested_widget_create(control, definition, GX_NULL);
213
214 if (parent && widget)
215 {
216 gx_widget_attach(parent, widget);
217 }
218 return widget;
219 }
220
gx_studio_named_widget_create(char * name,GX_WIDGET * parent,GX_WIDGET ** new_widget)221 UINT gx_studio_named_widget_create(char *name, GX_WIDGET *parent, GX_WIDGET **new_widget)
222 {
223 UINT status = GX_FAILURE;
224 GX_CONST GX_STUDIO_WIDGET_ENTRY *entry = mcu_rx_widget_table;
225 GX_WIDGET *widget = GX_NULL;
226
227 while(entry->widget_information)
228 {
229 if (!strcmp(name, entry->widget_information->widget_name))
230 {
231 widget = gx_studio_widget_create((GX_BYTE *) entry->widget, entry->widget_information, parent);
232 if (widget)
233 {
234 status = GX_SUCCESS;
235 }
236 break;
237 }
238 entry++;
239 }
240
241 if (new_widget)
242 {
243 *new_widget = widget;
244 }
245 return status;
246 }
247
248
gx_studio_display_configure(USHORT display,UINT (* driver)(GX_DISPLAY *),GX_UBYTE language,USHORT theme,GX_WINDOW_ROOT ** return_root)249 UINT gx_studio_display_configure(USHORT display, UINT (*driver)(GX_DISPLAY *),
250 GX_UBYTE language, USHORT theme, GX_WINDOW_ROOT **return_root)
251 {
252 GX_CONST GX_THEME *theme_ptr;
253 GX_RECTANGLE size;
254
255 GX_STUDIO_DISPLAY_INFO *display_info = &mcu_rx_display_table[display];
256
257
258 /* create the requested display */
259
260 gx_display_create(display_info->display,
261 display_info->name,
262 driver,
263 (GX_VALUE) display_info->x_resolution,
264 (GX_VALUE) display_info->y_resolution);
265
266
267 /* install the request theme */
268
269 if(display_info->theme_table)
270 {
271 theme_ptr = display_info->theme_table[theme];
272 if(theme_ptr)
273 {
274 gx_display_color_table_set(display_info->display, theme_ptr->theme_color_table, theme_ptr->theme_color_table_size);
275
276 /* install the color palette if required */
277 if (display_info->display->gx_display_driver_palette_set &&
278 theme_ptr->theme_palette != NULL)
279 {
280 display_info->display->gx_display_driver_palette_set(display_info->display, theme_ptr->theme_palette, theme_ptr->theme_palette_size);
281 }
282
283 gx_display_font_table_set(display_info->display, theme_ptr->theme_font_table, theme_ptr->theme_font_table_size);
284 gx_display_pixelmap_table_set(display_info->display, theme_ptr->theme_pixelmap_table, theme_ptr->theme_pixelmap_table_size);
285 gx_system_scroll_appearance_set(theme_ptr->theme_vertical_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_vertical_scrollbar_appearance);
286 gx_system_scroll_appearance_set(theme_ptr->theme_horizontal_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_horizontal_scrollbar_appearance);
287 }
288 }
289
290 /* Install the language table. */
291
292 if(display_info->language_table)
293 {
294 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);
295 gx_display_active_language_set(display_info->display, language);
296 }
297
298 /* Set screen rotation angle. */
299
300 display_info->display->gx_display_rotation_angle = display_info->rotation_angle;
301
302 /* create the canvas for this display */
303
304 gx_canvas_create(display_info->canvas,
305 display_info->canvas_name,
306 display_info->display,
307 GX_CANVAS_MANAGED | GX_CANVAS_VISIBLE,
308 display_info->x_resolution,
309 display_info->y_resolution,
310 display_info->canvas_memory,
311 display_info->canvas_memory_size);
312
313 /* Create the root window for this canvas */
314
315 gx_utility_rectangle_define(&size,
316 0, 0,
317 (GX_VALUE) (display_info->x_resolution - 1),
318 (GX_VALUE) (display_info->y_resolution - 1));
319
320 gx_window_root_create(display_info->root_window,
321 display_info->name,
322 display_info->canvas, GX_STYLE_NONE, 0, &size);
323 if (return_root)
324 {
325 *return_root = display_info->root_window;
326 }
327 return GX_SUCCESS;
328 }
329
330 /* Provide display driver setup function */
331
332 #if defined(GX_TARGET_WIN32) || defined(GX_TARGET_LINUX)
333
_gx_rx_display_driver_setup(GX_DISPLAY * display)334 UINT _gx_rx_display_driver_setup(GX_DISPLAY *display)
335 {
336 win32_dave2d_graphics_driver_setup_565rgb_rotated(display);
337 return GX_SUCCESS;
338 }
339 #else
_gx_rx_display_driver_setup(GX_DISPLAY * display)340 UINT _gx_rx_display_driver_setup(GX_DISPLAY *display)
341 {
342 _gx_display_driver_565rgb_rotated_setup(display, GX_NULL, _gx_dave2d_rotated_buffer_toggle);
343 display->gx_display_handle = 0;
344 display -> gx_display_driver_horizontal_pattern_line_draw = _gx_dave2d_rotated_horizontal_pattern_line_draw_565;
345 display -> gx_display_driver_vertical_pattern_line_draw = _gx_dave2d_rotated_vertical_pattern_line_draw_565;
346 display -> gx_display_driver_pixel_write = _gx_dave2d_rotated_pixel_write_565;
347 display -> gx_display_driver_pixel_blend = _gx_dave2d_rotated_pixel_blend_565;
348 display -> gx_display_driver_pixelmap_rotate = _gx_dave2d_rotated_pixelmap_rotate_16bpp;
349 display -> gx_display_driver_drawing_initiate = _gx_dave2d_rotated_drawing_initiate;
350 display -> gx_display_driver_drawing_complete = _gx_dave2d_rotated_drawing_complete;
351 display -> gx_display_driver_canvas_copy = _gx_dave2d_rotated_canvas_copy;
352 display -> gx_display_driver_canvas_blend = _gx_dave2d_rotated_canvas_blend;
353 display -> gx_display_driver_simple_line_draw = _gx_dave2d_rotated_simple_line_draw;
354 display -> gx_display_driver_horizontal_line_draw = _gx_dave2d_rotated_horizontal_line;
355 display -> gx_display_driver_vertical_line_draw = _gx_dave2d_rotated_vertical_line;
356 display -> gx_display_driver_polygon_draw = _gx_dave2d_rotated_polygon_draw;
357 display -> gx_display_driver_polygon_fill = _gx_dave2d_rotated_polygon_fill;
358 display -> gx_display_driver_block_move = _gx_dave2d_rotated_block_move;
359 display -> gx_display_driver_pixelmap_draw = _gx_dave2d_rotated_pixelmap_draw;
360 display -> gx_display_driver_horizontal_pixelmap_line_draw = _gx_dave2d_rotated_horizontal_pixelmap_line_draw;
361 display -> gx_display_driver_alphamap_draw = _gx_dave2d_rotated_alphamap_draw;
362 display -> gx_display_driver_simple_wide_line_draw = _gx_dave2d_rotated_simple_wide_line;
363 display -> gx_display_driver_anti_aliased_line_draw = _gx_dave2d_rotated_aliased_line;
364 display -> gx_display_driver_anti_aliased_wide_line_draw = _gx_dave2d_rotated_aliased_wide_line;
365 display -> gx_display_driver_pixelmap_blend = _gx_dave2d_rotated_pixelmap_blend;
366 display -> gx_display_driver_8bit_glyph_draw = _gx_dave2d_rotated_raw_glyph_8bit_draw;
367 display -> gx_display_driver_4bit_glyph_draw = _gx_dave2d_rotated_raw_glyph_4bit_draw;
368 display -> gx_display_driver_1bit_glyph_draw = _gx_dave2d_rotated_raw_glyph_1bit_draw;
369 display -> gx_display_driver_8bit_compressed_glyph_draw = _gx_dave2d_rotated_compressed_glyph_8bit_draw;
370 display -> gx_display_driver_4bit_compressed_glyph_draw = _gx_dave2d_rotated_compressed_glyph_4bit_draw;
371 display -> gx_display_driver_1bit_compressed_glyph_draw = _gx_dave2d_rotated_compressed_glyph_1bit_draw;
372 #if defined(GX_ARC_DRAWING_SUPPORT)
373 display -> gx_display_driver_anti_aliased_circle_draw = _gx_dave2d_rotated_aliased_circle_draw;
374 display -> gx_display_driver_anti_aliased_wide_circle_draw = _gx_dave2d_rotated_aliased_circle_draw;
375 display -> gx_display_driver_circle_draw = _gx_dave2d_rotated_circle_draw;
376 display -> gx_display_driver_circle_fill = _gx_dave2d_rotated_circle_fill;
377 display -> gx_display_driver_pie_fill = _gx_dave2d_rotated_pie_fill;
378 display -> gx_display_driver_anti_aliased_arc_draw = _gx_dave2d_rotated_aliased_arc_draw;
379 display -> gx_display_driver_arc_draw = _gx_dave2d_rotated_arc_draw;
380 display -> gx_display_driver_arc_fill = _gx_dave2d_rotated_arc_fill;
381 display -> gx_display_driver_anti_aliased_ellipse_draw = _gx_dave2d_rotated_aliased_ellipse_draw;
382 display -> gx_display_driver_ellipse_draw = _gx_dave2d_rotated_ellipse_draw;
383 display -> gx_display_driver_ellipse_fill = _gx_dave2d_rotated_ellipse_fill;
384 display -> gx_display_driver_wide_circle_draw = _gx_dave2d_rotated_circle_draw;
385 display -> gx_display_driver_anti_aliased_wide_arc_draw = _gx_dave2d_rotated_aliased_arc_draw;
386 display -> gx_display_driver_wide_arc_draw = _gx_dave2d_rotated_arc_draw;
387 display -> gx_display_driver_anti_aliased_wide_ellipse_draw= _gx_dave2d_rotated_aliased_ellipse_draw;
388 display -> gx_display_driver_wide_ellipse_draw = _gx_dave2d_rotated_ellipse_draw;
389 #endif
390 return GX_SUCCESS;
391 }
392 #endif
393 #undef GUIX_STUDIO_GENERATED_FILE
394