ui/motif/tree.c

branch
newapi
changeset 178
7c3ff86ee9d4
parent 176
bc63cb601f6d
equal deleted inserted replaced
177:e79a60b3a7cb 178:7c3ff86ee9d4
34 #include "tree.h" 34 #include "tree.h"
35 35
36 #include "container.h" 36 #include "container.h"
37 #include "../common/object.h" 37 #include "../common/object.h"
38 #include "../common/context.h" 38 #include "../common/context.h"
39 #include <ucx/utils.h> 39 #include <cx/utils.h>
40 #include <cx/compare.h>
41 #include <cx/printf.h>
40 42
41 UIWIDGET ui_table_var(UiObject *obj, UiVar *var, UiModel *model, UiListCallbacks cb) { 43 UIWIDGET ui_table_var(UiObject *obj, UiVar *var, UiModel *model, UiListCallbacks cb) {
42 // TODO: check if modelinfo is complete 44 // TODO: check if modelinfo is complete
43 45
44 Arg args[32]; 46 Arg args[32];
117 width = w; 119 width = w;
118 } 120 }
119 data = list->next(list); 121 data = list->next(list);
120 } 122 }
121 123
122 UiTableView *tableview = ucx_mempool_malloc(obj->ctx->mempool, sizeof(UiTableView)); 124 UiTableView *tableview = cxMalloc(obj->ctx->allocator, sizeof(UiTableView));
123 tableview->widget = container; 125 tableview->widget = container;
124 tableview->var = var; 126 tableview->var = var;
125 tableview->model = model; 127 tableview->model = model;
126 128
127 // set new XmContainer width 129 // set new XmContainer width
244 switch(type) { 246 switch(type) {
245 case UI_STRING: *free = FALSE; return data; 247 case UI_STRING: *free = FALSE; return data;
246 case UI_INTEGER: { 248 case UI_INTEGER: {
247 *free = TRUE; 249 *free = TRUE;
248 int *val = data; 250 int *val = data;
249 sstr_t str = ucx_asprintf(ucx_default_allocator(), "%d", *val); 251 cxmutstr str = cx_asprintf("%d", *val);
250 return str.ptr; 252 return str.ptr;
251 } 253 }
254 case UI_ICON: break; // TODO
255 case UI_ICON_TEXT: break; // TODO
252 } 256 }
253 *free = FALSE; 257 *free = FALSE;
254 return NULL; 258 return NULL;
255 } 259 }
256 260

mercurial