Changeset 86fff971 in mainline for uspace/lib/ui/src/wdecor.c
- Timestamp:
- 2022-04-04T18:49:30Z (3 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fd05ea6
- Parents:
- d68239a1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/src/wdecor.c
rd68239a1 r86fff971 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 50 50 51 51 static void ui_wdecor_btn_clicked(ui_pbutton_t *, void *); 52 static errno_t ui_wdecor_btn_close_paint(ui_pbutton_t *, void *, 53 gfx_coord2_t *); 52 54 53 55 static ui_pbutton_cb_t ui_wdecor_btn_close_cb = { 54 56 .clicked = ui_wdecor_btn_clicked 57 }; 58 59 static ui_pbutton_decor_ops_t ui_wdecor_btn_close_decor_ops = { 60 .paint = ui_wdecor_btn_close_paint 55 61 }; 56 62 … … 62 68 wdecor_tbar_h = 22, 63 69 wdecor_frame_w = 4, 64 wdecor_frame_w_text = 1 70 wdecor_frame_w_text = 1, 71 wdecor_close_cross_n = 5, 72 wdecor_close_cross_w = 2, 73 wdecor_close_cross_h = 1 65 74 }; 66 75 … … 98 107 ui_pbutton_set_cb(wdecor->btn_close, &ui_wdecor_btn_close_cb, 99 108 (void *)wdecor); 109 110 ui_pbutton_set_decor_ops(wdecor->btn_close, 111 &ui_wdecor_btn_close_decor_ops, (void *)wdecor); 100 112 101 113 wdecor->res = resource; … … 647 659 } 648 660 661 /** Paint close button decoration. 662 * 663 * @param pbutton Push button 664 * @param arg Argument (ui_wdecor_t *) 665 * @param pos Center position 666 */ 667 static errno_t ui_wdecor_btn_close_paint(ui_pbutton_t *pbutton, 668 void *arg, gfx_coord2_t *pos) 669 { 670 ui_wdecor_t *wdecor = (ui_wdecor_t *)arg; 671 gfx_coord2_t p; 672 errno_t rc; 673 674 rc = gfx_set_color(wdecor->res->gc, wdecor->res->btn_text_color); 675 if (rc != EOK) 676 return rc; 677 678 p.x = pos->x - 1; 679 p.y = pos->y - 1; 680 return ui_paint_cross(wdecor->res->gc, &p, wdecor_close_cross_n, 681 wdecor_close_cross_w, wdecor_close_cross_h); 682 } 683 649 684 /** @} 650 685 */
Note:
See TracChangeset
for help on using the changeset viewer.