From 6d868629c96f53358f1b7e2f6ac687d7b7195b35 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Fri, 12 Jun 2020 00:50:51 +0200 Subject: added widget labels --- code/fe310/eos/eve/widget/label.c | 25 +++++++++++++++++++++++++ code/fe310/eos/eve/widget/label.h | 10 ++++++++++ 2 files changed, 35 insertions(+) create mode 100644 code/fe310/eos/eve/widget/label.c create mode 100644 code/fe310/eos/eve/widget/label.h (limited to 'code/fe310/eos/eve') 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 +#include + +#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 + +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 -- cgit v1.2.3