Changeset 1c6c3e1d in mainline for uspace/lib/ui/src/menuentry.c
- Timestamp:
- 2023-10-22T17:55:33Z (14 months ago)
- Branches:
- ticket/834-toolchain-update
- Children:
- 350ec74
- Parents:
- 315d487 (diff), 133461c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/src/menuentry.c
r315d487 r1c6c3e1d 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 163 163 } 164 164 165 /** Set menu entry disabled flag. 166 * 167 * @param mentry Menu entry 168 * @param disabled @c true iff entry is to be disabled, @c false otherwise 169 */ 170 void ui_menu_entry_set_disabled(ui_menu_entry_t *mentry, bool disabled) 171 { 172 mentry->disabled = disabled; 173 } 174 175 /** Get menu entry disabled flag. 176 * 177 * @param mentry Menu entry 178 * @return disabled @c true iff entry is disabled, @c false otherwise 179 */ 180 bool ui_menu_entry_is_disabled(ui_menu_entry_t *mentry) 181 { 182 return mentry->disabled; 183 } 184 165 185 /** Get first menu entry in menu. 166 186 * … … 241 261 * This needs to work even if the menu is not open, so we cannot 242 262 * use the menu's resource, which is only created after the menu 243 * is open (and its window is created). Use the menu bar's263 * is open (and its window is created). Use the parent window's 244 264 * resource instead. 245 265 */ 246 res = ui_window_get_res(mentry->menu-> mbar->window);266 res = ui_window_get_res(mentry->menu->parent); 247 267 248 268 *caption_w = ui_text_width(res->font, mentry->caption); … … 267 287 * This needs to work even if the menu is not open, so we cannot 268 288 * use the menu's resource, which is only created after the menu 269 * is open (and its window is created). Use the menu bar's289 * is open (and its window is created). Use the parent window's 270 290 * resource instead. 271 291 */ 272 res = ui_window_get_res(menu-> mbar->window);292 res = ui_window_get_res(menu->parent); 273 293 274 294 if (res->textmode) … … 306 326 * This needs to work even if the menu is not open, so we cannot 307 327 * use the menu's resource, which is only created after the menu 308 * is open (and its window is created). Use the menu bar's328 * is open (and its window is created). Use the parent window's 309 329 * resource instead. 310 330 */ 311 res = ui_window_get_res(mentry->menu-> mbar->window);331 res = ui_window_get_res(mentry->menu->parent); 312 332 313 333 if (res->textmode) { … … 372 392 fmt.hgl_color = res->wnd_sel_text_hgl_color; 373 393 bg_color = res->wnd_sel_text_bg_color; 394 } else if (mentry->disabled) { 395 fmt.color = res->wnd_dis_text_color; 396 fmt.hgl_color = res->wnd_dis_text_color; 397 bg_color = res->wnd_face_color; 374 398 } else { 375 399 fmt.color = res->wnd_text_color; … … 445 469 return; 446 470 447 if (mentry->separator )471 if (mentry->separator || mentry->disabled) 448 472 return; 449 473 … … 474 498 void ui_menu_entry_activate(ui_menu_entry_t *mentry) 475 499 { 476 /* Deactivate menu bar, close menu */477 ui_menu_ bar_deactivate(mentry->menu->mbar);500 /* Close menu */ 501 ui_menu_close_req(mentry->menu); 478 502 479 503 /* Call back */
Note:
See TracChangeset
for help on using the changeset viewer.