--- a/ui/common/types.c Sun Oct 13 16:05:06 2024 +0200 +++ b/ui/common/types.c Sun Oct 13 19:37:00 2024 +0200 @@ -281,6 +281,15 @@ return r; } +UIEXPORT UiGeneric* ui_generic_new(UiContext *ctx, char *name) { + UiGeneric *g = ui_malloc(ctx, sizeof(UiGeneric)); + memset(g, 0, sizeof(UiGeneric)); + if(name) { + uic_reg_var(ctx, name, UI_VAR_GENERIC, g); + } + return g; +} + void ui_int_set(UiInteger* i, int64_t value) { if (i && i->set) { @@ -389,6 +398,12 @@ to->obj = from->obj; } +void uic_generic_copy(UiGeneric *from, UiGeneric *to) { + to->get = from->get; + to->get_type = from->get_type; + to->set = from->set; + to->obj = from->obj; +} void uic_int_save(UiInteger *i) { if(!i->obj) return; @@ -416,6 +431,11 @@ r->get(r); } +void uic_generic_save(UiGeneric *g) { + if(!g->obj) return; + g->get(g); +} + void uic_int_unbind(UiInteger *i) { i->get = NULL; @@ -462,6 +482,13 @@ l->obj = NULL; } +void uic_generic_unbind(UiGeneric *g) { + g->get = NULL; + g->get_type = NULL; + g->set = NULL; + g->obj = NULL; +} + UIEXPORT UiListSelection ui_list_getselection(UiList *list) { if (list->getselection) {