Changeset d68239a1 in mainline for uspace/lib/ui/src/pbutton.c
- Timestamp:
- 2022-04-04T14:48:41Z (2 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 86fff971
- Parents:
- 0d1d0ea
- git-author:
- Jiri Svoboda <jiri@…> (2022-04-03 17:48:17)
- git-committer:
- Jiri Svoboda <jiri@…> (2022-04-04 14:48:41)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/src/pbutton.c
r0d1d0ea rd68239a1 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 32 32 /** 33 33 * @file Push button 34 * 35 * Push button either uses text as decoration, or it can use a caller-provided 36 * function to paint the decoration. 34 37 */ 35 38 … … 136 139 } 137 140 141 /** Set push button decoration ops. 142 * 143 * @param pbutton Push button 144 * @param ops Push button decoration callbacks 145 * @param arg Decoration ops argument 146 */ 147 void ui_pbutton_set_decor_ops(ui_pbutton_t *pbutton, 148 ui_pbutton_decor_ops_t *ops, void *arg) 149 { 150 pbutton->decor_ops = ops; 151 pbutton->decor_arg = arg; 152 } 153 138 154 /** Set button rectangle. 139 155 * … … 306 322 } 307 323 308 gfx_text_fmt_init(&fmt); 309 fmt.font = pbutton->res->font; 310 fmt.color = pbutton->res->btn_text_color; 311 fmt.halign = gfx_halign_center; 312 fmt.valign = gfx_valign_center; 313 314 rc = gfx_puttext(&pos, &fmt, pbutton->caption); 315 if (rc != EOK) 316 goto error; 324 if (pbutton->decor_ops != NULL && pbutton->decor_ops->paint != NULL) { 325 /* Custom decoration */ 326 rc = pbutton->decor_ops->paint(pbutton, pbutton->decor_arg, 327 &pos); 328 if (rc != EOK) 329 goto error; 330 } else { 331 /* Text decoration */ 332 gfx_text_fmt_init(&fmt); 333 fmt.font = pbutton->res->font; 334 fmt.color = pbutton->res->btn_text_color; 335 fmt.halign = gfx_halign_center; 336 fmt.valign = gfx_valign_center; 337 338 rc = gfx_puttext(&pos, &fmt, pbutton->caption); 339 if (rc != EOK) 340 goto error; 341 } 317 342 318 343 rc = ui_pbutton_paint_frame(pbutton);
Note:
See TracChangeset
for help on using the changeset viewer.