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


Ignore:
Timestamp:
2022-03-07T16:10:44Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ca2680d
Parents:
5c27e77
Message:

Add font to gfx_text_fmt_t

This is quite logical and saves us one argument that we need to pass to
all text formatting functions.

File:
1 edited

Legend:

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

    r5c27e77 r4583015  
    192192
    193193                gfx_text_fmt_init(&fmt);
     194                fmt.font = checkbox->res->font;
    194195                fmt.color = checkbox->res->entry_fg_color;
    195196                fmt.halign = gfx_halign_center;
    196197                fmt.valign = gfx_valign_center;
    197198
    198                 rc = gfx_puttext(checkbox->res->font, &box_center, &fmt, "X");
     199                rc = gfx_puttext(&box_center, &fmt, "X");
    199200                if (rc != EOK)
    200201                        goto error;
     
    207208
    208209        gfx_text_fmt_init(&fmt);
     210        fmt.font = checkbox->res->font;
    209211        fmt.color = checkbox->res->wnd_text_color;
    210212        fmt.halign = gfx_halign_left;
    211213        fmt.valign = gfx_valign_center;
    212214
    213         rc = gfx_puttext(checkbox->res->font, &pos, &fmt, checkbox->caption);
     215        rc = gfx_puttext(&pos, &fmt, checkbox->caption);
    214216        if (rc != EOK)
    215217                goto error;
     
    244246
    245247        gfx_text_fmt_init(&fmt);
     248        fmt.font = checkbox->res->font;
    246249        fmt.color = depressed ? checkbox->res->entry_act_bg_color :
    247250            checkbox->res->wnd_text_color;
     
    249252        fmt.valign = gfx_valign_top;
    250253
    251         rc = gfx_puttext(checkbox->res->font, &pos, &fmt,
    252             checkbox->checked ? "[X]" : "[ ]");
     254        rc = gfx_puttext(&pos, &fmt, checkbox->checked ? "[X]" : "[ ]");
    253255        if (rc != EOK)
    254256                goto error;
     
    259261        fmt.color = checkbox->res->wnd_text_color;
    260262
    261         rc = gfx_puttext(checkbox->res->font, &pos, &fmt, checkbox->caption);
     263        rc = gfx_puttext(&pos, &fmt, checkbox->caption);
    262264        if (rc != EOK)
    263265                goto error;
Note: See TracChangeset for help on using the changeset viewer.