guiapp_specifications.c 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  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): 24.11.2020 Time (hh:mm): 22:29 */
  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_CONTROL_BLOCK window;
  17. WINDOW_1_CONTROL_BLOCK window_1;
  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. static VOID gx_studio_screen_toggle(GX_WIDGET *target1, GX_WIDGET *target2)
  44. {
  45. GX_WIDGET *parent = target1->gx_widget_parent;
  46. if (parent)
  47. {
  48. gx_widget_detach(target1);
  49. gx_widget_attach(parent, target2);
  50. if (target1->gx_widget_status & GX_STATUS_STUDIO_CREATED)
  51. {
  52. gx_widget_delete(target1);
  53. }
  54. }
  55. }
  56. static GX_WIDGET *gx_studio_action_target_get(GX_WIDGET *current, GX_CONST GX_STUDIO_ACTION *action)
  57. {
  58. GX_WIDGET *parent = GX_NULL;
  59. GX_WIDGET *target = GX_NULL;
  60. INT search_depth;
  61. GX_STUDIO_WIDGET *widget_define;
  62. if (action->flags & GX_ACTION_FLAG_DYNAMIC_TARGET)
  63. {
  64. /* dynamically create the target widget */
  65. widget_define = (GX_STUDIO_WIDGET *) action->target;
  66. if(action->flags & GX_ACTION_FLAG_DYNAMIC_PARENT)
  67. {
  68. gx_window_root_find(current, (GX_WINDOW_ROOT **)&parent);
  69. search_depth = GX_SEARCH_DEPTH_INFINITE;
  70. }
  71. else
  72. {
  73. parent = (GX_WIDGET *)action->parent;
  74. search_depth = 1;
  75. }
  76. gx_widget_find(parent, widget_define->widget_id, search_depth, &target);
  77. if (target == GX_NULL)
  78. {
  79. target = gx_studio_widget_create(GX_NULL, widget_define, GX_NULL);
  80. }
  81. if (target)
  82. {
  83. target->gx_widget_status |= GX_STATUS_STUDIO_CREATED;
  84. }
  85. }
  86. else
  87. {
  88. target = (GX_WIDGET *) action->target;
  89. }
  90. return target;
  91. }
  92. static GX_WIDGET *gx_studio_action_target_find(GX_WIDGET *current, GX_CONST GX_STUDIO_ACTION *action)
  93. {
  94. GX_WIDGET *parent = GX_NULL;
  95. GX_WIDGET *target = GX_NULL;
  96. GX_STUDIO_WIDGET *widget_define;
  97. if (action->flags & GX_ACTION_FLAG_DYNAMIC_TARGET)
  98. {
  99. /* Find the dynamically created target */
  100. widget_define = (GX_STUDIO_WIDGET *) action->target;
  101. if(action->flags & GX_ACTION_FLAG_DYNAMIC_PARENT)
  102. {
  103. gx_window_root_find(current, (GX_WINDOW_ROOT **)&parent);
  104. }
  105. else
  106. {
  107. parent = (GX_WIDGET *)action->parent;
  108. }
  109. gx_widget_find(parent, widget_define->widget_id, GX_SEARCH_DEPTH_INFINITE, &target);
  110. }
  111. else
  112. {
  113. target = (GX_WIDGET *) action->target;
  114. }
  115. return target;
  116. }
  117. static GX_WIDGET *gx_studio_action_parent_find(GX_WIDGET *current, GX_CONST GX_STUDIO_ACTION *action)
  118. {
  119. GX_WIDGET *parent = GX_NULL;
  120. GX_STUDIO_WIDGET *widget_define;
  121. if (action->flags & GX_ACTION_FLAG_DYNAMIC_PARENT)
  122. {
  123. /* Find the dynamically created target */
  124. widget_define = (GX_STUDIO_WIDGET *)action->parent;
  125. gx_window_root_find(current, (GX_WINDOW_ROOT **)&parent);
  126. gx_widget_find(parent, widget_define->widget_id, GX_SEARCH_DEPTH_INFINITE, &parent);
  127. }
  128. else
  129. {
  130. parent = (GX_WIDGET *)action->parent;
  131. }
  132. return parent;
  133. }
  134. static VOID gx_studio_animation_execute(GX_WIDGET *current, GX_CONST GX_STUDIO_ACTION *action)
  135. {
  136. GX_ANIMATION *animation;
  137. GX_ANIMATION_INFO animation_info;
  138. GX_WIDGET *parent = GX_NULL;
  139. GX_WIDGET *target = GX_NULL;
  140. gx_system_animation_get(&animation);
  141. if (animation)
  142. {
  143. animation_info = *action->animation;
  144. if((action->flags & GX_ACTION_FLAG_POP_TARGET) ||
  145. (action->flags & GX_ACTION_FLAG_POP_PARENT))
  146. {
  147. gx_system_screen_stack_get((GX_WIDGET **)&parent, &target);
  148. }
  149. if(action->flags & GX_ACTION_FLAG_POP_TARGET)
  150. {
  151. animation_info.gx_animation_target = target;
  152. }
  153. if(action->flags & GX_ACTION_FLAG_POP_PARENT)
  154. {
  155. animation_info.gx_animation_parent = (GX_WIDGET *)parent;
  156. }
  157. if ((!animation_info.gx_animation_target) &&
  158. (action->flags & GX_ACTION_FLAG_DYNAMIC_TARGET))
  159. {
  160. target = gx_studio_action_target_get(current, action);
  161. animation_info.gx_animation_target = target;
  162. }
  163. if (!animation_info.gx_animation_parent)
  164. {
  165. animation_info.gx_animation_parent = gx_studio_action_parent_find(current, action);
  166. }
  167. if (animation_info.gx_animation_target &&
  168. animation_info.gx_animation_parent)
  169. {
  170. gx_animation_start(animation, &animation_info);
  171. }
  172. }
  173. }
  174. UINT gx_studio_auto_event_handler(GX_WIDGET *widget, GX_EVENT *event_ptr, GX_CONST GX_STUDIO_EVENT_PROCESS *record)
  175. {
  176. UINT status = GX_SUCCESS;
  177. GX_CONST GX_STUDIO_ACTION *action;
  178. GX_CONST GX_WIDGET *parent = GX_NULL;
  179. GX_WIDGET *target = GX_NULL;
  180. GX_CONST GX_STUDIO_EVENT_ENTRY *entry = record->event_table;
  181. while(entry->event_type)
  182. {
  183. if (entry->event_type == event_ptr->gx_event_type)
  184. {
  185. if((entry->event_type == GX_EVENT_ANIMATION_COMPLETE) &&
  186. (entry->event_sender != event_ptr->gx_event_sender))
  187. {
  188. entry++;
  189. continue;
  190. }
  191. action = entry->action_list;
  192. while(action->opcode)
  193. {
  194. switch(action->opcode)
  195. {
  196. case GX_ACTION_TYPE_ATTACH:
  197. if((action->flags & GX_ACTION_FLAG_POP_TARGET) ||
  198. (action->flags & GX_ACTION_FLAG_POP_PARENT))
  199. {
  200. gx_system_screen_stack_get((GX_WIDGET **)&parent, &target);
  201. }
  202. if(!(action->flags & GX_ACTION_FLAG_POP_PARENT))
  203. {
  204. parent = action->parent;
  205. }
  206. if(!(action->flags & GX_ACTION_FLAG_POP_TARGET))
  207. {
  208. target = gx_studio_action_target_get(widget, action);
  209. }
  210. if (parent && target)
  211. {
  212. gx_widget_attach(parent, target);
  213. }
  214. break;
  215. case GX_ACTION_TYPE_DETACH:
  216. target = gx_studio_action_target_find(widget, action);
  217. if (target)
  218. {
  219. gx_widget_detach(target);
  220. if (target->gx_widget_status & GX_STATUS_STUDIO_CREATED)
  221. {
  222. gx_widget_delete(target);
  223. }
  224. }
  225. break;
  226. case GX_ACTION_TYPE_TOGGLE:
  227. if(action->flags & GX_ACTION_FLAG_POP_TARGET)
  228. {
  229. gx_system_screen_stack_get(GX_NULL, &target);
  230. }
  231. else
  232. {
  233. target = gx_studio_action_target_get(widget, action);
  234. }
  235. gx_studio_screen_toggle(widget, target);
  236. break;
  237. case GX_ACTION_TYPE_SHOW:
  238. target = gx_studio_action_target_get(widget, action);
  239. if(target)
  240. {
  241. gx_widget_show(target);
  242. }
  243. break;
  244. case GX_ACTION_TYPE_HIDE:
  245. target = gx_studio_action_target_find(widget, action);
  246. if(target)
  247. {
  248. gx_widget_hide(target);
  249. }
  250. break;
  251. case GX_ACTION_TYPE_ANIMATION:
  252. gx_studio_animation_execute(widget, action);
  253. break;
  254. case GX_ACTION_TYPE_WINDOW_EXECUTE:
  255. if((action->flags & GX_ACTION_FLAG_POP_TARGET) ||
  256. (action->flags & GX_ACTION_FLAG_POP_PARENT))
  257. {
  258. gx_system_screen_stack_get((GX_WIDGET **)&parent, &target);
  259. }
  260. if(!(action->flags & GX_ACTION_FLAG_POP_PARENT))
  261. {
  262. parent = widget->gx_widget_parent;
  263. }
  264. if(!(action->flags & GX_ACTION_FLAG_POP_TARGET))
  265. {
  266. target = gx_studio_action_target_get(widget, action);
  267. }
  268. if (parent && target)
  269. {
  270. gx_widget_attach(parent, target);
  271. gx_window_execute((GX_WINDOW *) target, GX_NULL);
  272. }
  273. break;
  274. case GX_ACTION_TYPE_WINDOW_EXECUTE_STOP:
  275. return event_ptr->gx_event_sender;
  276. case GX_ACTION_TYPE_SCREEN_STACK_PUSH:
  277. target = gx_studio_action_target_get(widget, action);
  278. if(target)
  279. {
  280. gx_system_screen_stack_push(target);
  281. }
  282. break;
  283. case GX_ACTION_TYPE_SCREEN_STACK_POP:
  284. gx_system_screen_stack_pop();
  285. break;
  286. case GX_ACTION_TYPE_SCREEN_STACK_RESET:
  287. gx_system_screen_stack_reset();
  288. break;
  289. default:
  290. break;
  291. }
  292. action++;
  293. }
  294. }
  295. entry++;
  296. }
  297. if (record->chain_event_handler)
  298. {
  299. status = record->chain_event_handler(widget, event_ptr);
  300. }
  301. return status;
  302. }
  303. UINT gx_studio_text_button_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
  304. {
  305. UINT status;
  306. GX_TEXT_BUTTON *button = (GX_TEXT_BUTTON *) control_block;
  307. GX_TEXT_BUTTON_PROPERTIES *props = (GX_TEXT_BUTTON_PROPERTIES *) info->properties;
  308. status = gx_text_button_create(button, info->widget_name, parent, props->string_id, info->style, info->widget_id, &info->size);
  309. if (status == GX_SUCCESS)
  310. {
  311. gx_text_button_font_set(button, props->font_id);
  312. #if defined(GUIX_5_4_0_COMPATIBILITY)
  313. gx_text_button_text_color_set(button, props->normal_text_color_id, props->selected_text_color_id);
  314. #else
  315. gx_text_button_text_color_set(button, props->normal_text_color_id, props->selected_text_color_id, props->disabled_text_color_id);
  316. #endif
  317. }
  318. return status;
  319. }
  320. UINT gx_studio_window_create(GX_CONST GX_STUDIO_WIDGET *info, GX_WIDGET *control_block, GX_WIDGET *parent)
  321. {
  322. UINT status;
  323. GX_WINDOW *window = (GX_WINDOW *) control_block;
  324. GX_WINDOW_PROPERTIES *props = (GX_WINDOW_PROPERTIES *) info->properties;
  325. status = gx_window_create(window, info->widget_name, parent, info->style, info->widget_id, &info->size);
  326. if (status == GX_SUCCESS)
  327. {
  328. if (props->wallpaper_id)
  329. {
  330. gx_window_wallpaper_set(window, props->wallpaper_id, info->style & GX_STYLE_TILE_WALLPAPER);
  331. }
  332. }
  333. return status;
  334. }
  335. GX_WINDOW_PROPERTIES window_properties =
  336. {
  337. GX_PIXELMAP_ID_QQ__20201124221312 /* wallpaper pixelmap id */
  338. };
  339. GX_ANIMATION_INFO window_animation_1 = {
  340. (GX_WIDGET *) &window_1,
  341. (GX_WIDGET *) &display_1_root_window,
  342. GX_NULL,
  343. GX_ANIMATION_TRANSLATE, 0, 0, 1,
  344. {0, 50}, {0, 0}, 255, 255, 10
  345. };
  346. GX_STUDIO_ACTION window_on_gx_event_pen_downactions[2] = {
  347. {GX_ACTION_TYPE_ANIMATION, 0, &display_1_root_window, &window_1, &window_animation_1},
  348. {0, 0, GX_NULL, GX_NULL, GX_NULL}
  349. };
  350. static GX_STUDIO_EVENT_ENTRY gx_studio_window_event_table[] = {
  351. { GX_EVENT_PEN_DOWN, 0, window_on_gx_event_pen_downactions},
  352. {0, 0, GX_NULL}
  353. };
  354. GX_STUDIO_EVENT_PROCESS window_event_chain = {gx_studio_window_event_table, (UINT (*)(GX_WIDGET *, GX_EVENT *))gx_window_event_process};
  355. static UINT gx_studio_window_event_process(GX_WIDGET *target, GX_EVENT *event_ptr)
  356. {
  357. return (gx_studio_auto_event_handler(target, event_ptr, &window_event_chain));
  358. }
  359. GX_CONST GX_STUDIO_WIDGET window_define =
  360. {
  361. "window",
  362. GX_TYPE_WINDOW, /* widget type */
  363. GUIX_ID_WINDOW_Logo, /* widget id */
  364. #if defined(GX_WIDGET_USER_DATA)
  365. 0, /* user data */
  366. #endif
  367. GX_STYLE_BORDER_NONE|GX_STYLE_ENABLED, /* style flags */
  368. GX_STATUS_ACCEPTS_FOCUS, /* status flags */
  369. sizeof(WINDOW_CONTROL_BLOCK), /* control block size */
  370. GX_COLOR_ID_WINDOW_FILL, /* normal color id */
  371. GX_COLOR_ID_WINDOW_FILL, /* selected color id */
  372. GX_COLOR_ID_DISABLED_FILL, /* disabled color id */
  373. gx_studio_window_create, /* create function */
  374. GX_NULL, /* drawing function override */
  375. (UINT (*)(GX_WIDGET *, GX_EVENT *)) gx_studio_window_event_process, /* event function override */
  376. {0, 41, 127, 93}, /* widget size */
  377. GX_NULL, /* next widget */
  378. GX_NULL, /* child widget */
  379. 0, /* control block */
  380. (void *) &window_properties /* extended properties */
  381. };
  382. GX_WINDOW_PROPERTIES window_1_properties =
  383. {
  384. 0 /* wallpaper pixelmap id */
  385. };
  386. GX_TEXT_BUTTON_PROPERTIES window_1_button_properties =
  387. {
  388. GX_STRING_ID_STRING_11, /* string id */
  389. GX_FONT_ID_BUTTON, /* font id */
  390. GX_COLOR_ID_BTN_TEXT, /* normal text color */
  391. GX_COLOR_ID_BTN_TEXT, /* selected text color */
  392. GX_COLOR_ID_DISABLED_TEXT /* disabled text color */
  393. };
  394. GX_CONST GX_STUDIO_WIDGET window_1_button_define =
  395. {
  396. "button",
  397. GX_TYPE_TEXT_BUTTON, /* widget type */
  398. GUI_ID_TextButton0, /* widget id */
  399. #if defined(GX_WIDGET_USER_DATA)
  400. 0, /* user data */
  401. #endif
  402. GX_STYLE_BORDER_RAISED|GX_STYLE_ENABLED|GX_STYLE_TEXT_CENTER, /* style flags */
  403. GX_STATUS_ACCEPTS_FOCUS, /* status flags */
  404. sizeof(GX_TEXT_BUTTON), /* control block size */
  405. GX_COLOR_ID_BTN_LOWER, /* normal color id */
  406. GX_COLOR_ID_BTN_UPPER, /* selected color id */
  407. GX_COLOR_ID_DISABLED_FILL, /* disabled color id */
  408. gx_studio_text_button_create, /* create function */
  409. GX_NULL, /* drawing function override */
  410. GX_NULL, /* event function override */
  411. {15, 51, 116, 74}, /* widget size */
  412. GX_NULL, /* no next widget */
  413. GX_NULL, /* no child widgets */
  414. offsetof(WINDOW_1_CONTROL_BLOCK, window_1_button), /* control block */
  415. (void *) &window_1_button_properties /* extended properties */
  416. };
  417. GX_STUDIO_ACTION window_1__gui_id_textbutton0_gx_event_clicked_actions[2] = {
  418. {GX_ACTION_TYPE_TOGGLE, 0, &display_1_root_window, &window, GX_NULL},
  419. {0, 0, GX_NULL, GX_NULL, GX_NULL}
  420. };
  421. static GX_STUDIO_EVENT_ENTRY gx_studio_window_1_event_table[] = {
  422. {GX_SIGNAL(GUI_ID_TextButton0, GX_EVENT_CLICKED), 0, window_1__gui_id_textbutton0_gx_event_clicked_actions},
  423. {0, 0, GX_NULL}
  424. };
  425. GX_STUDIO_EVENT_PROCESS window_1_event_chain = {gx_studio_window_1_event_table, (UINT (*)(GX_WIDGET *, GX_EVENT *))gx_window_event_process};
  426. static UINT gx_studio_window_1_event_process(GX_WIDGET *target, GX_EVENT *event_ptr)
  427. {
  428. return (gx_studio_auto_event_handler(target, event_ptr, &window_1_event_chain));
  429. }
  430. GX_CONST GX_STUDIO_WIDGET window_1_define =
  431. {
  432. "window_1",
  433. GX_TYPE_WINDOW, /* widget type */
  434. GUIX_ID_WINDOW_Main, /* widget id */
  435. #if defined(GX_WIDGET_USER_DATA)
  436. 0, /* user data */
  437. #endif
  438. GX_STYLE_BORDER_NONE|GX_STYLE_ENABLED, /* style flags */
  439. GX_STATUS_ACCEPTS_FOCUS, /* status flags */
  440. sizeof(WINDOW_1_CONTROL_BLOCK), /* control block size */
  441. GX_COLOR_ID_WINDOW_FILL, /* normal color id */
  442. GX_COLOR_ID_WINDOW_FILL, /* selected color id */
  443. GX_COLOR_ID_DISABLED_FILL, /* disabled color id */
  444. gx_studio_window_create, /* create function */
  445. GX_NULL, /* drawing function override */
  446. (UINT (*)(GX_WIDGET *, GX_EVENT *)) gx_studio_window_1_event_process, /* event function override */
  447. {0, 0, 127, 127}, /* widget size */
  448. GX_NULL, /* next widget */
  449. &window_1_button_define, /* child widget */
  450. 0, /* control block */
  451. (void *) &window_1_properties /* extended properties */
  452. };
  453. GX_CONST GX_STUDIO_WIDGET_ENTRY guiapp_widget_table[] =
  454. {
  455. { &window_define, (GX_WIDGET *) &window },
  456. { &window_1_define, (GX_WIDGET *) &window_1 },
  457. {GX_NULL, GX_NULL}
  458. };
  459. static GX_WIDGET *gx_studio_nested_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
  460. {
  461. UINT status = GX_SUCCESS;
  462. GX_WIDGET *widget = GX_NULL;
  463. GX_VALUE list_count = 0;
  464. GX_VALUE list_total_count = 0;
  465. if(parent && (parent->gx_widget_type == GX_TYPE_MENU))
  466. {
  467. list_total_count = ((GX_MENU *)parent)->gx_menu_list_total_count;
  468. }
  469. while(definition && status == GX_SUCCESS)
  470. {
  471. if (definition->create_function)
  472. {
  473. if (definition->style & GX_STYLE_DYNAMICALLY_ALLOCATED)
  474. {
  475. status = gx_widget_allocate(&widget, definition->control_block_size);
  476. if (status != GX_SUCCESS)
  477. {
  478. return GX_NULL;
  479. }
  480. }
  481. else
  482. {
  483. if (control == GX_NULL)
  484. {
  485. return GX_NULL;
  486. }
  487. widget = (GX_WIDGET *) (control + definition->control_block_offset);
  488. }
  489. status = definition->create_function(definition, widget, parent);
  490. if(list_count < list_total_count)
  491. {
  492. gx_menu_insert((GX_MENU *)parent, widget);
  493. ((GX_MENU *)parent)->gx_menu_list_total_count--;
  494. list_count++;
  495. }
  496. if (status == GX_SUCCESS)
  497. {
  498. if (definition->widget_type != GX_TYPE_TEMPLATE)
  499. {
  500. #if defined(GUIX_5_4_0_COMPATIBILITY)
  501. gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id);
  502. #else
  503. gx_widget_fill_color_set(widget, definition->normal_fill_color_id, definition->selected_fill_color_id, definition->disabled_fill_color_id);
  504. #endif
  505. }
  506. if (!(definition->status & GX_STATUS_ACCEPTS_FOCUS))
  507. {
  508. gx_widget_status_remove(widget, GX_STATUS_ACCEPTS_FOCUS);
  509. }
  510. if (definition->draw_function)
  511. {
  512. gx_widget_draw_set(widget, definition->draw_function);
  513. }
  514. if (definition->event_function)
  515. {
  516. gx_widget_event_process_set(widget, definition->event_function);
  517. }
  518. #if defined(GX_WIDGET_USER_DATA)
  519. widget->gx_widget_user_data = definition->user_data;
  520. #endif
  521. if (definition->child_widget)
  522. {
  523. gx_studio_nested_widget_create(control, definition->child_widget, widget);
  524. }
  525. }
  526. definition = definition->next_widget;
  527. }
  528. }
  529. return widget;
  530. }
  531. GX_WIDGET *gx_studio_widget_create(GX_BYTE *control, GX_CONST GX_STUDIO_WIDGET *definition, GX_WIDGET *parent)
  532. {
  533. GX_WIDGET *widget;
  534. widget = gx_studio_nested_widget_create(control, definition, GX_NULL);
  535. if (parent && widget)
  536. {
  537. gx_widget_attach(parent, widget);
  538. }
  539. return widget;
  540. }
  541. UINT gx_studio_named_widget_create(char *name, GX_WIDGET *parent, GX_WIDGET **new_widget)
  542. {
  543. UINT status = GX_FAILURE;
  544. GX_CONST GX_STUDIO_WIDGET_ENTRY *entry = guiapp_widget_table;
  545. GX_WIDGET *widget = GX_NULL;
  546. while(entry->widget_information)
  547. {
  548. if (!strcmp(name, entry->widget_information->widget_name))
  549. {
  550. widget = gx_studio_widget_create((GX_BYTE *) entry->widget, entry->widget_information, parent);
  551. if (widget)
  552. {
  553. status = GX_SUCCESS;
  554. }
  555. break;
  556. }
  557. entry++;
  558. }
  559. if (new_widget)
  560. {
  561. *new_widget = widget;
  562. }
  563. return status;
  564. }
  565. UINT gx_studio_display_configure(USHORT display, UINT (*driver)(GX_DISPLAY *),
  566. GX_UBYTE language, USHORT theme, GX_WINDOW_ROOT **return_root)
  567. {
  568. GX_CONST GX_THEME *theme_ptr;
  569. GX_RECTANGLE size;
  570. GX_STUDIO_DISPLAY_INFO *display_info = &guiapp_display_table[display];
  571. /* create the requested display */
  572. gx_display_create(display_info->display,
  573. display_info->name,
  574. driver,
  575. (GX_VALUE) display_info->x_resolution,
  576. (GX_VALUE) display_info->y_resolution);
  577. /* install the request theme */
  578. if(display_info->theme_table)
  579. {
  580. theme_ptr = display_info->theme_table[theme];
  581. if(theme_ptr)
  582. {
  583. gx_display_color_table_set(display_info->display, theme_ptr->theme_color_table, theme_ptr->theme_color_table_size);
  584. /* install the color palette if required */
  585. if (display_info->display->gx_display_driver_palette_set &&
  586. theme_ptr->theme_palette != NULL)
  587. {
  588. display_info->display->gx_display_driver_palette_set(display_info->display, theme_ptr->theme_palette, theme_ptr->theme_palette_size);
  589. }
  590. gx_display_font_table_set(display_info->display, theme_ptr->theme_font_table, theme_ptr->theme_font_table_size);
  591. gx_display_pixelmap_table_set(display_info->display, theme_ptr->theme_pixelmap_table, theme_ptr->theme_pixelmap_table_size);
  592. gx_system_scroll_appearance_set(theme_ptr->theme_vertical_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_vertical_scrollbar_appearance);
  593. gx_system_scroll_appearance_set(theme_ptr->theme_horizontal_scroll_style, (GX_SCROLLBAR_APPEARANCE *) &theme_ptr->theme_horizontal_scrollbar_appearance);
  594. 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);
  595. gx_display_active_language_set(display_info->display, language);
  596. }
  597. }
  598. /* create the canvas for this display */
  599. gx_canvas_create(display_info->canvas,
  600. display_info->canvas_name,
  601. display_info->display,
  602. GX_CANVAS_MANAGED | GX_CANVAS_VISIBLE,
  603. display_info->x_resolution,
  604. display_info->y_resolution,
  605. display_info->canvas_memory,
  606. display_info->canvas_memory_size);
  607. /* Create the root window for this canvas */
  608. gx_utility_rectangle_define(&size,
  609. 0, 0,
  610. (GX_VALUE) (display_info->x_resolution - 1),
  611. (GX_VALUE) (display_info->y_resolution - 1));
  612. gx_window_root_create(display_info->root_window,
  613. display_info->name,
  614. display_info->canvas, GX_STYLE_NONE, 0, &size);
  615. if (return_root)
  616. {
  617. *return_root = display_info->root_window;
  618. }
  619. return GX_SUCCESS;
  620. }
  621. #undef GUIX_STUDIO_GENERATED_FILE