ui/ui/toolkit.h

changeset 141
cc2170ea05ad
parent 140
c03c338a7dcf
child 142
46448d38885c
--- a/ui/ui/toolkit.h	Fri Nov 10 17:17:14 2017 +0100
+++ b/ui/ui/toolkit.h	Fri Nov 10 18:04:40 2017 +0100
@@ -97,6 +97,8 @@
 typedef struct UiList       UiList;
 typedef struct UiRange      UiRange;
 
+typedef struct UiStr        UiStr;
+
 /* begin opaque types */
 typedef struct UiContext    UiContext;
 typedef struct UiContainer  UiContainer;
@@ -114,6 +116,8 @@
 
 typedef int(*ui_threadfunc)(void*);
 
+typedef void(*ui_freefunc)(void*);
+
 struct UiObject {
     /*
      * native widget
@@ -179,6 +183,11 @@
     UiObserver *next;
 };
 
+struct UiStr {
+    char *ptr;
+    void (*free)(void *v);
+};
+
 struct UiInteger {
     int  (*get)(UiInteger*);
     void (*set)(UiInteger*, int);
@@ -193,7 +202,7 @@
     void  (*set)(UiString*, char*);
     void  *obj;
     
-    char* value;
+    UiStr value;
     UiObserver *observers;
 };
 
@@ -207,7 +216,7 @@
     void  (*selection)(UiText*, int*, int*); /* text, begin, end */
     int   (*length)(UiText*);
     void  (*remove)(UiText*, int, int); /* text, begin, end */
-    char  *value;
+    UiStr value;
     int   pos;
     void  *obj;
     void  *undomgr;

mercurial