summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/eve/widget/strw.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2021-05-20 18:36:10 +0200
committerUros Majstorovic <majstor@majstor.org>2021-05-20 18:36:10 +0200
commitad43c402b05ef05c7bf5a7104a4f896e65b3ac4d (patch)
tree170f55788ea5a815f6fd2307ff3342cb556e9c19 /fw/fe310/eos/eve/widget/strw.c
parent2aaa54722c78e4739026d8ed608e8c7ff162a38c (diff)
string widget update added
Diffstat (limited to 'fw/fe310/eos/eve/widget/strw.c')
-rw-r--r--fw/fe310/eos/eve/widget/strw.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fw/fe310/eos/eve/widget/strw.c b/fw/fe310/eos/eve/widget/strw.c
index 232e52c..e78cf46 100644
--- a/fw/fe310/eos/eve/widget/strw.c
+++ b/fw/fe310/eos/eve/widget/strw.c
@@ -62,6 +62,18 @@ void eve_strw_init(EVEStrWidget *widget, EVERect *g, EVEPage *page, EVEFont *fon
if (_widget->g.h == 0) _widget->g.h = eve_font_h(widget->font);
}
+int eve_strw_update(EVEStrWidget *widget) {
+ int rv, str_len;
+
+ rv = utf8_verify(widget->str, widget->str_size, &str_len);
+ if (rv != UTF_OK) {
+ if (str_len >= widget->str_size) str_len = 0;
+ widget->str[str_len] = '\0';
+ }
+ widget->str_len = str_len;
+ return (rv == UTF_OK) ? EVE_OK : EVE_ERR;
+}
+
void eve_strw_destroy(EVEStrWidget *widget) {
eve_free(widget->str);
}