ui/common/types.c

changeset 3
f154867f54dc
parent 0
2483f517c562
child 13
5a8762fcfecc
--- a/ui/common/types.c	Sat Jan 27 17:50:19 2024 +0100
+++ b/ui/common/types.c	Sun Jan 28 16:31:34 2024 +0100
@@ -277,6 +277,66 @@
 }
 
 
+void ui_int_set(UiInteger* i, int64_t value) {
+    if (i && i->set) {
+        i->set(i, value);
+    }
+}
+
+int64_t ui_int_get(UiInteger* i) {
+    if (i) {
+        return i->get ? i->get(i) : i->value;
+    } else {
+        return 0;
+    }
+}
+
+void ui_double_set(UiDouble* d, double value) {
+    if (d && d->set) {
+        d->set(d, value);
+    }
+}
+
+double ui_double_get(UiDouble* d) {
+    if (d) {
+        return d->get ? d->get(d) : d->value;
+    }
+    else {
+        return 0;
+    }
+}
+
+void ui_string_set(UiString* s, const char* value) {
+    if (s && s->set) {
+        s->set(s, value);
+    }
+}
+
+char* ui_string_get(UiString* s) {
+    if (s) {
+        return s->get ? s->get(s) : s->value.ptr;
+    }
+    else {
+        return 0;
+    }
+}
+
+void ui_text_set(UiText* s, const char* value) {
+    if (s && s->set) {
+        s->set(s, value);
+    }
+}
+
+char* ui_text_get(UiText* s) {
+    if (s) {
+        return s->get ? s->get(s) : s->value.ptr;
+    }
+    else {
+        return 0;
+    }
+}
+
+
 // private functions
 void uic_int_copy(UiInteger *from, UiInteger *to) {
     to->get = from->get;

mercurial