Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/src/menuentry.c

    r6a0b2cc r71edd430  
    11/*
    2  * Copyright (c) 2023 Jiri Svoboda
     2 * Copyright (c) 2022 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    163163}
    164164
    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 
    185165/** Get first menu entry in menu.
    186166 *
     
    261241         * This needs to work even if the menu is not open, so we cannot
    262242         * use the menu's resource, which is only created after the menu
    263          * is open (and its window is created). Use the parent window's
     243         * is open (and its window is created). Use the menu bar's
    264244         * resource instead.
    265245         */
    266         res = ui_window_get_res(mentry->menu->parent);
     246        res = ui_window_get_res(mentry->menu->mbar->window);
    267247
    268248        *caption_w = ui_text_width(res->font, mentry->caption);
     
    287267         * This needs to work even if the menu is not open, so we cannot
    288268         * use the menu's resource, which is only created after the menu
    289          * is open (and its window is created). Use the parent window's
     269         * is open (and its window is created). Use the menu bar's
    290270         * resource instead.
    291271         */
    292         res = ui_window_get_res(menu->parent);
     272        res = ui_window_get_res(menu->mbar->window);
    293273
    294274        if (res->textmode)
     
    326306         * This needs to work even if the menu is not open, so we cannot
    327307         * use the menu's resource, which is only created after the menu
    328          * is open (and its window is created). Use the parent window's
     308         * is open (and its window is created). Use the menu bar's
    329309         * resource instead.
    330310         */
    331         res = ui_window_get_res(mentry->menu->parent);
     311        res = ui_window_get_res(mentry->menu->mbar->window);
    332312
    333313        if (res->textmode) {
     
    392372                fmt.hgl_color = res->wnd_sel_text_hgl_color;
    393373                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;
    398374        } else {
    399375                fmt.color = res->wnd_text_color;
     
    469445                return;
    470446
    471         if (mentry->separator || mentry->disabled)
     447        if (mentry->separator)
    472448                return;
    473449
     
    498474void ui_menu_entry_activate(ui_menu_entry_t *mentry)
    499475{
    500         /* Close menu */
    501         ui_menu_close_req(mentry->menu);
     476        /* Deactivate menu bar, close menu */
     477        ui_menu_bar_deactivate(mentry->menu->mbar);
    502478
    503479        /* Call back */
Note: See TracChangeset for help on using the changeset viewer.