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:10                        */
10 /*******************************************************************************/
11 
12 
13 #define GUIX_STUDIO_GENERATED_FILE
14 #include <stddef.h>
15 #include "lines_8bpp_resources.h"
16 #include "lines_8bpp_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[56320];
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 lines_8bpp_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     640,                                     /* x resolution                   */
39     352,                                     /* 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     225280,                                  /* 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_prompt_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)108 UINT gx_studio_prompt_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
109 {
110     UINT status;
111     GX_PROMPT *prompt = (GX_PROMPT *) control_block;
112     GX_PROMPT_PROPERTIES *props = (GX_PROMPT_PROPERTIES *) info->properties;
113     status = gx_prompt_create(prompt, info->widget_name, parent, props->string_id, info->style, info->widget_id, &info->size);
114     if (status == GX_SUCCESS)
115     {
116         gx_prompt_font_set(prompt, props->font_id);
117 #if defined(GUIX_5_4_0_COMPATIBILITY)
118         gx_prompt_text_color_set(prompt, props->normal_text_color_id, props->selected_text_color_id);
119 #else
120         gx_prompt_text_color_set(prompt, props->normal_text_color_id, props->selected_text_color_id, props->disabled_text_color_id);
121 #endif
122     }
123     return status;
124 }
125 
gx_studio_window_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)126 UINT gx_studio_window_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
127 {
128     UINT status;
129     GX_WINDOW *window = (GX_WINDOW *) control_block;
130     GX_WINDOW_PROPERTIES *props = (GX_WINDOW_PROPERTIES *) info->properties;
131     status = gx_window_create(window, info->widget_name, parent, info->style, info->widget_id, &info->size);
132     if (status == GX_SUCCESS)
133     {
134         if (props->wallpaper_id)
135         {
136             gx_window_wallpaper_set(window, props->wallpaper_id, info->style & GX_STYLE_TILE_WALLPAPER);
137         }
138     }
139     return status;
140 }
141 
gx_studio_drop_list_create(GX_CONST GX_STUDIO_WIDGET * info,GX_WIDGET * control_block,GX_WIDGET * parent)142 UINT gx_studio_drop_list_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
143 {
144     UINT status;
145     GX_DROP_LIST *list = (GX_DROP_LIST *) control_block;
146     GX_DROP_LIST_PROPERTIES *props = (GX_DROP_LIST_PROPERTIES *) info->properties;
147     status = gx_drop_list_create(list, info->widget_name, parent,
148                                  props->total_rows, props->open_height,
149                                  props->callback, info->style, info->widget_id, &info->size);
150     if (status == GX_SUCCESS)
151     {
152         if (props->pixelmap_id)
153         {
154             gx_drop_list_pixelmap_set(list, props->pixelmap_id);
155         }
156         if (props->wallpaper_id)
157         {
158             gx_window_wallpaper_set((GX_WINDOW *)&list->gx_drop_list_popup.gx_popup_list_list, props->wallpaper_id, info->style & GX_STYLE_TILE_WALLPAPER);
159         }
160     }
161     return status;
162 }
163 GX_WINDOW_PROPERTIES main_window_properties =
164 {
165     0                                        /* wallpaper pixelmap id          */
166 };
167 GX_PROMPT_PROPERTIES main_window_prompt_1_properties =
168 {
169     GX_STRING_ID_STRING_2,                   /* string id                      */
170     GX_FONT_ID_PROMPT,                       /* font id                        */
171     GX_COLOR_ID_TEXT,                        /* normal text color              */
172     GX_COLOR_ID_SELECTED_TEXT,               /* selected text color            */
173     GX_COLOR_ID_TEXT                         /* disabled text color            */
174 };
175 GX_SLIDER_PROPERTIES main_window_line_width_slider_properties =
176 {
177     10,                                      /* tickmark count                 */
178     1,                                       /* mimimun value                  */
179     10,                                      /* maximum value                  */
180     1,                                       /* current value                  */
181     10,                                      /* increment                      */
182     10,                                      /* minimum travel                 */
183     10,                                      /* maximum travel                 */
184     5,                                       /* needle width                   */
185     14,                                      /* needle height                  */
186     5,                                       /* needle inset                   */
187     1                                        /* needle hotspot                 */
188 };
189 GX_PROMPT_PROPERTIES main_window_prompt_2_properties =
190 {
191     GX_STRING_ID_STRING_5,                   /* string id                      */
192     GX_FONT_ID_PROMPT,                       /* font id                        */
193     GX_COLOR_ID_TEXT,                        /* normal text color              */
194     GX_COLOR_ID_SELECTED_TEXT,               /* selected text color            */
195     GX_COLOR_ID_TEXT                         /* disabled text color            */
196 };
197 GX_SLIDER_PROPERTIES main_window_line_angle_slider_properties =
198 {
199     10,                                      /* tickmark count                 */
200     0,                                       /* mimimun value                  */
201     360,                                     /* maximum value                  */
202     0,                                       /* current value                  */
203     10,                                      /* increment                      */
204     10,                                      /* minimum travel                 */
205     10,                                      /* maximum travel                 */
206     5,                                       /* needle width                   */
207     14,                                      /* needle height                  */
208     5,                                       /* needle inset                   */
209     1                                        /* needle hotspot                 */
210 };
211 GX_PROMPT_PROPERTIES main_window_width_display_properties =
212 {
213     GX_STRING_ID_STRING_12,                  /* string id                      */
214     GX_FONT_ID_PROMPT,                       /* font id                        */
215     GX_COLOR_ID_WHITE,                       /* normal text color              */
216     GX_COLOR_ID_WHITE,                       /* selected text color            */
217     GX_COLOR_ID_WHITE                        /* disabled text color            */
218 };
219 GX_PROMPT_PROPERTIES main_window_angle_display_properties =
220 {
221     GX_STRING_ID_STRING_11,                  /* string id                      */
222     GX_FONT_ID_PROMPT,                       /* font id                        */
223     GX_COLOR_ID_WHITE,                       /* normal text color              */
224     GX_COLOR_ID_WHITE,                       /* selected text color            */
225     GX_COLOR_ID_WHITE                        /* disabled text color            */
226 };
227 GX_CHECKBOX_PROPERTIES main_window_aa_box_properties =
228 {
229     GX_STRING_ID_STRING_8,                   /* string id                      */
230     GX_FONT_ID_BUTTON,                       /* font id                        */
231     GX_COLOR_ID_BTN_TEXT,                    /* normal text color              */
232     GX_COLOR_ID_BTN_TEXT,                    /* selected text color            */
233     GX_COLOR_ID_BTN_TEXT,                    /* disabled text color            */
234     0,                                       /* unchecked pixelmap id          */
235     0,                                       /* checked pixelmap id            */
236     0,                                       /* unchecked disabled pixelmap id */
237     0                                        /* checked disabled pixelmap id   */
238 };
239 GX_CHECKBOX_PROPERTIES main_window_rounded_box_properties =
240 {
241     GX_STRING_ID_STRING_9,                   /* string id                      */
242     GX_FONT_ID_BUTTON,                       /* font id                        */
243     GX_COLOR_ID_BTN_TEXT,                    /* normal text color              */
244     GX_COLOR_ID_BTN_TEXT,                    /* selected text color            */
245     GX_COLOR_ID_BTN_TEXT,                    /* disabled text color            */
246     0,                                       /* unchecked pixelmap id          */
247     0,                                       /* checked pixelmap id            */
248     0,                                       /* unchecked disabled pixelmap id */
249     0                                        /* checked disabled pixelmap id   */
250 };
251 GX_WINDOW_PROPERTIES main_window_line_window_properties =
252 {
253     0                                        /* wallpaper pixelmap id          */
254 };
255 GX_PROMPT_PROPERTIES main_window_color_label_properties =
256 {
257     GX_STRING_ID_STRING_10,                  /* string id                      */
258     GX_FONT_ID_PROMPT,                       /* font id                        */
259     GX_COLOR_ID_TEXT,                        /* normal text color              */
260     GX_COLOR_ID_SELECTED_TEXT,               /* selected text color            */
261     GX_COLOR_ID_TEXT                         /* disabled text color            */
262 };
263 GX_DROP_LIST_PROPERTIES main_window_color_list_properties =
264 {
265     0,                                       /* widget pixelmap id             */
266     0,                                       /* popup list wallpaper pixelmap id */
267     drop_list_color_create,                  /* callback function              */
268     5,                                       /* total rows                     */
269     100                                      /* open height                    */
270 };
271 
272 GX_CONST GX_STUDIO_WIDGET main_window_color_list_define =
273 {
274     "color_list",
275     GX_TYPE_DROP_LIST,                       /* widget type                    */
276     ID_COLOR_LIST,                           /* widget id                      */
277     #if defined(GX_WIDGET_USER_DATA)
278     0,                                       /* user data                      */
279     #endif
280     GX_STYLE_BORDER_THIN,                    /* style flags                    */
281     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
282     sizeof(GX_DROP_LIST),                    /* control block size             */
283     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
284     GX_COLOR_ID_WIDGET_FILL,                 /* selected color id              */
285     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
286     gx_studio_drop_list_create,              /* create function                */
287     GX_NULL,                                 /* drawing function override      */
288     GX_NULL,                                 /* event function override        */
289     {458, 166, 627, 189},                    /* widget size                    */
290     GX_NULL,                                 /* no next widget                 */
291     GX_NULL,                                 /* no child widgets               */
292     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_color_list), /* control block */
293     (void *) &main_window_color_list_properties /* extended properties         */
294 };
295 
296 GX_CONST GX_STUDIO_WIDGET main_window_color_label_define =
297 {
298     "color_label",
299     GX_TYPE_PROMPT,                          /* widget type                    */
300     GX_ID_NONE,                              /* widget id                      */
301     #if defined(GX_WIDGET_USER_DATA)
302     0,                                       /* user data                      */
303     #endif
304     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_TEXT_LEFT,   /* style flags */
305     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
306     sizeof(GX_PROMPT),                       /* control block size             */
307     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
308     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
309     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
310     gx_studio_prompt_create,                 /* create function                */
311     GX_NULL,                                 /* drawing function override      */
312     GX_NULL,                                 /* event function override        */
313     {363, 167, 463, 184},                    /* widget size                    */
314     &main_window_color_list_define,          /* next widget definition         */
315     GX_NULL,                                 /* no child widgets               */
316     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_color_label), /* control block */
317     (void *) &main_window_color_label_properties /* extended properties        */
318 };
319 
320 GX_CONST GX_STUDIO_WIDGET main_window_line_window_define =
321 {
322     "line_window",
323     GX_TYPE_WINDOW,                          /* widget type                    */
324     ID_LINE_WINDOW,                          /* widget id                      */
325     #if defined(GX_WIDGET_USER_DATA)
326     0,                                       /* user data                      */
327     #endif
328     GX_STYLE_BORDER_THIN,                    /* style flags                    */
329     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
330     sizeof(GX_WINDOW),                       /* control block size             */
331     GX_COLOR_ID_SELECTED_FILL,               /* normal color id                */
332     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
333     GX_COLOR_ID_SELECTED_FILL,               /* disabled color id              */
334     gx_studio_window_create,                 /* create function                */
335     (VOID (*)(GX_WIDGET *)) line_win_draw,   /* drawing function override      */
336     GX_NULL,                                 /* event function override        */
337     {25, 14, 344, 333},                      /* widget size                    */
338     &main_window_color_label_define,         /* next widget definition         */
339     GX_NULL,                                 /* no child widgets               */
340     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_line_window), /* control block */
341     (void *) &main_window_line_window_properties /* extended properties        */
342 };
343 
344 GX_CONST GX_STUDIO_WIDGET main_window_rounded_box_define =
345 {
346     "rounded_box",
347     GX_TYPE_CHECKBOX,                        /* widget type                    */
348     ID_ROUNDED,                              /* widget id                      */
349     #if defined(GX_WIDGET_USER_DATA)
350     0,                                       /* user data                      */
351     #endif
352     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_BUTTON_TOGGLE|GX_STYLE_TEXT_LEFT,   /* style flags */
353     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
354     sizeof(GX_CHECKBOX),                     /* control block size             */
355     GX_COLOR_ID_BTN_LOWER,                   /* normal color id                */
356     GX_COLOR_ID_BTN_UPPER,                   /* selected color id              */
357     GX_COLOR_ID_BTN_LOWER,                   /* disabled color id              */
358     gx_studio_checkbox_create,               /* create function                */
359     GX_NULL,                                 /* drawing function override      */
360     GX_NULL,                                 /* event function override        */
361     {363, 125, 486, 151},                    /* widget size                    */
362     &main_window_line_window_define,         /* next widget definition         */
363     GX_NULL,                                 /* no child widgets               */
364     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_rounded_box), /* control block */
365     (void *) &main_window_rounded_box_properties /* extended properties        */
366 };
367 
368 GX_CONST GX_STUDIO_WIDGET main_window_aa_box_define =
369 {
370     "aa_box",
371     GX_TYPE_CHECKBOX,                        /* widget type                    */
372     ID_ANTI_ALIASED,                         /* widget id                      */
373     #if defined(GX_WIDGET_USER_DATA)
374     0,                                       /* user data                      */
375     #endif
376     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_BUTTON_TOGGLE|GX_STYLE_TEXT_LEFT,   /* style flags */
377     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
378     sizeof(GX_CHECKBOX),                     /* control block size             */
379     GX_COLOR_ID_BTN_LOWER,                   /* normal color id                */
380     GX_COLOR_ID_BTN_UPPER,                   /* selected color id              */
381     GX_COLOR_ID_BTN_LOWER,                   /* disabled color id              */
382     gx_studio_checkbox_create,               /* create function                */
383     GX_NULL,                                 /* drawing function override      */
384     GX_NULL,                                 /* event function override        */
385     {363, 93, 505, 119},                     /* widget size                    */
386     &main_window_rounded_box_define,         /* next widget definition         */
387     GX_NULL,                                 /* no child widgets               */
388     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_aa_box), /* control block  */
389     (void *) &main_window_aa_box_properties  /* extended properties            */
390 };
391 
392 GX_CONST GX_STUDIO_WIDGET main_window_angle_display_define =
393 {
394     "angle_display",
395     GX_TYPE_PROMPT,                          /* widget type                    */
396     ID_ANGLE_DISPLAY,                        /* widget id                      */
397     #if defined(GX_WIDGET_USER_DATA)
398     0,                                       /* user data                      */
399     #endif
400     GX_STYLE_BORDER_RECESSED|GX_STYLE_ENABLED|GX_STYLE_TEXT_RIGHT,   /* style flags */
401     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
402     sizeof(GX_PROMPT),                       /* control block size             */
403     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
404     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
405     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
406     gx_studio_prompt_create,                 /* create function                */
407     GX_NULL,                                 /* drawing function override      */
408     GX_NULL,                                 /* event function override        */
409     {586, 43, 625, 68},                      /* widget size                    */
410     &main_window_aa_box_define,              /* next widget definition         */
411     GX_NULL,                                 /* no child widgets               */
412     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_angle_display), /* control block */
413     (void *) &main_window_angle_display_properties /* extended properties      */
414 };
415 
416 GX_CONST GX_STUDIO_WIDGET main_window_width_display_define =
417 {
418     "width_display",
419     GX_TYPE_PROMPT,                          /* widget type                    */
420     ID_WIDTH_DISPLAY,                        /* widget id                      */
421     #if defined(GX_WIDGET_USER_DATA)
422     0,                                       /* user data                      */
423     #endif
424     GX_STYLE_BORDER_RECESSED|GX_STYLE_ENABLED|GX_STYLE_TEXT_RIGHT,   /* style flags */
425     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
426     sizeof(GX_PROMPT),                       /* control block size             */
427     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
428     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
429     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
430     gx_studio_prompt_create,                 /* create function                */
431     GX_NULL,                                 /* drawing function override      */
432     GX_NULL,                                 /* event function override        */
433     {586, 10, 625, 35},                      /* widget size                    */
434     &main_window_angle_display_define,       /* next widget definition         */
435     GX_NULL,                                 /* no child widgets               */
436     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_width_display), /* control block */
437     (void *) &main_window_width_display_properties /* extended properties      */
438 };
439 
440 GX_CONST GX_STUDIO_WIDGET main_window_line_angle_slider_define =
441 {
442     "line_angle_slider",
443     GX_TYPE_SLIDER,                          /* widget type                    */
444     ID_LINE_ANGLE,                           /* widget id                      */
445     #if defined(GX_WIDGET_USER_DATA)
446     0,                                       /* user data                      */
447     #endif
448     GX_STYLE_BORDER_RAISED|GX_STYLE_ENABLED|GX_STYLE_SHOW_NEEDLE|GX_STYLE_SHOW_TICKMARKS,   /* style flags */
449     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
450     sizeof(GX_SLIDER),                       /* control block size             */
451     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
452     GX_COLOR_ID_WIDGET_FILL,                 /* selected color id              */
453     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
454     gx_studio_slider_create,                 /* create function                */
455     GX_NULL,                                 /* drawing function override      */
456     GX_NULL,                                 /* event function override        */
457     {464, 45, 580, 68},                      /* widget size                    */
458     &main_window_width_display_define,       /* next widget definition         */
459     GX_NULL,                                 /* no child widgets               */
460     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_line_angle_slider), /* control block */
461     (void *) &main_window_line_angle_slider_properties /* extended properties  */
462 };
463 
464 GX_CONST GX_STUDIO_WIDGET main_window_prompt_2_define =
465 {
466     "prompt_2",
467     GX_TYPE_PROMPT,                          /* widget type                    */
468     GX_ID_NONE,                              /* widget id                      */
469     #if defined(GX_WIDGET_USER_DATA)
470     0,                                       /* user data                      */
471     #endif
472     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_TEXT_LEFT,   /* style flags */
473     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
474     sizeof(GX_PROMPT),                       /* control block size             */
475     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
476     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
477     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
478     gx_studio_prompt_create,                 /* create function                */
479     GX_NULL,                                 /* drawing function override      */
480     GX_NULL,                                 /* event function override        */
481     {363, 49, 458, 66},                      /* widget size                    */
482     &main_window_line_angle_slider_define,   /* next widget definition         */
483     GX_NULL,                                 /* no child widgets               */
484     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_prompt_2), /* control block */
485     (void *) &main_window_prompt_2_properties /* extended properties           */
486 };
487 
488 GX_CONST GX_STUDIO_WIDGET main_window_line_width_slider_define =
489 {
490     "line_width_slider",
491     GX_TYPE_SLIDER,                          /* widget type                    */
492     ID_LINE_WIDTH,                           /* widget id                      */
493     #if defined(GX_WIDGET_USER_DATA)
494     0,                                       /* user data                      */
495     #endif
496     GX_STYLE_BORDER_RAISED|GX_STYLE_ENABLED|GX_STYLE_SHOW_NEEDLE|GX_STYLE_SHOW_TICKMARKS,   /* style flags */
497     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
498     sizeof(GX_SLIDER),                       /* control block size             */
499     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
500     GX_COLOR_ID_WIDGET_FILL,                 /* selected color id              */
501     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
502     gx_studio_slider_create,                 /* create function                */
503     GX_NULL,                                 /* drawing function override      */
504     GX_NULL,                                 /* event function override        */
505     {464, 10, 580, 33},                      /* widget size                    */
506     &main_window_prompt_2_define,            /* next widget definition         */
507     GX_NULL,                                 /* no child widgets               */
508     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_line_width_slider), /* control block */
509     (void *) &main_window_line_width_slider_properties /* extended properties  */
510 };
511 
512 GX_CONST GX_STUDIO_WIDGET main_window_prompt_1_define =
513 {
514     "prompt_1",
515     GX_TYPE_PROMPT,                          /* widget type                    */
516     GX_ID_NONE,                              /* widget id                      */
517     #if defined(GX_WIDGET_USER_DATA)
518     0,                                       /* user data                      */
519     #endif
520     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_TEXT_LEFT,   /* style flags */
521     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
522     sizeof(GX_PROMPT),                       /* control block size             */
523     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
524     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
525     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
526     gx_studio_prompt_create,                 /* create function                */
527     GX_NULL,                                 /* drawing function override      */
528     GX_NULL,                                 /* event function override        */
529     {363, 10, 459, 31},                      /* widget size                    */
530     &main_window_line_width_slider_define,   /* next widget definition         */
531     GX_NULL,                                 /* no child widgets               */
532     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_prompt_1), /* control block */
533     (void *) &main_window_prompt_1_properties /* extended properties           */
534 };
535 
536 GX_CONST GX_STUDIO_WIDGET main_window_define =
537 {
538     "main_window",
539     GX_TYPE_WINDOW,                          /* widget type                    */
540     GX_ID_NONE,                              /* widget id                      */
541     #if defined(GX_WIDGET_USER_DATA)
542     0,                                       /* user data                      */
543     #endif
544     GX_STYLE_BORDER_NONE,                    /* style flags                    */
545     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
546     sizeof(MAIN_WINDOW_CONTROL_BLOCK),       /* control block size             */
547     GX_COLOR_ID_WINDOW_FILL,                 /* normal color id                */
548     GX_COLOR_ID_WINDOW_FILL,                 /* selected color id              */
549     GX_COLOR_ID_WINDOW_FILL,                 /* disabled color id              */
550     gx_studio_window_create,                 /* create function                */
551     GX_NULL,                                 /* drawing function override      */
552     (UINT (*)(GX_WIDGET *, GX_EVENT *)) main_event_handler, /* event function override */
553     {0, 0, 639, 351},                        /* widget size                    */
554     GX_NULL,                                 /* next widget                    */
555     &main_window_prompt_1_define,            /* child widget                   */
556     0,                                       /* control block                  */
557     (void *) &main_window_properties         /* extended properties            */
558 };
559 GX_CONST GX_STUDIO_WIDGET_ENTRY lines_8bpp_widget_table[] =
560 {
561     { &main_window_define, (GX_WIDGET *) &main_window },
562     {GX_NULL, GX_NULL}
563 };
564 
gx_studio_nested_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)565 static GX_WIDGET *gx_studio_nested_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
566 {
567     UINT status = GX_SUCCESS;
568     GX_WIDGET *widget = GX_NULL;
569     GX_VALUE   list_count = 0;
570     GX_VALUE   list_total_count = 0;
571 
572     if(parent && (parent->gx_widget_type == GX_TYPE_MENU))
573     {
574         list_total_count = ((GX_MENU *)parent)->gx_menu_list_total_count;
575     }
576 
577     while(definition && status == GX_SUCCESS)
578     {
579         if (definition->create_function)
580         {
581             if (definition->style & GX_STYLE_DYNAMICALLY_ALLOCATED)
582             {
583                 status = gx_widget_allocate(&widget, definition->control_block_size);
584                 if (status != GX_SUCCESS)
585                 {
586                     return GX_NULL;
587                 }
588             }
589             else
590             {
591                 if (control == GX_NULL)
592                 {
593                     return GX_NULL;
594                 }
595                 widget = (GX_WIDGET *) (control + definition->control_block_offset);
596             }
597 
598             status = definition->create_function(definition, widget, parent);
599 
600             if(list_count < list_total_count)
601             {
602                 gx_menu_insert((GX_MENU *)parent, widget);
603                 ((GX_MENU *)parent)->gx_menu_list_total_count--;
604                 list_count++;
605             }
606 
607             if (status == GX_SUCCESS)
608             {
609                 if (definition->widget_type != GX_TYPE_TEMPLATE)
610                 {
611 #if defined(GUIX_5_4_0_COMPATIBILITY)
612                     gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id);
613 #else
614                     gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id, definition->disabled_fill_color_id);
615 #endif
616                 }
617 
618                 if (!(definition->status & GX_STATUS_ACCEPTS_FOCUS))
619                 {
620                     gx_widget_status_remove(widget, GX_STATUS_ACCEPTS_FOCUS);
621                 }
622 
623                 if (definition->draw_function)
624                 {
625                     gx_widget_draw_set(widget, definition->draw_function);
626                 }
627                 if (definition->event_function)
628                 {
629                     gx_widget_event_process_set(widget, definition->event_function);
630                 }
631 
632                 #if defined(GX_WIDGET_USER_DATA)
633                 widget->gx_widget_user_data = definition->user_data;
634                 #endif
635 
636                 if (definition->child_widget)
637                 {
638                     gx_studio_nested_widget_create(control, definition->child_widget, widget);
639                 }
640             }
641             definition = definition->next_widget;
642         }
643     }
644     return widget;
645 }
646 
gx_studio_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)647 GX_WIDGET *gx_studio_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
648 {
649     GX_WIDGET *widget;
650     widget = gx_studio_nested_widget_create(control, definition, GX_NULL);
651 
652     if (parent && widget)
653     {
654         gx_widget_attach(parent, widget);
655     }
656     return widget;
657 }
658 
gx_studio_named_widget_create(char * name,GX_WIDGET * parent,GX_WIDGET ** new_widget)659 UINT gx_studio_named_widget_create(char *name, GX_WIDGET *parent, GX_WIDGET **new_widget)
660 {
661     UINT status = GX_FAILURE;
662     GX_CONST GX_STUDIO_WIDGET_ENTRY *entry = lines_8bpp_widget_table;
663     GX_WIDGET *widget = GX_NULL;
664 
665     while(entry->widget_information)
666     {
667         if (!strcmp(name, entry->widget_information->widget_name))
668         {
669             widget = gx_studio_widget_create((GX_BYTE *) entry->widget, entry->widget_information, parent);
670             if (widget)
671             {
672                 status = GX_SUCCESS;
673             }
674             break;
675         }
676         entry++;
677     }
678 
679     if (new_widget)
680     {
681         *new_widget = widget;
682     }
683     return status;
684 }
685 
686 
gx_studio_display_configure(USHORT display,UINT (* driver)(GX_DISPLAY *),GX_UBYTE language,USHORT theme,GX_WINDOW_ROOT ** return_root)687 UINT gx_studio_display_configure(USHORT display, UINT (*driver)(GX_DISPLAY *),
688     GX_UBYTE language, USHORT theme, GX_WINDOW_ROOT **return_root)
689 {
690     GX_CONST GX_THEME *theme_ptr;
691     GX_RECTANGLE size;
692 
693     GX_STUDIO_DISPLAY_INFO *display_info = &lines_8bpp_display_table[display];
694 
695 
696 /* create the requested display                                                */
697 
698     gx_display_create(display_info->display,
699                       display_info->name,
700                       driver,
701                       (GX_VALUE) display_info->x_resolution,
702                       (GX_VALUE) display_info->y_resolution);
703 
704 
705 /* install the request theme                                                   */
706 
707     if(display_info->theme_table)
708     {
709         theme_ptr = display_info->theme_table[theme];
710         if(theme_ptr)
711         {
712             gx_display_color_table_set(display_info->display, theme_ptr->theme_color_table, theme_ptr->theme_color_table_size);
713 
714 /* install the color palette if required                                       */
715             if (display_info->display->gx_display_driver_palette_set &&
716                 theme_ptr->theme_palette != NULL)
717             {
718                 display_info->display->gx_display_driver_palette_set(display_info->display, theme_ptr->theme_palette, theme_ptr->theme_palette_size);
719             }
720 
721             gx_display_font_table_set(display_info->display, theme_ptr->theme_font_table, theme_ptr->theme_font_table_size);
722             gx_display_pixelmap_table_set(display_info->display, theme_ptr->theme_pixelmap_table, theme_ptr->theme_pixelmap_table_size);
723             gx_system_scroll_appearance_set(theme_ptr->theme_vertical_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_vertical_scrollbar_appearance);
724             gx_system_scroll_appearance_set(theme_ptr->theme_horizontal_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_horizontal_scrollbar_appearance);
725         }
726     }
727 
728 /* Install the language table.                                                 */
729 
730     if(display_info->language_table)
731     {
732         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);
733         gx_display_active_language_set(display_info->display, language);
734     }
735 
736 /* Set screen rotation angle.                                                  */
737 
738     display_info->display->gx_display_rotation_angle = display_info->rotation_angle;
739 
740 /* create the canvas for this display                                          */
741 
742     gx_canvas_create(display_info->canvas,
743                      display_info->canvas_name,
744                      display_info->display,
745                      GX_CANVAS_MANAGED | GX_CANVAS_VISIBLE,
746                      display_info->x_resolution,
747                      display_info->y_resolution,
748                      display_info->canvas_memory,
749                      display_info->canvas_memory_size);
750 
751 /* Create the root window for this canvas                                      */
752 
753     gx_utility_rectangle_define(&size,
754                                 0, 0,
755                                 (GX_VALUE) (display_info->x_resolution - 1),
756                                 (GX_VALUE) (display_info->y_resolution - 1));
757 
758     gx_window_root_create(display_info->root_window,
759                           display_info->name,
760                           display_info->canvas, GX_STYLE_NONE, 0, &size);
761     if (return_root)
762     {
763         *return_root = display_info->root_window;
764     }
765     return GX_SUCCESS;
766 }
767 #undef GUIX_STUDIO_GENERATED_FILE
768