summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/eve/widget/freew.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2022-08-09 22:23:08 +0200
committerUros Majstorovic <majstor@majstor.org>2022-08-09 22:23:08 +0200
commit3f913efda03fd840cd526ef72e6f397c7da61bd7 (patch)
tree08f62c93e0e0660fdb7beba32276ff1ceb7a8a3c /fw/fe310/eos/eve/widget/freew.c
parent810dde21ee65653c15606917b19566cfbaaf165e (diff)
code layout
Diffstat (limited to 'fw/fe310/eos/eve/widget/freew.c')
-rw-r--r--fw/fe310/eos/eve/widget/freew.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/fw/fe310/eos/eve/widget/freew.c b/fw/fe310/eos/eve/widget/freew.c
index 86c2686..e7591da 100644
--- a/fw/fe310/eos/eve/widget/freew.c
+++ b/fw/fe310/eos/eve/widget/freew.c
@@ -8,15 +8,7 @@
#include "screen/window.h"
#include "screen/page.h"
-#include "label.h"
#include "widget.h"
-#include "freew.h"
-
-int eve_freew_create(EVEFreeWidget *widget, EVERect *g, EVEPage *page, EVEFreeSpec *spec) {
- eve_freew_init(widget, g, page, spec->draw, spec->touch, spec->putc);
-
- return EVE_OK;
-}
void eve_freew_init(EVEFreeWidget *widget, EVERect *g, EVEPage *page, eve_freew_draw_t draw, eve_freew_touch_t touch, eve_kbd_input_handler_t putc) {
EVEWidget *_widget = &widget->w;
@@ -25,16 +17,15 @@ void eve_freew_init(EVEFreeWidget *widget, EVERect *g, EVEPage *page, eve_freew_
eve_widget_init(_widget, EVE_WIDGET_TYPE_FREE, g, page, eve_freew_draw, eve_freew_touch, putc);
widget->_draw = draw;
widget->_touch = touch;
- widget->w.putc = putc;
}
-void eve_freew_tag(EVEFreeWidget *widget) {
- EVEWidget *_widget = &widget->w;
+int eve_freew_create(EVEWidget *_widget, EVEWidgetSpec *spec, EVEPage *page) {
+ EVEFreeWidget *widget = (EVEFreeWidget *)_widget;
+ EVEFreeSpec *tspec = &spec->tspec.free;
- if (_widget->tagN != EVE_NOTAG) {
- eve_cmd_dl(TAG(_widget->tagN));
- _widget->tagN++;
- }
+ eve_freew_init(widget, &spec->g, page, tspec->draw, tspec->touch, tspec->putc);
+
+ return EVE_OK;
}
uint8_t eve_freew_draw(EVEWidget *_widget, uint8_t tag0) {
@@ -49,6 +40,18 @@ uint8_t eve_freew_draw(EVEWidget *_widget, uint8_t tag0) {
int eve_freew_touch(EVEWidget *_widget, EVETouch *touch, uint16_t evt) {
EVEFreeWidget *widget = (EVEFreeWidget *)_widget;
+ int ret;
+
+ ret = widget->_touch(widget, touch, evt);
+ if (ret) eve_widget_set_focus(_widget, NULL);
+ return ret;
+}
- return widget->_touch(widget, touch, evt);
+void eve_freew_tag(EVEFreeWidget *widget) {
+ EVEWidget *_widget = &widget->w;
+
+ if (_widget->tagN != EVE_NOTAG) {
+ eve_cmd_dl(TAG(_widget->tagN));
+ _widget->tagN++;
+ }
}