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_resources.h"
16 #include "lines_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[225280];
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_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     901120,                                  /* 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     10,                                      /* total rows                     */
269     100                                      /* open height                    */
270 };
271 GX_PROMPT_PROPERTIES main_window_prompt_properties =
272 {
273     GX_STRING_ID_STRING_13,                  /* string id                      */
274     GX_FONT_ID_PROMPT,                       /* font id                        */
275     GX_COLOR_ID_TEXT,                        /* normal text color              */
276     GX_COLOR_ID_SELECTED_TEXT,               /* selected text color            */
277     GX_COLOR_ID_TEXT                         /* disabled text color            */
278 };
279 GX_SLIDER_PROPERTIES main_window_brush_alpha_slider_properties =
280 {
281     10,                                      /* tickmark count                 */
282     0,                                       /* mimimun value                  */
283     255,                                     /* maximum value                  */
284     255,                                     /* current value                  */
285     10,                                      /* increment                      */
286     10,                                      /* minimum travel                 */
287     10,                                      /* maximum travel                 */
288     5,                                       /* needle width                   */
289     14,                                      /* needle height                  */
290     5,                                       /* needle inset                   */
291     1                                        /* needle hotspot                 */
292 };
293 GX_PROMPT_PROPERTIES main_window_brush_alpha_prompt_properties =
294 {
295     GX_STRING_ID_STRING_14,                  /* string id                      */
296     GX_FONT_ID_PROMPT,                       /* font id                        */
297     GX_COLOR_ID_WHITE,                       /* normal text color              */
298     GX_COLOR_ID_WHITE,                       /* selected text color            */
299     GX_COLOR_ID_WHITE                        /* disabled text color            */
300 };
301 
302 GX_CONST GX_STUDIO_WIDGET main_window_brush_alpha_prompt_define =
303 {
304     "brush_alpha_prompt",
305     GX_TYPE_PROMPT,                          /* widget type                    */
306     ID_BRUSH_ALPHA_PROMPT,                   /* widget id                      */
307     #if defined(GX_WIDGET_USER_DATA)
308     0,                                       /* user data                      */
309     #endif
310     GX_STYLE_BORDER_RECESSED|GX_STYLE_ENABLED|GX_STYLE_TEXT_RIGHT,   /* style flags */
311     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
312     sizeof(GX_PROMPT),                       /* control block size             */
313     GX_COLOR_ID_BLACK,                       /* normal color id                */
314     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
315     GX_COLOR_ID_BLACK,                       /* disabled color id              */
316     gx_studio_prompt_create,                 /* create function                */
317     GX_NULL,                                 /* drawing function override      */
318     GX_NULL,                                 /* event function override        */
319     {586, 93, 625, 118},                     /* widget size                    */
320     GX_NULL,                                 /* no next widget                 */
321     GX_NULL,                                 /* no child widgets               */
322     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_brush_alpha_prompt), /* control block */
323     (void *) &main_window_brush_alpha_prompt_properties /* extended properties */
324 };
325 
326 GX_CONST GX_STUDIO_WIDGET main_window_brush_alpha_slider_define =
327 {
328     "brush_alpha_slider",
329     GX_TYPE_SLIDER,                          /* widget type                    */
330     ID_BRUSH_ALPHA_SLIDER,                   /* widget id                      */
331     #if defined(GX_WIDGET_USER_DATA)
332     0,                                       /* user data                      */
333     #endif
334     GX_STYLE_BORDER_RAISED|GX_STYLE_ENABLED|GX_STYLE_SHOW_NEEDLE|GX_STYLE_SHOW_TICKMARKS,   /* style flags */
335     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
336     sizeof(GX_SLIDER),                       /* control block size             */
337     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
338     GX_COLOR_ID_WIDGET_FILL,                 /* selected color id              */
339     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
340     gx_studio_slider_create,                 /* create function                */
341     GX_NULL,                                 /* drawing function override      */
342     GX_NULL,                                 /* event function override        */
343     {464, 94, 580, 117},                     /* widget size                    */
344     &main_window_brush_alpha_prompt_define,  /* next widget definition         */
345     GX_NULL,                                 /* no child widgets               */
346     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_brush_alpha_slider), /* control block */
347     (void *) &main_window_brush_alpha_slider_properties /* extended properties */
348 };
349 
350 GX_CONST GX_STUDIO_WIDGET main_window_prompt_define =
351 {
352     "prompt",
353     GX_TYPE_PROMPT,                          /* widget type                    */
354     GX_ID_NONE,                              /* widget id                      */
355     #if defined(GX_WIDGET_USER_DATA)
356     0,                                       /* user data                      */
357     #endif
358     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_TEXT_LEFT,   /* style flags */
359     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
360     sizeof(GX_PROMPT),                       /* control block size             */
361     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
362     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
363     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
364     gx_studio_prompt_create,                 /* create function                */
365     GX_NULL,                                 /* drawing function override      */
366     GX_NULL,                                 /* event function override        */
367     {374, 100, 470, 117},                    /* widget size                    */
368     &main_window_brush_alpha_slider_define,  /* next widget definition         */
369     GX_NULL,                                 /* no child widgets               */
370     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_prompt), /* control block  */
371     (void *) &main_window_prompt_properties  /* extended properties            */
372 };
373 
374 GX_CONST GX_STUDIO_WIDGET main_window_color_list_define =
375 {
376     "color_list",
377     GX_TYPE_DROP_LIST,                       /* widget type                    */
378     ID_COLOR_LIST,                           /* widget id                      */
379     #if defined(GX_WIDGET_USER_DATA)
380     0,                                       /* user data                      */
381     #endif
382     GX_STYLE_BORDER_THIN,                    /* style flags                    */
383     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
384     sizeof(GX_DROP_LIST),                    /* control block size             */
385     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
386     GX_COLOR_ID_WIDGET_FILL,                 /* selected color id              */
387     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
388     gx_studio_drop_list_create,              /* create function                */
389     GX_NULL,                                 /* drawing function override      */
390     GX_NULL,                                 /* event function override        */
391     {458, 226, 627, 249},                    /* widget size                    */
392     &main_window_prompt_define,              /* next widget definition         */
393     GX_NULL,                                 /* no child widgets               */
394     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_color_list), /* control block */
395     (void *) &main_window_color_list_properties /* extended properties         */
396 };
397 
398 GX_CONST GX_STUDIO_WIDGET main_window_color_label_define =
399 {
400     "color_label",
401     GX_TYPE_PROMPT,                          /* widget type                    */
402     GX_ID_NONE,                              /* widget id                      */
403     #if defined(GX_WIDGET_USER_DATA)
404     0,                                       /* user data                      */
405     #endif
406     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_TEXT_LEFT,   /* style flags */
407     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
408     sizeof(GX_PROMPT),                       /* control block size             */
409     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
410     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
411     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
412     gx_studio_prompt_create,                 /* create function                */
413     GX_NULL,                                 /* drawing function override      */
414     GX_NULL,                                 /* event function override        */
415     {374, 227, 454, 244},                    /* widget size                    */
416     &main_window_color_list_define,          /* next widget definition         */
417     GX_NULL,                                 /* no child widgets               */
418     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_color_label), /* control block */
419     (void *) &main_window_color_label_properties /* extended properties        */
420 };
421 
422 GX_CONST GX_STUDIO_WIDGET main_window_line_window_define =
423 {
424     "line_window",
425     GX_TYPE_WINDOW,                          /* widget type                    */
426     ID_LINE_WINDOW,                          /* widget id                      */
427     #if defined(GX_WIDGET_USER_DATA)
428     0,                                       /* user data                      */
429     #endif
430     GX_STYLE_BORDER_THIN,                    /* style flags                    */
431     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
432     sizeof(GX_WINDOW),                       /* control block size             */
433     GX_COLOR_ID_SELECTED_FILL,               /* normal color id                */
434     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
435     GX_COLOR_ID_SELECTED_FILL,               /* disabled color id              */
436     gx_studio_window_create,                 /* create function                */
437     (VOID (*)(GX_WIDGET *)) line_win_draw,   /* drawing function override      */
438     GX_NULL,                                 /* event function override        */
439     {25, 14, 344, 333},                      /* widget size                    */
440     &main_window_color_label_define,         /* next widget definition         */
441     GX_NULL,                                 /* no child widgets               */
442     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_line_window), /* control block */
443     (void *) &main_window_line_window_properties /* extended properties        */
444 };
445 
446 GX_CONST GX_STUDIO_WIDGET main_window_rounded_box_define =
447 {
448     "rounded_box",
449     GX_TYPE_CHECKBOX,                        /* widget type                    */
450     ID_ROUNDED,                              /* widget id                      */
451     #if defined(GX_WIDGET_USER_DATA)
452     0,                                       /* user data                      */
453     #endif
454     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_BUTTON_TOGGLE|GX_STYLE_TEXT_LEFT,   /* style flags */
455     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
456     sizeof(GX_CHECKBOX),                     /* control block size             */
457     GX_COLOR_ID_BTN_LOWER,                   /* normal color id                */
458     GX_COLOR_ID_BTN_UPPER,                   /* selected color id              */
459     GX_COLOR_ID_BTN_LOWER,                   /* disabled color id              */
460     gx_studio_checkbox_create,               /* create function                */
461     GX_NULL,                                 /* drawing function override      */
462     GX_NULL,                                 /* event function override        */
463     {374, 185, 497, 211},                    /* widget size                    */
464     &main_window_line_window_define,         /* next widget definition         */
465     GX_NULL,                                 /* no child widgets               */
466     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_rounded_box), /* control block */
467     (void *) &main_window_rounded_box_properties /* extended properties        */
468 };
469 
470 GX_CONST GX_STUDIO_WIDGET main_window_aa_box_define =
471 {
472     "aa_box",
473     GX_TYPE_CHECKBOX,                        /* widget type                    */
474     ID_ANTI_ALIASED,                         /* widget id                      */
475     #if defined(GX_WIDGET_USER_DATA)
476     0,                                       /* user data                      */
477     #endif
478     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_BUTTON_TOGGLE|GX_STYLE_TEXT_LEFT,   /* style flags */
479     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
480     sizeof(GX_CHECKBOX),                     /* control block size             */
481     GX_COLOR_ID_BTN_LOWER,                   /* normal color id                */
482     GX_COLOR_ID_BTN_UPPER,                   /* selected color id              */
483     GX_COLOR_ID_BTN_LOWER,                   /* disabled color id              */
484     gx_studio_checkbox_create,               /* create function                */
485     GX_NULL,                                 /* drawing function override      */
486     GX_NULL,                                 /* event function override        */
487     {374, 153, 497, 179},                    /* widget size                    */
488     &main_window_rounded_box_define,         /* next widget definition         */
489     GX_NULL,                                 /* no child widgets               */
490     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_aa_box), /* control block  */
491     (void *) &main_window_aa_box_properties  /* extended properties            */
492 };
493 
494 GX_CONST GX_STUDIO_WIDGET main_window_angle_display_define =
495 {
496     "angle_display",
497     GX_TYPE_PROMPT,                          /* widget type                    */
498     ID_ANGLE_DISPLAY,                        /* widget id                      */
499     #if defined(GX_WIDGET_USER_DATA)
500     0,                                       /* user data                      */
501     #endif
502     GX_STYLE_BORDER_RECESSED|GX_STYLE_ENABLED|GX_STYLE_TEXT_RIGHT,   /* style flags */
503     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
504     sizeof(GX_PROMPT),                       /* control block size             */
505     GX_COLOR_ID_BLACK,                       /* normal color id                */
506     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
507     GX_COLOR_ID_BLACK,                       /* disabled color id              */
508     gx_studio_prompt_create,                 /* create function                */
509     GX_NULL,                                 /* drawing function override      */
510     GX_NULL,                                 /* event function override        */
511     {586, 49, 625, 74},                      /* widget size                    */
512     &main_window_aa_box_define,              /* next widget definition         */
513     GX_NULL,                                 /* no child widgets               */
514     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_angle_display), /* control block */
515     (void *) &main_window_angle_display_properties /* extended properties      */
516 };
517 
518 GX_CONST GX_STUDIO_WIDGET main_window_width_display_define =
519 {
520     "width_display",
521     GX_TYPE_PROMPT,                          /* widget type                    */
522     ID_WIDTH_DISPLAY,                        /* widget id                      */
523     #if defined(GX_WIDGET_USER_DATA)
524     0,                                       /* user data                      */
525     #endif
526     GX_STYLE_BORDER_RECESSED|GX_STYLE_ENABLED|GX_STYLE_TEXT_RIGHT,   /* style flags */
527     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
528     sizeof(GX_PROMPT),                       /* control block size             */
529     GX_COLOR_ID_BLACK,                       /* normal color id                */
530     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
531     GX_COLOR_ID_BLACK,                       /* disabled color id              */
532     gx_studio_prompt_create,                 /* create function                */
533     GX_NULL,                                 /* drawing function override      */
534     GX_NULL,                                 /* event function override        */
535     {586, 10, 625, 35},                      /* widget size                    */
536     &main_window_angle_display_define,       /* next widget definition         */
537     GX_NULL,                                 /* no child widgets               */
538     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_width_display), /* control block */
539     (void *) &main_window_width_display_properties /* extended properties      */
540 };
541 
542 GX_CONST GX_STUDIO_WIDGET main_window_line_angle_slider_define =
543 {
544     "line_angle_slider",
545     GX_TYPE_SLIDER,                          /* widget type                    */
546     ID_LINE_ANGLE,                           /* widget id                      */
547     #if defined(GX_WIDGET_USER_DATA)
548     0,                                       /* user data                      */
549     #endif
550     GX_STYLE_BORDER_RAISED|GX_STYLE_ENABLED|GX_STYLE_SHOW_NEEDLE|GX_STYLE_SHOW_TICKMARKS,   /* style flags */
551     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
552     sizeof(GX_SLIDER),                       /* control block size             */
553     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
554     GX_COLOR_ID_WIDGET_FILL,                 /* selected color id              */
555     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
556     gx_studio_slider_create,                 /* create function                */
557     GX_NULL,                                 /* drawing function override      */
558     GX_NULL,                                 /* event function override        */
559     {464, 51, 580, 74},                      /* widget size                    */
560     &main_window_width_display_define,       /* next widget definition         */
561     GX_NULL,                                 /* no child widgets               */
562     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_line_angle_slider), /* control block */
563     (void *) &main_window_line_angle_slider_properties /* extended properties  */
564 };
565 
566 GX_CONST GX_STUDIO_WIDGET main_window_prompt_2_define =
567 {
568     "prompt_2",
569     GX_TYPE_PROMPT,                          /* widget type                    */
570     GX_ID_NONE,                              /* widget id                      */
571     #if defined(GX_WIDGET_USER_DATA)
572     0,                                       /* user data                      */
573     #endif
574     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_TEXT_LEFT,   /* style flags */
575     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
576     sizeof(GX_PROMPT),                       /* control block size             */
577     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
578     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
579     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
580     gx_studio_prompt_create,                 /* create function                */
581     GX_NULL,                                 /* drawing function override      */
582     GX_NULL,                                 /* event function override        */
583     {374, 57, 452, 74},                      /* widget size                    */
584     &main_window_line_angle_slider_define,   /* next widget definition         */
585     GX_NULL,                                 /* no child widgets               */
586     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_prompt_2), /* control block */
587     (void *) &main_window_prompt_2_properties /* extended properties           */
588 };
589 
590 GX_CONST GX_STUDIO_WIDGET main_window_line_width_slider_define =
591 {
592     "line_width_slider",
593     GX_TYPE_SLIDER,                          /* widget type                    */
594     ID_LINE_WIDTH,                           /* widget id                      */
595     #if defined(GX_WIDGET_USER_DATA)
596     0,                                       /* user data                      */
597     #endif
598     GX_STYLE_BORDER_RAISED|GX_STYLE_ENABLED|GX_STYLE_SHOW_NEEDLE|GX_STYLE_SHOW_TICKMARKS,   /* style flags */
599     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
600     sizeof(GX_SLIDER),                       /* control block size             */
601     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
602     GX_COLOR_ID_WIDGET_FILL,                 /* selected color id              */
603     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
604     gx_studio_slider_create,                 /* create function                */
605     GX_NULL,                                 /* drawing function override      */
606     GX_NULL,                                 /* event function override        */
607     {464, 10, 580, 33},                      /* widget size                    */
608     &main_window_prompt_2_define,            /* next widget definition         */
609     GX_NULL,                                 /* no child widgets               */
610     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_line_width_slider), /* control block */
611     (void *) &main_window_line_width_slider_properties /* extended properties  */
612 };
613 
614 GX_CONST GX_STUDIO_WIDGET main_window_prompt_1_define =
615 {
616     "prompt_1",
617     GX_TYPE_PROMPT,                          /* widget type                    */
618     GX_ID_NONE,                              /* widget id                      */
619     #if defined(GX_WIDGET_USER_DATA)
620     0,                                       /* user data                      */
621     #endif
622     GX_STYLE_BORDER_NONE|GX_STYLE_TRANSPARENT|GX_STYLE_ENABLED|GX_STYLE_TEXT_LEFT,   /* style flags */
623     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
624     sizeof(GX_PROMPT),                       /* control block size             */
625     GX_COLOR_ID_WIDGET_FILL,                 /* normal color id                */
626     GX_COLOR_ID_SELECTED_FILL,               /* selected color id              */
627     GX_COLOR_ID_WIDGET_FILL,                 /* disabled color id              */
628     gx_studio_prompt_create,                 /* create function                */
629     GX_NULL,                                 /* drawing function override      */
630     GX_NULL,                                 /* event function override        */
631     {374, 10, 457, 31},                      /* widget size                    */
632     &main_window_line_width_slider_define,   /* next widget definition         */
633     GX_NULL,                                 /* no child widgets               */
634     offsetof(MAIN_WINDOW_CONTROL_BLOCK, main_window_prompt_1), /* control block */
635     (void *) &main_window_prompt_1_properties /* extended properties           */
636 };
637 
638 GX_CONST GX_STUDIO_WIDGET main_window_define =
639 {
640     "main_window",
641     GX_TYPE_WINDOW,                          /* widget type                    */
642     GX_ID_NONE,                              /* widget id                      */
643     #if defined(GX_WIDGET_USER_DATA)
644     0,                                       /* user data                      */
645     #endif
646     GX_STYLE_BORDER_NONE,                    /* style flags                    */
647     GX_STATUS_ACCEPTS_FOCUS,                 /* status flags                   */
648     sizeof(MAIN_WINDOW_CONTROL_BLOCK),       /* control block size             */
649     GX_COLOR_ID_WINDOW_FILL,                 /* normal color id                */
650     GX_COLOR_ID_WINDOW_FILL,                 /* selected color id              */
651     GX_COLOR_ID_WINDOW_FILL,                 /* disabled color id              */
652     gx_studio_window_create,                 /* create function                */
653     GX_NULL,                                 /* drawing function override      */
654     (UINT (*)(GX_WIDGET *, GX_EVENT *)) main_event_handler, /* event function override */
655     {0, 0, 639, 351},                        /* widget size                    */
656     GX_NULL,                                 /* next widget                    */
657     &main_window_prompt_1_define,            /* child widget                   */
658     0,                                       /* control block                  */
659     (void *) &main_window_properties         /* extended properties            */
660 };
661 GX_CONST GX_STUDIO_WIDGET_ENTRY lines_widget_table[] =
662 {
663     { &main_window_define, (GX_WIDGET *) &main_window },
664     {GX_NULL, GX_NULL}
665 };
666 
gx_studio_nested_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)667 static GX_WIDGET *gx_studio_nested_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
668 {
669     UINT status = GX_SUCCESS;
670     GX_WIDGET *widget = GX_NULL;
671     GX_VALUE   list_count = 0;
672     GX_VALUE   list_total_count = 0;
673 
674     if(parent && (parent->gx_widget_type == GX_TYPE_MENU))
675     {
676         list_total_count = ((GX_MENU *)parent)->gx_menu_list_total_count;
677     }
678 
679     while(definition && status == GX_SUCCESS)
680     {
681         if (definition->create_function)
682         {
683             if (definition->style & GX_STYLE_DYNAMICALLY_ALLOCATED)
684             {
685                 status = gx_widget_allocate(&widget, definition->control_block_size);
686                 if (status != GX_SUCCESS)
687                 {
688                     return GX_NULL;
689                 }
690             }
691             else
692             {
693                 if (control == GX_NULL)
694                 {
695                     return GX_NULL;
696                 }
697                 widget = (GX_WIDGET *) (control + definition->control_block_offset);
698             }
699 
700             status = definition->create_function(definition, widget, parent);
701 
702             if(list_count < list_total_count)
703             {
704                 gx_menu_insert((GX_MENU *)parent, widget);
705                 ((GX_MENU *)parent)->gx_menu_list_total_count--;
706                 list_count++;
707             }
708 
709             if (status == GX_SUCCESS)
710             {
711                 if (definition->widget_type != GX_TYPE_TEMPLATE)
712                 {
713 #if defined(GUIX_5_4_0_COMPATIBILITY)
714                     gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id);
715 #else
716                     gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id, definition->disabled_fill_color_id);
717 #endif
718                 }
719 
720                 if (!(definition->status & GX_STATUS_ACCEPTS_FOCUS))
721                 {
722                     gx_widget_status_remove(widget, GX_STATUS_ACCEPTS_FOCUS);
723                 }
724 
725                 if (definition->draw_function)
726                 {
727                     gx_widget_draw_set(widget, definition->draw_function);
728                 }
729                 if (definition->event_function)
730                 {
731                     gx_widget_event_process_set(widget, definition->event_function);
732                 }
733 
734                 #if defined(GX_WIDGET_USER_DATA)
735                 widget->gx_widget_user_data = definition->user_data;
736                 #endif
737 
738                 if (definition->child_widget)
739                 {
740                     gx_studio_nested_widget_create(control, definition->child_widget, widget);
741                 }
742             }
743             definition = definition->next_widget;
744         }
745     }
746     return widget;
747 }
748 
gx_studio_widget_create(GX_BYTE * control,GX_CONST GX_STUDIO_WIDGET * definition,GX_WIDGET * parent)749 GX_WIDGET *gx_studio_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
750 {
751     GX_WIDGET *widget;
752     widget = gx_studio_nested_widget_create(control, definition, GX_NULL);
753 
754     if (parent && widget)
755     {
756         gx_widget_attach(parent, widget);
757     }
758     return widget;
759 }
760 
gx_studio_named_widget_create(char * name,GX_WIDGET * parent,GX_WIDGET ** new_widget)761 UINT gx_studio_named_widget_create(char *name, GX_WIDGET *parent, GX_WIDGET **new_widget)
762 {
763     UINT status = GX_FAILURE;
764     GX_CONST GX_STUDIO_WIDGET_ENTRY *entry = lines_widget_table;
765     GX_WIDGET *widget = GX_NULL;
766 
767     while(entry->widget_information)
768     {
769         if (!strcmp(name, entry->widget_information->widget_name))
770         {
771             widget = gx_studio_widget_create((GX_BYTE *) entry->widget, entry->widget_information, parent);
772             if (widget)
773             {
774                 status = GX_SUCCESS;
775             }
776             break;
777         }
778         entry++;
779     }
780 
781     if (new_widget)
782     {
783         *new_widget = widget;
784     }
785     return status;
786 }
787 
788 
gx_studio_display_configure(USHORT display,UINT (* driver)(GX_DISPLAY *),GX_UBYTE language,USHORT theme,GX_WINDOW_ROOT ** return_root)789 UINT gx_studio_display_configure(USHORT display, UINT (*driver)(GX_DISPLAY *),
790     GX_UBYTE language, USHORT theme, GX_WINDOW_ROOT **return_root)
791 {
792     GX_CONST GX_THEME *theme_ptr;
793     GX_RECTANGLE size;
794 
795     GX_STUDIO_DISPLAY_INFO *display_info = &lines_display_table[display];
796 
797 
798 /* create the requested display                                                */
799 
800     gx_display_create(display_info->display,
801                       display_info->name,
802                       driver,
803                       (GX_VALUE) display_info->x_resolution,
804                       (GX_VALUE) display_info->y_resolution);
805 
806 
807 /* install the request theme                                                   */
808 
809     if(display_info->theme_table)
810     {
811         theme_ptr = display_info->theme_table[theme];
812         if(theme_ptr)
813         {
814             gx_display_color_table_set(display_info->display, theme_ptr->theme_color_table, theme_ptr->theme_color_table_size);
815 
816 /* install the color palette if required                                       */
817             if (display_info->display->gx_display_driver_palette_set &&
818                 theme_ptr->theme_palette != NULL)
819             {
820                 display_info->display->gx_display_driver_palette_set(display_info->display, theme_ptr->theme_palette, theme_ptr->theme_palette_size);
821             }
822 
823             gx_display_font_table_set(display_info->display, theme_ptr->theme_font_table, theme_ptr->theme_font_table_size);
824             gx_display_pixelmap_table_set(display_info->display, theme_ptr->theme_pixelmap_table, theme_ptr->theme_pixelmap_table_size);
825             gx_system_scroll_appearance_set(theme_ptr->theme_vertical_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_vertical_scrollbar_appearance);
826             gx_system_scroll_appearance_set(theme_ptr->theme_horizontal_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_horizontal_scrollbar_appearance);
827         }
828     }
829 
830 /* Install the language table.                                                 */
831 
832     if(display_info->language_table)
833     {
834         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);
835         gx_display_active_language_set(display_info->display, language);
836     }
837 
838 /* Set screen rotation angle.                                                  */
839 
840     display_info->display->gx_display_rotation_angle = display_info->rotation_angle;
841 
842 /* create the canvas for this display                                          */
843 
844     gx_canvas_create(display_info->canvas,
845                      display_info->canvas_name,
846                      display_info->display,
847                      GX_CANVAS_MANAGED | GX_CANVAS_VISIBLE,
848                      display_info->x_resolution,
849                      display_info->y_resolution,
850                      display_info->canvas_memory,
851                      display_info->canvas_memory_size);
852 
853 /* Create the root window for this canvas                                      */
854 
855     gx_utility_rectangle_define(&size,
856                                 0, 0,
857                                 (GX_VALUE) (display_info->x_resolution - 1),
858                                 (GX_VALUE) (display_info->y_resolution - 1));
859 
860     gx_window_root_create(display_info->root_window,
861                           display_info->name,
862                           display_info->canvas, GX_STYLE_NONE, 0, &size);
863     if (return_root)
864     {
865         *return_root = display_info->root_window;
866     }
867     return GX_SUCCESS;
868 }
869 #undef GUIX_STUDIO_GENERATED_FILE
870