| 38 |
38 |
| 39 #ifdef __cplusplus |
39 #ifdef __cplusplus |
| 40 extern "C" { |
40 extern "C" { |
| 41 #endif |
41 #endif |
| 42 |
42 |
| 43 typedef struct UiVar UiVar; |
43 typedef struct UiVar UiVar; |
| 44 typedef struct UiListPtr UiListPtr; |
44 typedef struct UiListPtr UiListPtr; |
| 45 typedef struct UiListVar UiListVar; |
45 typedef struct UiListVar UiListVar; |
| 46 typedef struct UiGroupWidget UiGroupWidget; |
46 typedef struct UiGroupWidget UiGroupWidget; |
| |
47 typedef struct UiDestroyHandler UiDestroyHandler; |
| 47 |
48 |
| 48 typedef enum UiVarType { |
49 typedef enum UiVarType { |
| 49 UI_VAR_SPECIAL = 0, |
50 UI_VAR_SPECIAL = 0, |
| 50 UI_VAR_INTEGER, |
51 UI_VAR_INTEGER, |
| 51 UI_VAR_DOUBLE, |
52 UI_VAR_DOUBLE, |
| 91 }; |
93 }; |
| 92 |
94 |
| 93 // UiVar replacement, rename it to UiVar when finished |
95 // UiVar replacement, rename it to UiVar when finished |
| 94 struct UiVar { |
96 struct UiVar { |
| 95 void *value; |
97 void *value; |
| |
98 void *original_value; |
| 96 UiVarType type; |
99 UiVarType type; |
| 97 UiVar *from; |
100 UiVar *from; |
| 98 UiContext *from_ctx; |
101 UiContext *from_ctx; |
| 99 }; |
102 }; |
| 100 |
103 |
| 101 struct UiGroupWidget { |
104 struct UiGroupWidget { |
| 102 void *widget; |
105 void *widget; |
| 103 ui_enablefunc enable; |
106 ui_enablefunc enable; |
| 104 int *groups; |
107 int *groups; |
| 105 int numgroups; |
108 int numgroups; |
| 106 }; |
109 }; |
| 107 |
110 |
| |
111 struct UiDestroyHandler { |
| |
112 cx_destructor_func destructor; |
| |
113 void *data; |
| |
114 }; |
| |
115 |
| 108 |
116 |
| 109 void uic_init_global_context(void); |
117 void uic_init_global_context(void); |
| 110 |
118 |
| 111 UiContext* uic_context(UiObject *toplevel, CxMempool *mp); |
119 UiContext* uic_context(UiObject *toplevel, CxMempool *mp); |
| 112 UiContext* uic_root_context(UiContext *ctx); |
120 UiContext* uic_root_context(UiContext *ctx); |
| 113 void uic_context_set_document(UiContext *ctx, void *document); // deprecated |
121 void uic_context_add_destructor(UiContext *ctx, cx_destructor_func func, void *data); |
| 114 void uic_context_detach_document(UiContext *ctx); // deprecated |
|
| 115 |
122 |
| 116 void uic_context_prepare_close(UiContext *ctx); |
123 void uic_context_prepare_close(UiContext *ctx); |
| 117 |
124 |
| 118 void uic_context_attach_document(UiContext *ctx, void *document); |
125 void uic_context_attach_document(UiContext *ctx, void *document); |
| 119 void uic_context_detach_document2(UiContext *ctx, void *document); |
126 void uic_context_detach_document(UiContext *ctx, void *document); |
| |
127 void uic_context_attach_context(UiContext *ctx, UiContext *doc_ctx); // TODO |
| |
128 void uic_context_detach_context(UiContext *ctx, UiContext *doc_ctx); // TODO |
| 120 void uic_context_detach_all(UiContext *ctx); |
129 void uic_context_detach_all(UiContext *ctx); |
| 121 |
130 |
| 122 UiVar* uic_get_var(UiContext *ctx, const char *name); |
131 UiVar* uic_get_var(UiContext *ctx, const char *name); |
| 123 UiVar* uic_create_var(UiContext *ctx, const char *name, UiVarType type); |
132 UiVar* uic_create_var(UiContext *ctx, const char *name, UiVarType type); |
| 124 UiVar* uic_create_value_var(UiContext *ctx, void *value); |
133 UiVar* uic_create_value_var(UiContext *ctx, void *value); |
| 128 |
137 |
| 129 void uic_copy_binding(UiVar *from, UiVar *to, UiBool copytodoc); |
138 void uic_copy_binding(UiVar *from, UiVar *to, UiBool copytodoc); |
| 130 void uic_save_var2(UiVar *var); |
139 void uic_save_var2(UiVar *var); |
| 131 void uic_unbind_var(UiVar *var); |
140 void uic_unbind_var(UiVar *var); |
| 132 |
141 |
| 133 void uic_reg_var(UiContext *ctx, char *name, UiVarType type, void *value); |
142 void uic_reg_var(UiContext *ctx, const char *name, UiVarType type, void *value); |
| 134 |
143 |
| 135 void uic_remove_bound_var(UiContext *ctx, UiVar *var); |
144 void uic_remove_bound_var(UiContext *ctx, UiVar *var); |
| 136 |
145 |
| 137 size_t uic_group_array_size(const int *groups); |
146 size_t uic_group_array_size(const int *groups); |
| 138 void uic_check_group_widgets(UiContext *ctx); |
147 void uic_check_group_widgets(UiContext *ctx); |