ui/common/types.c

changeset 146
dd0ae1c62a72
parent 145
853685152c1d
child 152
62921b370c60
equal deleted inserted replaced
145:853685152c1d 146:dd0ae1c62a72
88 } 88 }
89 } 89 }
90 90
91 /* --------------------------- UiList --------------------------- */ 91 /* --------------------------- UiList --------------------------- */
92 92
93 UiList* ui_list_new(void) { 93 UiList* ui_list_new(UiContext *ctx, char *name) {
94 UiList *list = malloc(sizeof(UiList)); 94 UiList *list = malloc(sizeof(UiList));
95 list->first = ui_list_first; 95 list->first = ui_list_first;
96 list->next = ui_list_next; 96 list->next = ui_list_next;
97 list->get = ui_list_get; 97 list->get = ui_list_get;
98 list->count = ui_list_count; 98 list->count = ui_list_count;
101 list->data = NULL; 101 list->data = NULL;
102 list->iter = NULL; 102 list->iter = NULL;
103 103
104 list->update = NULL; 104 list->update = NULL;
105 list->obj = NULL; 105 list->obj = NULL;
106
107 if(name) {
108 uic_reg_var(ctx, name, UI_VAR_LIST, list);
109 }
106 110
107 return list; 111 return list;
108 } 112 }
109 113
110 void ui_list_free(UiList *list) { 114 void ui_list_free(UiList *list) {
165 typedef struct { 169 typedef struct {
166 int type; 170 int type;
167 char *name; 171 char *name;
168 } UiColumn; 172 } UiColumn;
169 173
170 UiModel* ui_model_info(UiContext *ctx, ...) { 174 UiModel* ui_model(UiContext *ctx, ...) {
171 UiModel *info = ui_calloc(ctx, 1, sizeof(UiModel)); 175 UiModel *info = ui_calloc(ctx, 1, sizeof(UiModel));
172 176
173 va_list ap; 177 va_list ap;
174 va_start(ap, ctx); 178 va_start(ap, ctx);
175 179
203 ucx_list_free(cols); 207 ucx_list_free(cols);
204 208
205 return info; 209 return info;
206 } 210 }
207 211
208 void ui_model_info_free(UiContext *ctx, UiModel *mi) { 212 void ui_model_free(UiContext *ctx, UiModel *mi) {
209 ucx_mempool_free(ctx->mempool, mi->types); 213 ucx_mempool_free(ctx->mempool, mi->types);
210 ucx_mempool_free(ctx->mempool, mi->titles); 214 ucx_mempool_free(ctx->mempool, mi->titles);
211 ucx_mempool_free(ctx->mempool, mi); 215 ucx_mempool_free(ctx->mempool, mi);
212 } 216 }
213 217

mercurial