Changeset 80d4aea in mainline
- Timestamp:
- 2021-09-17T15:53:48Z (3 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6df564c
- Parents:
- 5ecac7e
- Location:
- uspace
- Files:
-
- 5 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/uidemo/uidemo.c
r5ecac7e r80d4aea 49 49 #include <ui/msgdialog.h> 50 50 #include <ui/pbutton.h> 51 #include <ui/promptdialog.h> 51 52 #include <ui/resource.h> 52 53 #include <ui/ui.h> … … 89 90 static void uidemo_file_message(ui_menu_entry_t *, void *); 90 91 static void uidemo_file_exit(ui_menu_entry_t *, void *); 92 static void uidemo_edit_modify(ui_menu_entry_t *, void *); 91 93 92 94 static void file_dialog_bok(ui_file_dialog_t *, void *, const char *); … … 98 100 .bcancel = file_dialog_bcancel, 99 101 .close = file_dialog_close 102 }; 103 104 static void prompt_dialog_bok(ui_prompt_dialog_t *, void *, const char *); 105 static void prompt_dialog_bcancel(ui_prompt_dialog_t *, void *); 106 static void prompt_dialog_close(ui_prompt_dialog_t *, void *); 107 108 static ui_prompt_dialog_cb_t prompt_dialog_cb = { 109 .bok = prompt_dialog_bok, 110 .bcancel = prompt_dialog_bcancel, 111 .close = prompt_dialog_close 100 112 }; 101 113 … … 229 241 } 230 242 231 /** File /load menu entry selected.243 /** File / Load menu entry selected. 232 244 * 233 245 * @param mentry Menu entry … … 253 265 } 254 266 255 /** File /message menu entry selected.267 /** File / Message menu entry selected. 256 268 * 257 269 * @param mentry Menu entry … … 278 290 } 279 291 280 /** File /exit menu entry selected.292 /** File / Exit menu entry selected. 281 293 * 282 294 * @param mentry Menu entry … … 288 300 289 301 ui_quit(demo->ui); 302 } 303 304 /** Edit / Modify menu entry selected. 305 * 306 * @param mentry Menu entry 307 * @param arg Argument (demo) 308 */ 309 static void uidemo_edit_modify(ui_menu_entry_t *mentry, void *arg) 310 { 311 ui_demo_t *demo = (ui_demo_t *) arg; 312 ui_prompt_dialog_params_t pdparams; 313 ui_prompt_dialog_t *dialog; 314 errno_t rc; 315 316 ui_prompt_dialog_params_init(&pdparams); 317 pdparams.caption = "Modify Entry Text"; 318 pdparams.prompt = "Enter New Text"; 319 320 rc = ui_prompt_dialog_create(demo->ui, &pdparams, &dialog); 321 if (rc != EOK) { 322 printf("Error creating message dialog.\n"); 323 return; 324 } 325 326 ui_prompt_dialog_set_cb(dialog, &prompt_dialog_cb, demo); 290 327 } 291 328 … … 346 383 } 347 384 348 /** Message dialog close request.385 /** File dialog close request. 349 386 * 350 387 * @param dialog File dialog … … 357 394 (void) demo; 358 395 ui_file_dialog_destroy(dialog); 396 } 397 398 /** Prompt dialog OK button press. 399 * 400 * @param dialog Prompt dialog 401 * @param arg Argument (ui_demo_t *) 402 * @param text Submitted text 403 */ 404 static void prompt_dialog_bok(ui_prompt_dialog_t *dialog, void *arg, 405 const char *text) 406 { 407 ui_demo_t *demo = (ui_demo_t *) arg; 408 409 ui_prompt_dialog_destroy(dialog); 410 ui_entry_set_text(demo->entry, text); 411 } 412 413 /** Prompt dialog cancel button press. 414 * 415 * @param dialog File dialog 416 * @param arg Argument (ui_demo_t *) 417 */ 418 static void prompt_dialog_bcancel(ui_prompt_dialog_t *dialog, void *arg) 419 { 420 ui_demo_t *demo = (ui_demo_t *) arg; 421 422 (void) demo; 423 ui_prompt_dialog_destroy(dialog); 424 } 425 426 /** Prompt dialog close request. 427 * 428 * @param dialog File dialog 429 * @param arg Argument (ui_demo_t *) 430 */ 431 static void prompt_dialog_close(ui_prompt_dialog_t *dialog, void *arg) 432 { 433 ui_demo_t *demo = (ui_demo_t *) arg; 434 435 (void) demo; 436 ui_prompt_dialog_destroy(dialog); 359 437 } 360 438 … … 405 483 ui_menu_entry_t *mbar; 406 484 ui_menu_entry_t *mfoobar; 485 ui_menu_entry_t *msep; 407 486 ui_menu_entry_t *mexit; 487 ui_menu_entry_t *mmodify; 408 488 ui_menu_entry_t *mabout; 409 489 errno_t rc; … … 499 579 } 500 580 501 rc = ui_menu_entry_sep_create(demo.mfile, &m exit);581 rc = ui_menu_entry_sep_create(demo.mfile, &msep); 502 582 if (rc != EOK) { 503 583 printf("Error creating menu.\n"); … … 518 598 return rc; 519 599 } 600 601 rc = ui_menu_entry_create(demo.medit, "Modify", "", &mmodify); 602 if (rc != EOK) { 603 printf("Error creating menu.\n"); 604 return rc; 605 } 606 607 ui_menu_entry_set_cb(mmodify, uidemo_edit_modify, (void *) &demo); 520 608 521 609 rc = ui_menu_create(demo.mbar, "Preferences", &demo.mpreferences); -
uspace/lib/ui/meson.build
r5ecac7e r80d4aea 44 44 'src/pbutton.c', 45 45 'src/popup.c', 46 'src/promptdialog.c', 46 47 'src/rbutton.c', 47 48 'src/resource.c', … … 68 69 'test/pbutton.c', 69 70 'test/popup.c', 71 'test/promptdialog.c', 70 72 'test/rbutton.c', 71 73 'test/resource.c',
Note:
See TracChangeset
for help on using the changeset viewer.