summaryrefslogtreecommitdiff
path: root/src/widget/widget_label.c
diff options
context:
space:
mode:
authorConnor Thomson <blumatrikz@gmail.com>2026-09-08 18:27:39 -0700
committerConnor Thomson <blumatrikz@gmail.com>2026-09-08 18:27:39 -0700
commitf1ddc12b68b4e4c8087962de25260470e6df2bea (patch)
tree7d0440a6402a9b0ef75ded23fa64b68534255bba /src/widget/widget_label.c
parent6025860a61386bf767b29c3ec5fd0d31285f1056 (diff)
Add tuxanci2 files
Diffstat (limited to 'src/widget/widget_label.c')
-rw-r--r--src/widget/widget_label.c66
1 files changed, 0 insertions, 66 deletions
diff --git a/src/widget/widget_label.c b/src/widget/widget_label.c
deleted file mode 100644
index b696302..0000000
--- a/src/widget/widget_label.c
+++ /dev/null
@@ -1,66 +0,0 @@
-#include <stdlib.h>
-#include <assert.h>
-
-#include "main.h"
-#include "interface.h"
-#include "font.h"
-#include "widget_label.h"
-#include "widget.h"
-
-widget_t *label_new(char *text, int x, int y, int bind)
-{
- widget_label_t *new;
-
- new = malloc(sizeof(widget_label_t));
- new->text = strdup(text);
- new->bind = bind;
- font_text_size(text, &(new->w), &(new->h));
-
- return widget_new(WIDGET_TYPE_LABEL, x, y, new->w, new->h, new);
-}
-
-void label_draw(widget_t *widget)
-{
- widget_label_t *p;
-
- assert(widget != NULL);
- assert(widget->type == WIDGET_TYPE_LABEL);
-
- p = (widget_label_t *) widget->private_data;
-
- switch (p->bind) {
- case WIDGET_LABEL_RIGHT:
- font_draw(p->text, widget->x - p->w, widget->y + p->h / 2, COLOR_WHITE);
- break;
- case WIDGET_LABEL_LEFT:
- font_draw(p->text, widget->x, widget->y + widget->h / 2, COLOR_WHITE);
- break;
- case WIDGET_LABEL_CENTER:
- font_draw(p->text, widget->x - p->w / 2, widget->y + p->h / 2, COLOR_WHITE);
- break;
- default:
- fatal("Unknown dimension for label placement");
- break;
- }
-}
-
-void label_event(widget_t *widget)
-{
- assert(widget != NULL);
- assert(widget->type == WIDGET_TYPE_LABEL);
-}
-
-void label_destroy(widget_t *widget)
-{
- widget_label_t *p;
-
- assert(widget != NULL);
- assert(widget->type == WIDGET_TYPE_LABEL);
-
- p = (widget_label_t *) widget->private_data;
-
- free(p->text);
- free(p);
-
- widget_destroy(widget);
-}