summaryrefslogtreecommitdiff
path: root/src/widget/label.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/widget/label.c')
-rw-r--r--src/widget/label.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/widget/label.c b/src/widget/label.c
index 30ca0ec..5c0c00a 100644
--- a/src/widget/label.c
+++ b/src/widget/label.c
@@ -3,22 +3,21 @@
3#include "uiLibrary.h" 3#include "uiLibrary.h"
4#include "widget.h" 4#include "widget.h"
5 5
6uiLabel* uiMakeLabel(const char* text) { 6uiLabel* uiMakeLabel(uiPtr parent, const char* text) {
7 assert(text); 7 assert(text);
8 8
9 uiLabel* label = UI_NEW(uiLabel); 9 uiLabel* label = UI_NEW(uiLabel);
10 10
11 *label = (uiLabel){ 11 *label = (uiLabel){
12 .widget = 12 .widget =
13 (uiWidget){ 13 (uiWidget){.type = uiTypeLabel,
14 .type = uiTypeLabel,
15 .rect = 14 .rect =
16 (uiRect){ 15 (uiRect){.width = (int)strlen(text) *
17 .width = 16 g_ui.font->header.glyph_width,
18 (int)strlen(text) * g_ui.font->header.glyph_width, 17 .height = g_ui.font->header.glyph_height}},
19 .height = g_ui.font->header.glyph_height}},
20 .text = string_new(text), 18 .text = string_new(text),
21 }; 19 };
20 WidgetSetParent(uiMakeLabelPtr(label), parent);
22 return label; 21 return label;
23} 22}
24 23