Changeset 08d5f8b in mainline for uspace/app/nav/menu.c
- Timestamp:
- 2021-10-19T20:54:17Z (3 years ago)
- Children:
- 2651dc5
- Parents:
- bdb2a72f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/nav/menu.c
rbdb2a72f r08d5f8b 43 43 #include "nav.h" 44 44 45 static void nav_file_exit(ui_menu_entry_t *, void *);46 47 45 /** Create navigator menu. 48 46 * … … 55 53 nav_menu_t *menu; 56 54 ui_menu_t *mfile; 55 ui_menu_entry_t *mopen; 56 ui_menu_entry_t *mfsep; 57 57 ui_menu_entry_t *mexit; 58 58 gfx_rect_t arect; … … 76 76 goto error; 77 77 78 rc = ui_menu_entry_create(mfile, "Open", "Enter", &mopen); 79 if (rc != EOK) 80 goto error; 81 82 ui_menu_entry_set_cb(mopen, nav_menu_file_open, (void *) menu); 83 84 rc = ui_menu_entry_sep_create(mfile, &mfsep); 85 if (rc != EOK) 86 goto error; 87 78 88 rc = ui_menu_entry_create(mfile, "Exit", "Ctrl-Q", &mexit); 79 89 if (rc != EOK) 80 90 goto error; 81 91 82 ui_menu_entry_set_cb(mexit, nav_ file_exit, (void *) menu);92 ui_menu_entry_set_cb(mexit, nav_menu_file_exit, (void *) menu); 83 93 84 94 ui_window_get_app_rect(menu->window, &arect); … … 94 104 nav_menu_destroy(menu); 95 105 return rc; 106 } 107 108 /** Set navigator menu callbacks. 109 * 110 * @param menu Menu 111 * @param cb Callbacks 112 * @param arg Argument to callback functions 113 */ 114 void nav_menu_set_cb(nav_menu_t *menu, nav_menu_cb_t *cb, void *arg) 115 { 116 menu->cb = cb; 117 menu->cb_arg = arg; 96 118 } 97 119 … … 118 140 } 119 141 142 /** File / Open menu entry selected. 143 * 144 * @param mentry Menu entry 145 * @param arg Argument (navigator_t *) 146 */ 147 void nav_menu_file_open(ui_menu_entry_t *mentry, void *arg) 148 { 149 nav_menu_t *menu = (nav_menu_t *)arg; 150 151 if (menu->cb != NULL && menu->cb->file_open != NULL) 152 menu->cb->file_open(menu->cb_arg); 153 } 154 120 155 /** File / Exit menu entry selected. 121 156 * … … 123 158 * @param arg Argument (navigator_t *) 124 159 */ 125 static void nav_file_exit(ui_menu_entry_t *mentry, void *arg)160 void nav_menu_file_exit(ui_menu_entry_t *mentry, void *arg) 126 161 { 127 nav igator_t *navigator = (navigator_t *)arg;162 nav_menu_t *menu = (nav_menu_t *)arg; 128 163 129 ui_quit(navigator->ui); 164 if (menu->cb != NULL && menu->cb->file_exit != NULL) 165 menu->cb->file_exit(menu->cb_arg); 130 166 } 131 167
Note:
See TracChangeset
for help on using the changeset viewer.