ui/common/context.h

branch
newapi
changeset 178
7c3ff86ee9d4
parent 174
0358f1d9c506
child 187
24ce2c326d85
equal deleted inserted replaced
177:e79a60b3a7cb 178:7c3ff86ee9d4
28 28
29 #ifndef UIC_CONTEXT_H 29 #ifndef UIC_CONTEXT_H
30 #define UIC_CONTEXT_H 30 #define UIC_CONTEXT_H
31 31
32 #include "../ui/toolkit.h" 32 #include "../ui/toolkit.h"
33 #include <ucx/map.h> 33 #include <cx/map.h>
34 #include <ucx/mempool.h> 34 #include <cx/hash_map.h>
35 #include <ucx/list.h> 35 #include <cx/mempool.h>
36 #include <cx/list.h>
37 #include <cx/linked_list.h>
36 38
37 #ifdef __cplusplus 39 #ifdef __cplusplus
38 extern "C" { 40 extern "C" {
39 #endif 41 #endif
40 42
56 }; 58 };
57 59
58 struct UiContext { 60 struct UiContext {
59 UiContext *parent; 61 UiContext *parent;
60 UiObject *obj; 62 UiObject *obj;
61 UcxMempool *mempool; 63 const CxAllocator *allocator;
62 64
63 void *document; 65 void *document;
64 UcxList *documents; 66 CxList *documents;
65 67
66 UcxMap *vars; // manually created context vars 68 CxMap *vars; // manually created context vars
67 UcxMap *vars_unbound; // unbound vars created by widgets 69 CxMap *vars_unbound; // unbound vars created by widgets
68 70
69 UcxList *groups; // int list 71 CxList *groups; // int list
70 UcxList *group_widgets; // UiGroupWidget* list 72 CxList *group_widgets; // UiGroupWidget list
71 73
72 void (*attach_document)(UiContext *ctx, void *document); 74 void (*attach_document)(UiContext *ctx, void *document);
73 void (*detach_document2)(UiContext *ctx, void *document); 75 void (*detach_document2)(UiContext *ctx, void *document);
74 76
75 char *title; 77 char *title;
98 }; 100 };
99 101
100 102
101 void uic_init_global_context(void); 103 void uic_init_global_context(void);
102 104
103 UiContext* uic_context(UiObject *toplevel, UcxMempool *mp); 105 UiContext* uic_context(UiObject *toplevel, const CxAllocator *a);
104 UiContext* uic_root_context(UiContext *ctx); 106 UiContext* uic_root_context(UiContext *ctx);
105 void uic_context_set_document(UiContext *ctx, void *document); // deprecated 107 void uic_context_set_document(UiContext *ctx, void *document); // deprecated
106 void uic_context_detach_document(UiContext *ctx); // deprecated 108 void uic_context_detach_document(UiContext *ctx); // deprecated
107 109
108 void uic_context_attach_document(UiContext *ctx, void *document); 110 void uic_context_attach_document(UiContext *ctx, void *document);
120 void uic_reg_var(UiContext *ctx, char *name, UiVarType type, void *value); 122 void uic_reg_var(UiContext *ctx, char *name, UiVarType type, void *value);
121 123
122 void uic_remove_bound_var(UiContext *ctx, UiVar *var); 124 void uic_remove_bound_var(UiContext *ctx, UiVar *var);
123 125
124 void uic_check_group_widgets(UiContext *ctx); 126 void uic_check_group_widgets(UiContext *ctx);
125 void uic_add_group_widget(UiContext *ctx, void *widget, ui_enablefunc enable, UcxList *groups); 127 void uic_add_group_widget(UiContext *ctx, void *widget, ui_enablefunc enable, CxList *groups);
126 128
127 129
128 #ifdef __cplusplus 130 #ifdef __cplusplus
129 } 131 }
130 #endif 132 #endif

mercurial