Changeset 0563982 in mainline for uspace/lib/ui/src/menuentry.c


Ignore:
Timestamp:
2021-04-01T21:31:24Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Children:
2e1dbf7d
Parents:
379cd75f
Message:

Menu entries need to stretch to the width of the menu

File:
1 edited

Legend:

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

    r379cd75f r0563982  
    6969{
    7070        ui_menu_entry_t *mentry;
     71        gfx_coord_t width;
    7172
    7273        mentry = calloc(1, sizeof(ui_menu_entry_t));
     
    8283        mentry->menu = menu;
    8384        list_append(&mentry->lentries, &menu->entries);
     85
     86        /* Update accumulated menu entry dimensions */
     87        width = ui_menu_entry_width(mentry);
     88        if (width > menu->max_w)
     89                menu->max_w = width;
     90        menu->total_h += ui_menu_entry_height(mentry);
    8491
    8592        *rmentry = mentry;
     
    372379        gfx_coord_t hpad;
    373380        gfx_coord_t vpad;
    374         const char *caption;
    375381        gfx_coord_t width;
    376382
     
    385391        }
    386392
    387         caption = mentry->caption;
    388         width = gfx_text_width(res->font, caption) + 2 * hpad;
     393        width = mentry->menu->max_w;
    389394        geom->text_pos.x = pos->x + hpad;
    390395        geom->text_pos.y = pos->y + vpad;
Note: See TracChangeset for help on using the changeset viewer.