guiapp_specifications.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  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.1.0.0 */
  9. /* Date (dd.mm.yyyy): 13.11.2020 Time (hh:mm): 10:10 */
  10. /*******************************************************************************/
  11. #define GUIX_STUDIO_GENERATED_FILE
  12. #include <stddef.h>
  13. #include "guiapp_resources.h"
  14. #include "guiapp_specifications.h"
  15. static GX_WIDGET *gx_studio_nested_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent);
  16. WINDOW_1_CONTROL_BLOCK window_1;
  17. WINDOW_CONTROL_BLOCK window;
  18. GX_DISPLAY display_1_control_block;
  19. GX_WINDOW_ROOT display_1_root_window;
  20. GX_CANVAS display_1_canvas_control_block;
  21. ULONG display_1_canvas_memory[512];
  22. extern GX_CONST GX_THEME *display_1_theme_table[];
  23. extern GX_CONST GX_STRING *display_1_language_table[];
  24. GX_STUDIO_DISPLAY_INFO guiapp_display_table[1] =
  25. {
  26. {
  27. "display_1",
  28. "display_1_canvas",
  29. display_1_theme_table,
  30. display_1_language_table,
  31. DISPLAY_1_THEME_TABLE_SIZE,
  32. DISPLAY_1_LANGUAGE_TABLE_SIZE,
  33. DISPLAY_1_STRING_TABLE_SIZE,
  34. 128, /* x resolution */
  35. 128, /* y resolution */
  36. &display_1_control_block,
  37. &display_1_canvas_control_block,
  38. &display_1_root_window,
  39. display_1_canvas_memory, /* canvas memory area */
  40. 2048 /* canvas memory size in bytes */
  41. }
  42. };
  43. UINT gx_studio_text_button_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
  44. {
  45. UINT status;
  46. GX_TEXT_BUTTON *button = (GX_TEXT_BUTTON *) control_block;
  47. GX_TEXT_BUTTON_PROPERTIES *props = (GX_TEXT_BUTTON_PROPERTIES *) info->properties;
  48. status = gx_text_button_create(button, info->widget_name, parent, props->string_id, info->style, info->widget_id, &info->size);
  49. if (status == GX_SUCCESS)
  50. {
  51. gx_text_button_font_set(button, props->font_id);
  52. #if defined(GUIX_5_4_0_COMPATIBILITY)
  53. gx_text_button_text_color_set(button, props->normal_text_color_id, props->selected_text_color_id);
  54. #else
  55. gx_text_button_text_color_set(button, props->normal_text_color_id, props->selected_text_color_id, props->disabled_text_color_id);
  56. #endif
  57. }
  58. return status;
  59. }
  60. UINT gx_studio_prompt_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
  61. {
  62. UINT status;
  63. GX_PROMPT *prompt = (GX_PROMPT *) control_block;
  64. GX_PROMPT_PROPERTIES *props = (GX_PROMPT_PROPERTIES *) info->properties;
  65. status = gx_prompt_create(prompt, info->widget_name, parent, props->string_id, info->style, info->widget_id, &info->size);
  66. if (status == GX_SUCCESS)
  67. {
  68. gx_prompt_font_set(prompt, props->font_id);
  69. #if defined(GUIX_5_4_0_COMPATIBILITY)
  70. gx_prompt_text_color_set(prompt, props->normal_text_color_id, props->selected_text_color_id);
  71. #else
  72. gx_prompt_text_color_set(prompt, props->normal_text_color_id, props->selected_text_color_id, props->disabled_text_color_id);
  73. #endif
  74. }
  75. return status;
  76. }
  77. UINT gx_studio_window_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
  78. {
  79. UINT status;
  80. GX_WINDOW *window = (GX_WINDOW *) control_block;
  81. GX_WINDOW_PROPERTIES *props = (GX_WINDOW_PROPERTIES *) info->properties;
  82. status = gx_window_create(window, info->widget_name, parent, info->style, info->widget_id, &info->size);
  83. if (status == GX_SUCCESS)
  84. {
  85. if (props->wallpaper_id)
  86. {
  87. gx_window_wallpaper_set(window, props->wallpaper_id, info->style & GX_STYLE_TILE_WALLPAPER);
  88. }
  89. }
  90. return status;
  91. }
  92. GX_WINDOW_PROPERTIES window_1_properties =
  93. {
  94. 0 /* wallpaper pixelmap id */
  95. };
  96. GX_TEXT_BUTTON_PROPERTIES window_1_button_properties =
  97. {
  98. GX_STRING_ID_STRING_9, /* string id */
  99. GX_FONT_ID_BUTTON, /* font id */
  100. GX_COLOR_ID_BTN_TEXT, /* normal text color */
  101. GX_COLOR_ID_BTN_TEXT, /* selected text color */
  102. GX_COLOR_ID_DISABLED_TEXT /* disabled text color */
  103. };
  104. GX_PROMPT_PROPERTIES window_1_prompt_properties =
  105. {
  106. GX_STRING_ID_STRING_10, /* string id */
  107. GX_FONT_ID_PROMPT, /* font id */
  108. GX_COLOR_ID_TEXT, /* normal text color */
  109. GX_COLOR_ID_SELECTED_TEXT, /* selected text color */
  110. GX_COLOR_ID_DISABLED_TEXT /* disabled text color */
  111. };
  112. GX_CONST GX_STUDIO_WIDGET window_1_prompt_define =
  113. {
  114. "prompt",
  115. GX_TYPE_PROMPT, /* widget type */
  116. GX_ID_NONE, /* widget id */
  117. #if defined(GX_WIDGET_USER_DATA)
  118. 0, /* user data */
  119. #endif
  120. GX_STYLE_BORDER_NONE|GX_STYLE_ENABLED|GX_STYLE_TEXT_CENTER, /* style flags */
  121. GX_STATUS_ACCEPTS_FOCUS, /* status flags */
  122. sizeof(GX_PROMPT), /* control block size */
  123. GX_COLOR_ID_WIDGET_FILL, /* normal color id */
  124. GX_COLOR_ID_SELECTED_FILL, /* selected color id */
  125. GX_COLOR_ID_DISABLED_FILL, /* disabled color id */
  126. gx_studio_prompt_create, /* create function */
  127. GX_NULL, /* drawing function override */
  128. GX_NULL, /* event function override */
  129. {19, 6, 98, 29}, /* widget size */
  130. GX_NULL, /* no next widget */
  131. GX_NULL, /* no child widgets */
  132. offsetof(WINDOW_1_CONTROL_BLOCK, window_1_prompt), /* control block */
  133. (void *) &window_1_prompt_properties /* extended properties */
  134. };
  135. GX_CONST GX_STUDIO_WIDGET window_1_button_define =
  136. {
  137. "button",
  138. GX_TYPE_TEXT_BUTTON, /* widget type */
  139. GUI_ID_TextButton0, /* widget id */
  140. #if defined(GX_WIDGET_USER_DATA)
  141. 0, /* user data */
  142. #endif
  143. GX_STYLE_BORDER_RAISED|GX_STYLE_ENABLED|GX_STYLE_TEXT_CENTER, /* style flags */
  144. GX_STATUS_ACCEPTS_FOCUS, /* status flags */
  145. sizeof(GX_TEXT_BUTTON), /* control block size */
  146. GX_COLOR_ID_BTN_LOWER, /* normal color id */
  147. GX_COLOR_ID_BTN_UPPER, /* selected color id */
  148. GX_COLOR_ID_DISABLED_FILL, /* disabled color id */
  149. gx_studio_text_button_create, /* create function */
  150. GX_NULL, /* drawing function override */
  151. GX_NULL, /* event function override */
  152. {21, 37, 100, 60}, /* widget size */
  153. &window_1_prompt_define, /* next widget definition */
  154. GX_NULL, /* no child widgets */
  155. offsetof(WINDOW_1_CONTROL_BLOCK, window_1_button), /* control block */
  156. (void *) &window_1_button_properties /* extended properties */
  157. };
  158. GX_CONST GX_STUDIO_WIDGET window_1_define =
  159. {
  160. "window_1",
  161. GX_TYPE_WINDOW, /* widget type */
  162. GUIX_ID_WINDOW0, /* widget id */
  163. #if defined(GX_WIDGET_USER_DATA)
  164. 0, /* user data */
  165. #endif
  166. GX_STYLE_BORDER_NONE|GX_STYLE_ENABLED, /* style flags */
  167. GX_STATUS_ACCEPTS_FOCUS, /* status flags */
  168. sizeof(WINDOW_1_CONTROL_BLOCK), /* control block size */
  169. GX_COLOR_ID_WINDOW_FILL, /* normal color id */
  170. GX_COLOR_ID_WINDOW_FILL, /* selected color id */
  171. GX_COLOR_ID_DISABLED_FILL, /* disabled color id */
  172. gx_studio_window_create, /* create function */
  173. GX_NULL, /* drawing function override */
  174. GX_NULL, /* event function override */
  175. {0, 0, 127, 127}, /* widget size */
  176. GX_NULL, /* next widget */
  177. &window_1_button_define, /* child widget */
  178. 0, /* control block */
  179. (void *) &window_1_properties /* extended properties */
  180. };
  181. GX_WINDOW_PROPERTIES window_properties =
  182. {
  183. GX_PIXELMAP_ID_YXYL_LOGO /* wallpaper pixelmap id */
  184. };
  185. GX_CONST GX_STUDIO_WIDGET window_define =
  186. {
  187. "window",
  188. GX_TYPE_WINDOW, /* widget type */
  189. GX_ID_NONE, /* widget id */
  190. #if defined(GX_WIDGET_USER_DATA)
  191. 0, /* user data */
  192. #endif
  193. GX_STYLE_BORDER_NONE|GX_STYLE_ENABLED, /* style flags */
  194. GX_STATUS_ACCEPTS_FOCUS, /* status flags */
  195. sizeof(WINDOW_CONTROL_BLOCK), /* control block size */
  196. GX_COLOR_ID_WINDOW_FILL, /* normal color id */
  197. GX_COLOR_ID_WINDOW_FILL, /* selected color id */
  198. GX_COLOR_ID_DISABLED_FILL, /* disabled color id */
  199. gx_studio_window_create, /* create function */
  200. GX_NULL, /* drawing function override */
  201. GX_NULL, /* event function override */
  202. {0, 37, 127, 89}, /* widget size */
  203. GX_NULL, /* next widget */
  204. GX_NULL, /* child widget */
  205. 0, /* control block */
  206. (void *) &window_properties /* extended properties */
  207. };
  208. GX_CONST GX_STUDIO_WIDGET_ENTRY guiapp_widget_table[] =
  209. {
  210. { &window_1_define, (GX_WIDGET *) &window_1 },
  211. { &window_define, (GX_WIDGET *) &window },
  212. {GX_NULL, GX_NULL}
  213. };
  214. static GX_WIDGET *gx_studio_nested_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
  215. {
  216. UINT status = GX_SUCCESS;
  217. GX_WIDGET *widget = GX_NULL;
  218. GX_VALUE list_count = 0;
  219. GX_VALUE list_total_count = 0;
  220. if(parent && (parent->gx_widget_type == GX_TYPE_MENU))
  221. {
  222. list_total_count = ((GX_MENU *)parent)->gx_menu_list_total_count;
  223. }
  224. while(definition && status == GX_SUCCESS)
  225. {
  226. if (definition->create_function)
  227. {
  228. if (definition->style & GX_STYLE_DYNAMICALLY_ALLOCATED)
  229. {
  230. status = gx_widget_allocate(&widget, definition->control_block_size);
  231. if (status != GX_SUCCESS)
  232. {
  233. return GX_NULL;
  234. }
  235. }
  236. else
  237. {
  238. if (control == GX_NULL)
  239. {
  240. return GX_NULL;
  241. }
  242. widget = (GX_WIDGET *) (control + definition->control_block_offset);
  243. }
  244. status = definition->create_function(definition, widget, parent);
  245. if(list_count < list_total_count)
  246. {
  247. gx_menu_insert((GX_MENU *)parent, widget);
  248. ((GX_MENU *)parent)->gx_menu_list_total_count--;
  249. list_count++;
  250. }
  251. if (status == GX_SUCCESS)
  252. {
  253. if (definition->widget_type != GX_TYPE_TEMPLATE)
  254. {
  255. #if defined(GUIX_5_4_0_COMPATIBILITY)
  256. gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id);
  257. #else
  258. gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id, definition->disabled_fill_color_id);
  259. #endif
  260. }
  261. if (!(definition->status & GX_STATUS_ACCEPTS_FOCUS))
  262. {
  263. gx_widget_status_remove(widget, GX_STATUS_ACCEPTS_FOCUS);
  264. }
  265. if (definition->draw_function)
  266. {
  267. gx_widget_draw_set(widget, definition->draw_function);
  268. }
  269. if (definition->event_function)
  270. {
  271. gx_widget_event_process_set(widget, definition->event_function);
  272. }
  273. #if defined(GX_WIDGET_USER_DATA)
  274. widget->gx_widget_user_data = definition->user_data;
  275. #endif
  276. if (definition->child_widget)
  277. {
  278. gx_studio_nested_widget_create(control, definition->child_widget, widget);
  279. }
  280. }
  281. definition = definition->next_widget;
  282. }
  283. }
  284. return widget;
  285. }
  286. GX_WIDGET *gx_studio_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
  287. {
  288. GX_WIDGET *widget;
  289. widget = gx_studio_nested_widget_create(control, definition, GX_NULL);
  290. if (parent && widget)
  291. {
  292. gx_widget_attach(parent, widget);
  293. }
  294. return widget;
  295. }
  296. UINT gx_studio_named_widget_create(char *name, GX_WIDGET *parent, GX_WIDGET **new_widget)
  297. {
  298. UINT status = GX_FAILURE;
  299. GX_CONST GX_STUDIO_WIDGET_ENTRY *entry = guiapp_widget_table;
  300. GX_WIDGET *widget = GX_NULL;
  301. while(entry->widget_information)
  302. {
  303. if (!strcmp(name, entry->widget_information->widget_name))
  304. {
  305. widget = gx_studio_widget_create((GX_BYTE *) entry->widget, entry->widget_information, parent);
  306. if (widget)
  307. {
  308. status = GX_SUCCESS;
  309. }
  310. break;
  311. }
  312. entry++;
  313. }
  314. if (new_widget)
  315. {
  316. *new_widget = widget;
  317. }
  318. return status;
  319. }
  320. UINT gx_studio_display_configure(USHORT display, UINT (*driver)(GX_DISPLAY *),
  321. GX_UBYTE language, USHORT theme, GX_WINDOW_ROOT **return_root)
  322. {
  323. GX_CONST GX_THEME *theme_ptr;
  324. GX_RECTANGLE size;
  325. GX_STUDIO_DISPLAY_INFO *display_info = &guiapp_display_table[display];
  326. /* create the requested display */
  327. gx_display_create(display_info->display,
  328. display_info->name,
  329. driver,
  330. (GX_VALUE) display_info->x_resolution,
  331. (GX_VALUE) display_info->y_resolution);
  332. /* install the request theme */
  333. if(display_info->theme_table)
  334. {
  335. theme_ptr = display_info->theme_table[theme];
  336. if(theme_ptr)
  337. {
  338. gx_display_color_table_set(display_info->display, theme_ptr->theme_color_table, theme_ptr->theme_color_table_size);
  339. /* install the color palette if required */
  340. if (display_info->display->gx_display_driver_palette_set &&
  341. theme_ptr->theme_palette != NULL)
  342. {
  343. display_info->display->gx_display_driver_palette_set(display_info->display, theme_ptr->theme_palette, theme_ptr->theme_palette_size);
  344. }
  345. gx_display_font_table_set(display_info->display, theme_ptr->theme_font_table, theme_ptr->theme_font_table_size);
  346. gx_display_pixelmap_table_set(display_info->display, theme_ptr->theme_pixelmap_table, theme_ptr->theme_pixelmap_table_size);
  347. gx_system_scroll_appearance_set(theme_ptr->theme_vertical_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_vertical_scrollbar_appearance);
  348. gx_system_scroll_appearance_set(theme_ptr->theme_horizontal_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_horizontal_scrollbar_appearance);
  349. 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);
  350. gx_display_active_language_set(display_info->display, language);
  351. }
  352. }
  353. /* create the canvas for this display */
  354. gx_canvas_create(display_info->canvas,
  355. display_info->canvas_name,
  356. display_info->display,
  357. GX_CANVAS_MANAGED | GX_CANVAS_VISIBLE,
  358. display_info->x_resolution,
  359. display_info->y_resolution,
  360. display_info->canvas_memory,
  361. display_info->canvas_memory_size);
  362. /* Create the root window for this canvas */
  363. gx_utility_rectangle_define(&size,
  364. 0, 0,
  365. (GX_VALUE) (display_info->x_resolution - 1),
  366. (GX_VALUE) (display_info->y_resolution - 1));
  367. gx_window_root_create(display_info->root_window,
  368. display_info->name,
  369. display_info->canvas, GX_STYLE_NONE, 0, &size);
  370. if (return_root)
  371. {
  372. *return_root = display_info->root_window;
  373. }
  374. return GX_SUCCESS;
  375. }
  376. #undef GUIX_STUDIO_GENERATED_FILE