summaryrefslogtreecommitdiff
path: root/src/widget/label.c
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2024-07-13 10:52:24 -0700
committer3gg <3gg@shellblade.net>2024-07-13 10:52:24 -0700
commita4294e4a94189dffb1fdf99c9a60d87d77272926 (patch)
tree2e92f7c95116861bc39f4dae1d0ab5d388550000 /src/widget/label.c
parentcf9579d7546c04dbc708bd8719e3f935a28088bd (diff)
Restructure project.
Diffstat (limited to 'src/widget/label.c')
-rw-r--r--src/widget/label.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/widget/label.c b/src/widget/label.c
new file mode 100644
index 0000000..30ca0ec
--- /dev/null
+++ b/src/widget/label.c
@@ -0,0 +1,28 @@
1#include <ui.h>
2
3#include "uiLibrary.h"
4#include "widget.h"
5
6uiLabel* uiMakeLabel(const char* text) {
7 assert(text);
8
9 uiLabel* label = UI_NEW(uiLabel);
10
11 *label = (uiLabel){
12 .widget =
13 (uiWidget){
14 .type = uiTypeLabel,
15 .rect =
16 (uiRect){
17 .width =
18 (int)strlen(text) * g_ui.font->header.glyph_width,
19 .height = g_ui.font->header.glyph_height}},
20 .text = string_new(text),
21 };
22 return label;
23}
24
25const char* uiLabelGetText(const uiLabel* label) {
26 assert(label);
27 return string_data(label->text);
28}