Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/uidemo/uidemo.c

    ref4d684 r9a07ee3  
    11/*
    2  * Copyright (c) 2023 Jiri Svoboda
     2 * Copyright (c) 2024 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    108108static void uidemo_file_load(ui_menu_entry_t *, void *);
    109109static void uidemo_file_message(ui_menu_entry_t *, void *);
     110static void uidemo_file_confirmation(ui_menu_entry_t *, void *);
    110111static void uidemo_file_exit(ui_menu_entry_t *, void *);
    111112static void uidemo_edit_modify(ui_menu_entry_t *, void *);
     
    340341}
    341342
    342 /** Display a message window.
     343/** Display a message window with OK button.
    343344 *
    344345 * @param demo UI demo
     
    405406        mdparams.caption = "Message For You";
    406407        mdparams.text = "Hello, world!";
     408
     409        rc = ui_msg_dialog_create(demo->ui, &mdparams, &dialog);
     410        if (rc != EOK) {
     411                printf("Error creating message dialog.\n");
     412                return;
     413        }
     414
     415        ui_msg_dialog_set_cb(dialog, &msg_dialog_cb, &demo);
     416}
     417
     418/** File / Confirmation menu entry selected.
     419 *
     420 * @param mentry Menu entry
     421 * @param arg Argument (demo)
     422 */
     423static void uidemo_file_confirmation(ui_menu_entry_t *mentry, void *arg)
     424{
     425        ui_demo_t *demo = (ui_demo_t *) arg;
     426        ui_msg_dialog_params_t mdparams;
     427        ui_msg_dialog_t *dialog;
     428        errno_t rc;
     429
     430        ui_msg_dialog_params_init(&mdparams);
     431        mdparams.caption = "Confirmation";
     432        mdparams.text = "This will not actually do anything. Proceed?";
     433        mdparams.choice = umdc_ok_cancel;
    407434
    408435        rc = ui_msg_dialog_create(demo->ui, &mdparams, &dialog);
     
    741768        }
    742769
     770        /* Only allow making the window larger */
     771        gfx_rect_dims(&params.rect, &params.min_size);
     772
    743773        rc = ui_window_create(ui, &params, &window);
    744774        if (rc != EOK) {
     
    778808
    779809        ui_menu_entry_set_cb(mmsg, uidemo_file_message, (void *) &demo);
     810
     811        rc = ui_menu_entry_create(demo.mfile, "~C~onfirmation", "", &mmsg);
     812        if (rc != EOK) {
     813                printf("Error creating menu.\n");
     814                return rc;
     815        }
     816
     817        ui_menu_entry_set_cb(mmsg, uidemo_file_confirmation, (void *) &demo);
    780818
    781819        rc = ui_menu_entry_create(demo.mfile, "~L~oad", "", &mload);
Note: See TracChangeset for help on using the changeset viewer.