diff options
author | Uros Majstorovic <majstor@majstor.org> | 2020-06-12 00:50:51 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2020-06-12 00:50:51 +0200 |
commit | 6d868629c96f53358f1b7e2f6ac687d7b7195b35 (patch) | |
tree | 9e04d24676d29b1d3d55fa92e3dd3568e627c8d5 /code | |
parent | 294d4533489e9ed6b7e71c63a1faa9722a2621c6 (diff) |
added widget labels
Diffstat (limited to 'code')
-rw-r--r-- | code/fe310/eos/eve/widget/label.c | 25 | ||||
-rw-r--r-- | code/fe310/eos/eve/widget/label.h | 10 |
2 files changed, 35 insertions, 0 deletions
diff --git a/code/fe310/eos/eve/widget/label.c b/code/fe310/eos/eve/widget/label.c new file mode 100644 index 0000000..6013a22 --- /dev/null +++ b/code/fe310/eos/eve/widget/label.c @@ -0,0 +1,25 @@ +#include <stdlib.h> +#include <string.h> + +#include "eve.h" +#include "eve_kbd.h" + +#include "screen/screen.h" +#include "screen/window.h" +#include "screen/page.h" +#include "screen/font.h" + +#include "label.h" + +void eve_label_init(EVELabel *label, EVERect *g, char *title, EVEFont *font) { + memset(label, 0, sizeof(EVELabel)); + if (g) label->g = *g; + label->title = title; + label->font = font; + if (label->g.w == 0) label->g.w = eve_font_string_width(font, label->title); + if (label->g.h == 0) label->g.h = eve_font_height(font); +} + +void eve_label_draw(EVELabel *label) { + eve_cmd(CMD_TEXT, "hhhhs", label->g.x, label->g.y, label->font->id, 0, label->title); +}
\ No newline at end of file diff --git a/code/fe310/eos/eve/widget/label.h b/code/fe310/eos/eve/widget/label.h new file mode 100644 index 0000000..0c623d3 --- /dev/null +++ b/code/fe310/eos/eve/widget/label.h @@ -0,0 +1,10 @@ +#include <stdint.h> + +typedef struct EVELabel { + EVERect g; + char *title; + EVEFont *font; +} EVELabel; + +void eve_label_init(EVELabel *label, EVERect *g, char *title, EVEFont *font); +void eve_label_draw(EVELabel *label);
\ No newline at end of file |