332 void add_toolitem_st_toggle_widget(Widget parent, UiStToolItem *item, UiObject *obj) { |
332 void add_toolitem_st_toggle_widget(Widget parent, UiStToolItem *item, UiObject *obj) { |
333 |
333 |
334 } |
334 } |
335 |
335 |
336 void add_toolbar_combobox(Widget tb, UiToolbarComboBox *item, UiObject *obj) { |
336 void add_toolbar_combobox(Widget tb, UiToolbarComboBox *item, UiObject *obj) { |
337 UiListPtr *listptr = ucx_mempool_malloc( |
|
338 obj->ctx->mempool, |
|
339 sizeof(UiListPtr)); |
|
340 UiListView *listview = ucx_mempool_malloc( |
337 UiListView *listview = ucx_mempool_malloc( |
341 obj->ctx->mempool, |
338 obj->ctx->mempool, |
342 sizeof(UiListView)); |
339 sizeof(UiListView)); |
343 listptr->list = item->list; |
340 |
|
341 UiVar *var = ucx_mempool_malloc(obj->ctx->mempool, sizeof(UiVar)); |
|
342 var->value = item->list; |
|
343 var->type = UI_VAR_SPECIAL; |
344 |
344 |
345 Arg args[8]; |
345 Arg args[8]; |
346 XtSetArg(args[0], XmNshadowThickness, 1); |
346 XtSetArg(args[0], XmNshadowThickness, 1); |
347 XtSetArg(args[1], XmNindicatorOn, XmINDICATOR_NONE); |
347 XtSetArg(args[1], XmNindicatorOn, XmINDICATOR_NONE); |
348 XtSetArg(args[2], XmNtraversalOn, FALSE); |
348 XtSetArg(args[2], XmNtraversalOn, FALSE); |
349 XtSetArg(args[3], XmNwidth, 120); |
349 XtSetArg(args[3], XmNwidth, 120); |
350 Widget combobox = XmCreateDropDownList(tb, "toolbar_combobox", args, 4); |
350 Widget combobox = XmCreateDropDownList(tb, "toolbar_combobox", args, 4); |
351 XtManageChild(combobox); |
351 XtManageChild(combobox); |
352 listview->widget = combobox; |
352 listview->widget = combobox; |
353 listview->list = listptr; |
353 listview->list = var; |
354 listview->getvalue = item->getvalue; |
354 listview->getvalue = item->getvalue; |
355 |
355 |
356 ui_listview_update(NULL, listview); |
356 ui_listview_update(NULL, listview); |
357 |
|
358 listptr->list->observers = ui_add_observer( |
|
359 listptr->list->observers, |
|
360 (ui_callback)ui_listview_update, |
|
361 listview); |
|
362 |
357 |
363 if(item->callback) { |
358 if(item->callback) { |
364 // TODO: |
359 // TODO: |
365 |
360 |
366 } |
361 } |