Changeset 86fff971 in mainline for uspace/lib/ui/src/checkbox.c


Ignore:
Timestamp:
2022-04-04T18:49:30Z (2 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fd05ea6
Parents:
d68239a1
Message:

'X' does not mark the spot

Stop misusing 'X' character as a cross mark, create a routine for
drawing a cross and use it as a custom decoration for the close button.
Also use it for checkbox cross.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/src/checkbox.c

    rd68239a1 r86fff971  
    11/*
    2  * Copyright (c) 2021 Jiri Svoboda
     2 * Copyright (c) 2022 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    5252        checkbox_box_h = 16,
    5353        checkbox_label_margin = 8,
     54        checkbox_cross_n = 5,
     55        checkbox_cross_w = 2,
     56        checkbox_cross_h = 2
    5457};
    5558
     
    188191
    189192        if (checkbox->checked) {
    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.font = checkbox->res->font;
    195                 fmt.color = checkbox->res->entry_fg_color;
    196                 fmt.halign = gfx_halign_center;
    197                 fmt.valign = gfx_valign_center;
    198 
    199                 rc = gfx_puttext(&box_center, &fmt, "X");
     193                rc = gfx_set_color(checkbox->res->gc,
     194                    checkbox->res->entry_fg_color);
     195                if (rc != EOK)
     196                        goto error;
     197
     198                box_center.x = (box_inside.p0.x + box_inside.p1.x) / 2 - 1;
     199                box_center.y = (box_inside.p0.y + box_inside.p1.y) / 2 - 1;
     200
     201                rc = ui_paint_cross(checkbox->res->gc, &box_center,
     202                    checkbox_cross_n, checkbox_cross_w, checkbox_cross_h);
    200203                if (rc != EOK)
    201204                        goto error;
Note: See TracChangeset for help on using the changeset viewer.