Changes in uspace/lib/ui/src/checkbox.c [806d761:307d4d2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/src/checkbox.c
r806d761 r307d4d2 1 1 /* 2 * Copyright (c) 202 4Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 52 52 checkbox_box_h = 16, 53 53 checkbox_label_margin = 8, 54 checkbox_cross_n = 5,55 checkbox_cross_w = 2,56 checkbox_cross_h = 257 54 }; 58 55 … … 139 136 } 140 137 141 /** Set check boxrectangle.142 * 143 * @param checkbox Check box144 * @param rect New check boxrectangle138 /** Set button rectangle. 139 * 140 * @param checkbox Button 141 * @param rect New button rectangle 145 142 */ 146 143 void ui_checkbox_set_rect(ui_checkbox_t *checkbox, gfx_rect_t *rect) 147 144 { 148 145 checkbox->rect = *rect; 149 }150 151 /** Return if check box is checked.152 *153 * @param checkbox Check box154 * @return @c true iff check box is checked155 */156 bool ui_checkbox_get_checked(ui_checkbox_t *checkbox)157 {158 return checkbox->checked;159 }160 161 /** Set check box checked state.162 *163 * @param checkbox Check box164 * @param checked @c true iff checkbox should be checked165 */166 void ui_checkbox_set_checked(ui_checkbox_t *checkbox, bool checked)167 {168 checkbox->checked = checked;169 146 } 170 147 … … 211 188 212 189 if (checkbox->checked) { 213 rc = gfx_set_color(checkbox->res->gc, 214 checkbox->res->entry_fg_color); 190 box_center.x = (box_inside.p0.x + box_inside.p1.x) / 2; 191 box_center.y = (box_inside.p0.y + box_inside.p1.y) / 2; 192 193 gfx_text_fmt_init(&fmt); 194 fmt.color = checkbox->res->entry_fg_color; 195 fmt.halign = gfx_halign_center; 196 fmt.valign = gfx_valign_center; 197 198 rc = gfx_puttext(checkbox->res->font, &box_center, &fmt, "X"); 215 199 if (rc != EOK) 216 200 goto error; 217 218 box_center.x = (box_inside.p0.x + box_inside.p1.x) / 2 - 1;219 box_center.y = (box_inside.p0.y + box_inside.p1.y) / 2 - 1;220 221 rc = ui_paint_cross(checkbox->res->gc, &box_center,222 checkbox_cross_n, checkbox_cross_w, checkbox_cross_h);223 if (rc != EOK)224 goto error;225 201 } 226 202 … … 231 207 232 208 gfx_text_fmt_init(&fmt); 233 fmt.font = checkbox->res->font;234 209 fmt.color = checkbox->res->wnd_text_color; 235 210 fmt.halign = gfx_halign_left; 236 211 fmt.valign = gfx_valign_center; 237 212 238 rc = gfx_puttext( &pos, &fmt, checkbox->caption);213 rc = gfx_puttext(checkbox->res->font, &pos, &fmt, checkbox->caption); 239 214 if (rc != EOK) 240 215 goto error; … … 269 244 270 245 gfx_text_fmt_init(&fmt); 271 fmt.font = checkbox->res->font;272 246 fmt.color = depressed ? checkbox->res->entry_act_bg_color : 273 247 checkbox->res->wnd_text_color; … … 275 249 fmt.valign = gfx_valign_top; 276 250 277 rc = gfx_puttext(&pos, &fmt, checkbox->checked ? "[X]" : "[ ]"); 251 rc = gfx_puttext(checkbox->res->font, &pos, &fmt, 252 checkbox->checked ? "[X]" : "[ ]"); 278 253 if (rc != EOK) 279 254 goto error; … … 284 259 fmt.color = checkbox->res->wnd_text_color; 285 260 286 rc = gfx_puttext( &pos, &fmt, checkbox->caption);261 rc = gfx_puttext(checkbox->res->font, &pos, &fmt, checkbox->caption); 287 262 if (rc != EOK) 288 263 goto error; … … 422 397 } 423 398 break; 424 case POS_DCLICK:425 break;426 399 } 427 400
Note:
See TracChangeset
for help on using the changeset viewer.