Changes in uspace/lib/ui/src/menu.c [ff6e91b:d7f82635] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/src/menu.c
rff6e91b rd7f82635 58 58 menu_frame_h = 4, 59 59 menu_frame_w_text = 2, 60 menu_frame_h_text = 1, 61 menu_frame_h_margin_text = 1 60 menu_frame_h_text = 1 62 61 }; 63 62 … … 277 276 * @return EOK on success or an error code 278 277 */ 279 errno_t ui_menu_paint_bg_gfx(ui_menu_t *menu, gfx_coord2_t *spos)280 {281 ui_resource_t *res;282 ui_menu_geom_t geom;283 gfx_rect_t bg_rect;284 errno_t rc;285 286 res = ui_menu_get_res(menu);287 ui_menu_get_geom(menu, spos, &geom);288 289 /* Paint menu frame */290 291 rc = gfx_set_color(res->gc, res->wnd_face_color);292 if (rc != EOK)293 goto error;294 295 rc = ui_paint_outset_frame(res, &geom.outer_rect, &bg_rect);296 if (rc != EOK)297 goto error;298 299 /* Paint menu background */300 301 rc = gfx_set_color(res->gc, res->wnd_face_color);302 if (rc != EOK)303 goto error;304 305 rc = gfx_fill_rect(res->gc, &bg_rect);306 if (rc != EOK)307 goto error;308 309 return EOK;310 error:311 return rc;312 }313 314 /** Paint menu.315 *316 * @param menu Menu317 * @param spos Starting position (top-left corner)318 * @return EOK on success or an error code319 */320 errno_t ui_menu_paint_bg_text(ui_menu_t *menu, gfx_coord2_t *spos)321 {322 ui_resource_t *res;323 ui_menu_geom_t geom;324 gfx_rect_t rect;325 errno_t rc;326 327 res = ui_menu_get_res(menu);328 ui_menu_get_geom(menu, spos, &geom);329 330 /* Paint menu background */331 332 rc = gfx_set_color(res->gc, res->wnd_face_color);333 if (rc != EOK)334 goto error;335 336 rc = gfx_fill_rect(res->gc, &geom.outer_rect);337 if (rc != EOK)338 goto error;339 340 /* Paint menu box */341 342 rect = geom.outer_rect;343 rect.p0.x += menu_frame_h_margin_text;344 rect.p1.x -= menu_frame_h_margin_text;345 346 rc = ui_paint_text_box(res, &rect, ui_box_single, res->wnd_face_color);347 if (rc != EOK)348 goto error;349 350 return EOK;351 error:352 return rc;353 }354 355 /** Paint menu.356 *357 * @param menu Menu358 * @param spos Starting position (top-left corner)359 * @return EOK on success or an error code360 */361 278 errno_t ui_menu_paint(ui_menu_t *menu, gfx_coord2_t *spos) 362 279 { … … 365 282 ui_menu_entry_t *mentry; 366 283 ui_menu_geom_t geom; 284 gfx_rect_t bg_rect; 367 285 errno_t rc; 368 286 … … 370 288 ui_menu_get_geom(menu, spos, &geom); 371 289 372 /* Paint menu frame and background */ 373 if (res->textmode) 374 rc = ui_menu_paint_bg_text(menu, spos); 375 else 376 rc = ui_menu_paint_bg_gfx(menu, spos); 290 /* Paint menu frame */ 291 292 rc = gfx_set_color(res->gc, res->wnd_face_color); 293 if (rc != EOK) 294 goto error; 295 296 rc = ui_paint_outset_frame(res, &geom.outer_rect, &bg_rect); 297 if (rc != EOK) 298 goto error; 299 300 /* Paint menu background */ 301 302 rc = gfx_set_color(res->gc, res->wnd_face_color); 303 if (rc != EOK) 304 goto error; 305 306 rc = gfx_fill_rect(res->gc, &bg_rect); 377 307 if (rc != EOK) 378 308 goto error;
Note:
See TracChangeset
for help on using the changeset viewer.