ui/motif/list.c

branch
newapi
changeset 178
7c3ff86ee9d4
parent 176
bc63cb601f6d
child 406
0ebf9d7b23e8
equal deleted inserted replaced
177:e79a60b3a7cb 178:7c3ff86ee9d4
59 Widget parent = ct->prepare(ct, args, &n, TRUE); 59 Widget parent = ct->prepare(ct, args, &n, TRUE);
60 Widget widget = XmCreateScrolledList(parent, "listview", args, n); 60 Widget widget = XmCreateScrolledList(parent, "listview", args, n);
61 ct->add(ct, XtParent(widget)); 61 ct->add(ct, XtParent(widget));
62 XtManageChild(widget); 62 XtManageChild(widget);
63 63
64 UiListView *listview = ucx_mempool_malloc(obj->ctx->mempool, sizeof(UiListView)); 64 UiListView *listview = cxMalloc(obj->ctx->allocator, sizeof(UiListView));
65 listview->widget = widget; 65 listview->widget = widget;
66 listview->list = var; 66 listview->list = var;
67 listview->getvalue = getvalue; 67 listview->getvalue = getvalue;
68 68
69 for (int i=0;i<count;i++) { 69 for (int i=0;i<count;i++) {
70 XmStringFree(items[i]); 70 XmStringFree(items[i]);
71 } 71 }
72 XtFree((char *)items); 72 XtFree((char *)items);
73 73
74 if(f) { 74 if(f) {
75 UiListViewEventData *event = ucx_mempool_malloc( 75 UiListViewEventData *event = cxMalloc(
76 obj->ctx->mempool, 76 obj->ctx->allocator,
77 sizeof(UiListViewEventData)); 77 sizeof(UiListViewEventData));
78 event->event.obj = obj; 78 event->event.obj = obj;
79 event->event.userdata = udata; 79 event->event.userdata = udata;
80 event->event.callback = f; 80 event->event.callback = f;
81 event->event.value = 0; 81 event->event.value = 0;
180 } 180 }
181 return NULL; 181 return NULL;
182 } 182 }
183 183
184 UIWIDGET ui_combobox_var(UiObject *obj, UiVar *var, ui_getvaluefunc getvalue, ui_callback f, void *udata) { 184 UIWIDGET ui_combobox_var(UiObject *obj, UiVar *var, ui_getvaluefunc getvalue, ui_callback f, void *udata) {
185 UiListView *listview = ucx_mempool_malloc( 185 UiListView *listview = cxMalloc(
186 obj->ctx->mempool, 186 obj->ctx->allocator,
187 sizeof(UiListView)); 187 sizeof(UiListView));
188 188
189 UiContainer *ct = uic_get_current_container(obj); 189 UiContainer *ct = uic_get_current_container(obj);
190 Arg args[16]; 190 Arg args[16];
191 int n = 0; 191 int n = 0;
202 listview->list = var; 202 listview->list = var;
203 listview->getvalue = getvalue; 203 listview->getvalue = getvalue;
204 204
205 ui_listview_update(NULL, listview); 205 ui_listview_update(NULL, listview);
206 206
207 } 207 return parent;
208 }

mercurial