ui/motif/container.c

changeset 124
80609f9675f1
parent 113
500c085d2133
child 153
ee49d1852a5f
equal deleted inserted replaced
123:55adc92e7c09 124:80609f9675f1
318 } 318 }
319 319
320 ucx_list_free(rowdim); 320 ucx_list_free(rowdim);
321 } 321 }
322 322
323 UiContainer* ui_scrolledwindow_container(UiObject *obj, Widget scrolledwindow) {
324 UiContainer *ct = ucx_mempool_calloc(
325 obj->ctx->mempool,
326 1,
327 sizeof(UiContainer));
328 ct->widget = scrolledwindow;
329 ct->prepare = ui_scrolledwindow_container_prepare;
330 ct->add = ui_scrolledwindow_container_add;
331 return ct;
332 }
333
334 Widget ui_scrolledwindow_container_prepare(UiContainer *ct, Arg *args, int *n, UiBool fill) {
335 return ct->widget;
336 }
337
338 void ui_scrolledwindow_container_add(UiContainer *ct, Widget widget) {
339 ui_reset_layout(ct->layout);
340 ct->current = widget;
341 }
342
343
323 UiContainer* ui_tabview_container(UiObject *obj, Widget frame) { 344 UiContainer* ui_tabview_container(UiObject *obj, Widget frame) {
324 UiTabViewContainer *ct = ucx_mempool_calloc( 345 UiTabViewContainer *ct = ucx_mempool_calloc(
325 obj->ctx->mempool, 346 obj->ctx->mempool,
326 1, 347 1,
327 sizeof(UiTabViewContainer)); 348 sizeof(UiTabViewContainer));
409 uic_obj_add(obj, newobj); 430 uic_obj_add(obj, newobj);
410 431
411 XtAddCallback (grid, XmNresizeCallback , ui_grid_resize, newobj->container); 432 XtAddCallback (grid, XmNresizeCallback , ui_grid_resize, newobj->container);
412 433
413 return grid; 434 return grid;
435 }
436
437 UIWIDGET ui_scrolledwindow(UiObject *obj) {
438 UiContainer *ct = uic_get_current_container(obj);
439
440 Arg args[16];
441 int n = 0;
442 XtSetArg(args[n], XmNscrollingPolicy, XmAUTOMATIC); // TODO: dosn't work, use XmAPPLICATION_DEFINED
443 n++;
444 Widget parent = ct->prepare(ct, args, &n, TRUE);
445 Widget scrolledwindow = XmCreateScrolledWindow(parent, "scrolledwindow", args, n);
446 ct->add(ct, scrolledwindow);
447 XtManageChild(scrolledwindow);
448
449 UiObject *newobj = uic_object_new(obj, scrolledwindow);
450 newobj->container = ui_scrolledwindow_container(obj, scrolledwindow);
451 uic_obj_add(obj, newobj);
452
453 return scrolledwindow;
414 } 454 }
415 455
416 UIWIDGET ui_sidebar(UiObject *obj) { 456 UIWIDGET ui_sidebar(UiObject *obj) {
417 UiContainer *ct = uic_get_current_container(obj); 457 UiContainer *ct = uic_get_current_container(obj);
418 458

mercurial