50 UI_VAR_INTEGER, |
52 UI_VAR_INTEGER, |
51 UI_VAR_DOUBLE, |
53 UI_VAR_DOUBLE, |
52 UI_VAR_STRING, |
54 UI_VAR_STRING, |
53 UI_VAR_TEXT, |
55 UI_VAR_TEXT, |
54 UI_VAR_LIST, |
56 UI_VAR_LIST, |
55 UI_VAR_RANGE |
57 UI_VAR_RANGE, |
|
58 UI_VAR_GENERIC |
56 }; |
59 }; |
57 |
60 |
58 struct UiContext { |
61 struct UiContext { |
59 UiContext *parent; |
62 UiContext *parent; |
60 UiObject *obj; |
63 UiObject *obj; |
61 UcxMempool *mempool; |
64 CxMempool *mp; |
|
65 const CxAllocator *allocator; |
62 |
66 |
63 void *document; |
67 void *document; |
64 UcxList *documents; |
68 CxList *documents; |
65 |
69 |
66 UcxMap *vars; // manually created context vars |
70 CxMap *vars; // manually created context vars |
67 UcxMap *vars_unbound; // unbound vars created by widgets |
71 CxMap *vars_unbound; // unbound vars created by widgets |
68 |
72 |
69 UcxList *groups; // int list |
73 CxList *groups; // int list |
70 UcxList *group_widgets; // UiGroupWidget* list |
74 CxList *group_widgets; // UiGroupWidget list |
71 |
75 |
72 void (*attach_document)(UiContext *ctx, void *document); |
76 void (*attach_document)(UiContext *ctx, void *document); |
73 void (*detach_document2)(UiContext *ctx, void *document); |
77 void (*detach_document2)(UiContext *ctx, void *document); |
74 |
78 |
75 char *title; |
79 char *title; |
76 |
80 |
77 #ifdef UI_GTK |
81 #ifdef UI_GTK |
|
82 #if GTK_CHECK_VERSION(4, 0, 0) |
|
83 GActionMap *action_map; |
|
84 #elif UI_GTK2 || UI_GTK3 |
78 GtkAccelGroup *accel_group; |
85 GtkAccelGroup *accel_group; |
|
86 #endif |
79 #endif |
87 #endif |
|
88 |
|
89 |
80 |
90 |
81 ui_callback close_callback; |
91 ui_callback close_callback; |
82 void *close_data; |
92 void *close_data; |
83 }; |
93 }; |
84 |
94 |
98 }; |
108 }; |
99 |
109 |
100 |
110 |
101 void uic_init_global_context(void); |
111 void uic_init_global_context(void); |
102 |
112 |
103 UiContext* uic_context(UiObject *toplevel, UcxMempool *mp); |
113 UiContext* uic_context(UiObject *toplevel, CxMempool *mp); |
104 UiContext* uic_root_context(UiContext *ctx); |
114 UiContext* uic_root_context(UiContext *ctx); |
105 void uic_context_set_document(UiContext *ctx, void *document); // deprecated |
115 void uic_context_set_document(UiContext *ctx, void *document); // deprecated |
106 void uic_context_detach_document(UiContext *ctx); // deprecated |
116 void uic_context_detach_document(UiContext *ctx); // deprecated |
|
117 |
|
118 void uic_context_prepare_close(UiContext *ctx); |
107 |
119 |
108 void uic_context_attach_document(UiContext *ctx, void *document); |
120 void uic_context_attach_document(UiContext *ctx, void *document); |
109 void uic_context_detach_document2(UiContext *ctx, void *document); |
121 void uic_context_detach_document2(UiContext *ctx, void *document); |
110 void uic_context_detach_all(UiContext *ctx); |
122 void uic_context_detach_all(UiContext *ctx); |
111 |
123 |
112 UiVar* uic_get_var(UiContext *ctx, const char *name); |
124 UiVar* uic_get_var(UiContext *ctx, const char *name); |
113 UiVar* uic_create_var(UiContext *ctx, const char *name, UiVarType type); |
125 UiVar* uic_create_var(UiContext *ctx, const char *name, UiVarType type); |
|
126 UiVar* uic_create_value_var(UiContext *ctx, void *value); |
114 void* uic_create_value(UiContext *ctx, UiVarType type); |
127 void* uic_create_value(UiContext *ctx, UiVarType type); |
|
128 |
|
129 UiVar* uic_widget_var(UiContext* toplevel, UiContext* current, void* value, const char* varname, UiVarType type); |
115 |
130 |
116 void uic_copy_binding(UiVar *from, UiVar *to, UiBool copytodoc); |
131 void uic_copy_binding(UiVar *from, UiVar *to, UiBool copytodoc); |
117 void uic_save_var2(UiVar *var); |
132 void uic_save_var2(UiVar *var); |
118 void uic_unbind_var(UiVar *var); |
133 void uic_unbind_var(UiVar *var); |
119 |
134 |
120 void uic_reg_var(UiContext *ctx, char *name, UiVarType type, void *value); |
135 void uic_reg_var(UiContext *ctx, char *name, UiVarType type, void *value); |
121 |
136 |
122 void uic_remove_bound_var(UiContext *ctx, UiVar *var); |
137 void uic_remove_bound_var(UiContext *ctx, UiVar *var); |
123 |
138 |
|
139 size_t uic_group_array_size(const int *groups); |
124 void uic_check_group_widgets(UiContext *ctx); |
140 void uic_check_group_widgets(UiContext *ctx); |
125 void uic_add_group_widget(UiContext *ctx, void *widget, ui_enablefunc enable, UcxList *groups); |
141 void uic_add_group_widget(UiContext *ctx, void *widget, ui_enablefunc enable, CxList *groups); |
126 |
142 void uic_add_group_widget_i(UiContext *ctx, void *widget, ui_enablefunc enable, const int *groups, size_t numgroups); |
|
143 void uic_remove_group_widget(UiContext *ctx, void *widget); |
127 |
144 |
128 #ifdef __cplusplus |
145 #ifdef __cplusplus |
129 } |
146 } |
130 #endif |
147 #endif |
131 |
148 |