Ignore:
File:
1 edited

Legend:

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

    r4583015 rb41564c  
    11/*
    2  * Copyright (c) 2021 Jiri Svoboda
     2 * Copyright (c) 2020 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    134134{
    135135        label->halign = halign;
    136 }
    137 
    138 /** Set label vertical text alignment.
    139  *
    140  * @param label Label
    141  * @param valign Vertical alignment
    142  */
    143 void ui_label_set_valign(ui_label_t *label, gfx_valign_t valign)
    144 {
    145         label->valign = valign;
    146136}
    147137
     
    200190        }
    201191
    202         switch (label->valign) {
    203         case gfx_valign_top:
    204                 pos.y = label->rect.p0.y;
    205                 break;
    206         case gfx_valign_center:
    207                 pos.y = (label->rect.p0.y + label->rect.p1.y) / 2;
    208                 break;
    209         case gfx_valign_bottom:
    210                 pos.y = label->rect.p1.y;
    211                 break;
    212         case gfx_valign_baseline:
    213                 return EINVAL;
    214         }
     192        pos.y = label->rect.p0.y;
    215193
    216194        gfx_text_fmt_init(&fmt);
    217         fmt.font = label->res->font;
    218         fmt.color = label->res->wnd_text_color;
    219195        fmt.halign = label->halign;
    220         fmt.valign = label->valign;
    221 
    222         rc = gfx_puttext(&pos, &fmt, label->text);
    223         if (rc != EOK)
    224                 goto error;
    225 
    226         rc = gfx_update(label->res->gc);
     196        fmt.valign = gfx_valign_top;
     197
     198        rc = gfx_set_color(label->res->gc, label->res->wnd_text_color);
     199        if (rc != EOK)
     200                goto error;
     201
     202        rc = gfx_puttext(label->res->font, &pos, &fmt, label->text);
    227203        if (rc != EOK)
    228204                goto error;
Note: See TracChangeset for help on using the changeset viewer.