ui/common/context.c

changeset 113
dde28a806552
parent 112
c3f2f16fa4b8
--- a/ui/common/context.c	Sun Oct 19 21:20:08 2025 +0200
+++ b/ui/common/context.c	Mon Nov 10 21:52:51 2025 +0100
@@ -549,7 +549,7 @@
     cxListFree(groups);
 }
 
-void ui_widget_set_groups2(UiContext *ctx, UIWIDGET widget, ui_enablefunc enable, int *groups, int ngroups) {
+void ui_widget_set_groups2(UiContext *ctx, UIWIDGET widget, ui_enablefunc enable, const int *groups, int ngroups) {
     if(enable == NULL) {
         enable = (ui_enablefunc)ui_set_enabled;
     }
@@ -561,7 +561,7 @@
     cxListFree(ls);
 }
 
-void ui_widget_set_visibility_states(UiContext *ctx, UIWIDGET widget, int *states, int nstates) {
+void ui_widget_set_visibility_states(UiContext *ctx, UIWIDGET widget, const int *states, int nstates) {
     ui_widget_set_groups2(ctx, widget, (ui_enablefunc)ui_set_visible, states, nstates);
 }
 
@@ -622,7 +622,7 @@
     return ctx ? cxRealloc(ctx->allocator, ptr, size) : NULL;
 }
 
-UIEXPORT char* ui_strdup(UiContext *ctx, const char *str) {
+char* ui_strdup(UiContext *ctx, const char *str) {
     if(!ctx) {
         return NULL;
     }
@@ -630,3 +630,11 @@
     cxmutstr d = cx_strdup_a(ctx->allocator, s);
     return d.ptr;
 }
+
+void  ui_reg_destructor(UiContext *ctx, void *data, ui_destructor_func destr) {
+    cxMempoolRegister(ctx->mp, data, (cx_destructor_func)destr);
+}
+
+void  ui_set_destructor(void *mem, ui_destructor_func destr) {
+    cxMempoolSetDestructor(mem, (cx_destructor_func)destr);
+}

mercurial