Changeset 58a67050 in mainline for uspace/lib/ui/src/label.c
- Timestamp:
- 2020-10-21T22:26:33Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 08a79303
- Parents:
- a2f173b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/src/label.c
ra2f173b r58a67050 68 68 69 69 label->res = resource; 70 label->halign = gfx_halign_left; 70 71 *rlabel = label; 71 72 return EOK; … … 92 93 { 93 94 label->rect = *rect; 95 } 96 97 /** Set label horizontal text alignment. 98 * 99 * @param label Label 100 * @param halign Horizontal alignment 101 */ 102 void ui_label_set_halign(ui_label_t *label, gfx_halign_t halign) 103 { 104 label->halign = halign; 94 105 } 95 106 … … 135 146 goto error; 136 147 137 pos = label->rect.p0; 148 switch (label->halign) { 149 case gfx_halign_left: 150 case gfx_halign_justify: 151 pos.x = label->rect.p0.x; 152 break; 153 case gfx_halign_center: 154 pos.x = (label->rect.p0.x + label->rect.p1.x) / 2; 155 break; 156 case gfx_halign_right: 157 pos.y = label->rect.p1.x; 158 break; 159 } 160 161 pos.y = label->rect.p0.y; 138 162 139 163 gfx_text_fmt_init(&fmt); 140 fmt.halign = gfx_halign_left;164 fmt.halign = label->halign; 141 165 fmt.valign = gfx_valign_top; 142 166
Note:
See TracChangeset
for help on using the changeset viewer.