--- a/ui/common/context.h Sat Dec 05 11:54:58 2020 +0100 +++ b/ui/common/context.h Sat Dec 05 17:50:22 2020 +0100 @@ -60,18 +60,17 @@ UiObject *obj; UcxMempool *mempool; - UcxMap *bound; // key: char* value: UiVar* deprecated - UcxMap *vars; // key: char* value: UiVar* deprecated - void *document; // deprecated + void *document; + UcxList *documents; - UcxMap *vars2; // manually created context vars + UcxMap *vars; // manually created context vars UcxMap *vars_unbound; // unbound vars created by widgets UcxList *groups; // int list UcxList *group_widgets; // UiGroupWidget* list - void (*set_document)(UiContext *ctx, void *document); // deprecated - void (*detach_document)(UiContext *ctx); // deprecated + void (*attach_document)(UiContext *ctx, void *document); + void (*detach_document2)(UiContext *ctx, void *document); char *title; @@ -83,19 +82,12 @@ void *close_data; }; -// deprecated +// UiVar replacement, rename it to UiVar when finished struct UiVar { void *value; - void *orig_val; UiVarType type; - UiVar *from; -}; - -// UiVar replacement, rename it to UiVar when finished -struct UiVar2 { - void *value; - UiVarType type; - UiContext *bound_from; /* bound by this context or NULL if unbound */ + UiVar *from; + UiContext *from_ctx; }; struct UiGroupWidget { @@ -110,12 +102,16 @@ void uic_context_set_document(UiContext *ctx, void *document); // deprecated void uic_context_detach_document(UiContext *ctx); // deprecated -//UiVar* uic_get_var(UiContext *ctx, char *name); +void uic_context_attach_document(UiContext *ctx, void *document); +void uic_context_detach_document2(UiContext *ctx, void *document); +void uic_context_detach_all(UiContext *ctx); + +UiVar* uic_get_var(UiContext *ctx, char *name); UiVar* uic_create_var(UiContext *ctx, char *name, UiVarType type); void* uic_create_value(UiContext *ctx, UiVarType type); void uic_copy_binding(UiVar *from, UiVar *to, UiBool copytodoc); -void uic_save_var(UiVar *var); +void uic_save_var2(UiVar *var); void uic_unbind_var(UiVar *var); void uic_reg_var(UiContext *ctx, char *name, UiVarType type, void *value);