diff options
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 |