Changeset 6186f9f in mainline for uspace/lib/ui/src/menuentry.c
- Timestamp:
- 2021-04-13T17:20:20Z (4 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f3a7b0d
- Parents:
- b8b64a8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/src/menuentry.c
rb8b64a8 r6186f9f 55 55 menu_entry_vpad = 4, 56 56 menu_entry_column_pad = 8, 57 menu_entry_sep_height = 2, 57 58 menu_entry_hpad_text = 1, 58 59 menu_entry_vpad_text = 0, 59 menu_entry_column_pad_text = 2 60 menu_entry_column_pad_text = 2, 61 menu_entry_sep_height_text = 1 60 62 }; 61 63 … … 107 109 } 108 110 111 /** Create new separator menu entry. 112 * 113 * @param menu Menu 114 * @param rmentry Place to store pointer to new menu entry 115 * @return EOK on success, ENOMEM if out of memory 116 */ 117 errno_t ui_menu_entry_sep_create(ui_menu_t *menu, ui_menu_entry_t **rmentry) 118 { 119 ui_menu_entry_t *mentry; 120 errno_t rc; 121 122 rc = ui_menu_entry_create(menu, "", "", &mentry); 123 if (rc != EOK) 124 return rc; 125 126 /* Need to adjust menu height when changing to separator */ 127 menu->total_h -= ui_menu_entry_height(mentry); 128 mentry->separator = true; 129 menu->total_h += ui_menu_entry_height(mentry); 130 131 *rmentry = mentry; 132 return EOK; 133 } 134 109 135 /** Destroy menu entry. 110 136 * … … 238 264 } 239 265 240 gfx_font_get_metrics(res->font, &metrics); 241 height = metrics.ascent + metrics.descent + 1; 266 if (mentry->separator) { 267 /* Separator menu entry */ 268 if (res->textmode) 269 height = menu_entry_sep_height_text; 270 else 271 height = menu_entry_sep_height; 272 } else { 273 /* Normal menu entry */ 274 gfx_font_get_metrics(res->font, &metrics); 275 height = metrics.ascent + metrics.descent + 1; 276 } 277 242 278 return height + 2 * vpad; 243 279 } … … 255 291 gfx_color_t *bg_color; 256 292 ui_menu_entry_geom_t geom; 293 gfx_rect_t rect; 257 294 errno_t rc; 258 295 … … 292 329 goto error; 293 330 331 if (mentry->separator) { 332 rect.p0 = geom.caption_pos; 333 rect.p1.x = geom.shortcut_pos.x; 334 rect.p1.y = rect.p0.y + 2; 335 rc = ui_paint_bevel(res->gc, &rect, res->wnd_shadow_color, 336 res->wnd_highlight_color, 1, NULL); 337 if (rc != EOK) 338 goto error; 339 } 340 294 341 rc = gfx_update(res->gc); 295 342 if (rc != EOK) … … 309 356 { 310 357 if (mentry->held) 358 return; 359 360 if (mentry->separator) 311 361 return; 312 362
Note:
See TracChangeset
for help on using the changeset viewer.