diff options
author | Uros Majstorovic <majstor@majstor.org> | 2021-02-28 21:00:13 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2021-02-28 21:00:13 +0100 |
commit | 82a6206422ed658a99716fbd18e33942cebc833b (patch) | |
tree | f849699cd7a31175c57c3d9583d2162786138e3c /fw/fe310/eos/eve/widget/pagew.c | |
parent | 6a4c8a1f11f6a7bd57b0fd618f455bcdecbfe538 (diff) |
font property moved to widget base
Diffstat (limited to 'fw/fe310/eos/eve/widget/pagew.c')
-rw-r--r-- | fw/fe310/eos/eve/widget/pagew.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/fw/fe310/eos/eve/widget/pagew.c b/fw/fe310/eos/eve/widget/pagew.c index 2142cb9..51528da 100644 --- a/fw/fe310/eos/eve/widget/pagew.c +++ b/fw/fe310/eos/eve/widget/pagew.c @@ -1,22 +1,23 @@ #include <stdlib.h> #include <string.h> +#include "unicode.h" + #include "eve.h" #include "eve_kbd.h" -#include "unicode.h" +#include "eve_font.h" #include "screen/screen.h" #include "screen/window.h" #include "screen/view.h" #include "screen/page.h" -#include "font.h" #include "label.h" #include "widget.h" #include "pagew.h" -int eve_pagew_create(EVEPageWidget *widget, EVERect *g, EVEPageSpec *spec) { - eve_pagew_init(widget, g, spec->font, spec->title, spec->constructor); +int eve_pagew_create(EVEPageWidget *widget, EVERect *g, EVEFont *font, EVEPageSpec *spec) { + eve_pagew_init(widget, g, font, spec->title, spec->constructor); return EVE_OK; } @@ -25,18 +26,16 @@ void eve_pagew_init(EVEPageWidget *widget, EVERect *g, EVEFont *font, char *titl EVEWidget *_widget = &widget->w; memset(widget, 0, sizeof(EVEPageWidget)); - eve_widget_init(_widget, EVE_WIDGET_TYPE_PAGE, g, eve_pagew_touch, eve_pagew_draw, NULL); - eve_pagew_update(widget, font, title, constructor); + eve_widget_init(_widget, EVE_WIDGET_TYPE_PAGE, g, font, eve_pagew_touch, eve_pagew_draw, NULL); + eve_pagew_update(widget, title, constructor); } -void eve_pagew_update(EVEPageWidget *widget, EVEFont *font, char *title, eve_view_constructor_t constructor) { +void eve_pagew_update(EVEPageWidget *widget, char *title, eve_view_constructor_t constructor) { EVEWidget *_widget = &widget->w; - if (font) widget->font = font; if (title) widget->title = title; if (constructor) widget->constructor = constructor; - if (_widget->g.w == 0) _widget->g.w = eve_font_str_w(font, widget->title); - if (_widget->g.h == 0) _widget->g.h = eve_font_h(font); + if (_widget->g.h == 0) _widget->g.h = eve_font_h(_widget->font); } int eve_pagew_touch(EVEWidget *_widget, EVEPage *page, EVETouch *t, uint16_t evt) { @@ -60,7 +59,7 @@ uint8_t eve_pagew_draw(EVEWidget *_widget, EVEPage *page, uint8_t tag0) { } _widget->tagN = tag0; - eve_cmd(CMD_TEXT, "hhhhs", _widget->g.x, _widget->g.y, widget->font->id, 0, widget->title); + eve_cmd(CMD_TEXT, "hhhhs", _widget->g.x, _widget->g.y, _widget->font->id, 0, widget->title); return _widget->tagN; } |