177 |
177 |
178 ui_reset_layout(ct->layout); |
178 ui_reset_layout(ct->layout); |
179 ct->current = widget; |
179 ct->current = widget; |
180 } |
180 } |
181 |
181 |
182 UiContainer* ui_grid_container(UiObject *obj, Widget form) { |
182 UiContainer* ui_grid_container(UiObject *obj, Widget form, int columnspacing, int rowspacing) { |
183 UiGridContainer *ct = ucx_mempool_calloc( |
183 UiGridContainer *ct = ucx_mempool_calloc( |
184 obj->ctx->mempool, |
184 obj->ctx->mempool, |
185 1, |
185 1, |
186 sizeof(UiGridContainer)); |
186 sizeof(UiGridContainer)); |
187 ct->container.widget = form; |
187 ct->container.widget = form; |
188 ct->container.prepare = ui_grid_container_prepare; |
188 ct->container.prepare = ui_grid_container_prepare; |
189 ct->container.add = ui_grid_container_add; |
189 ct->container.add = ui_grid_container_add; |
|
190 ct->columnspacing = columnspacing; |
|
191 ct->rowspacing = rowspacing; |
190 return (UiContainer*)ct; |
192 return (UiContainer*)ct; |
191 } |
193 } |
192 |
194 |
193 void ui_grid_newline(UiGridContainer *grid) { |
195 void ui_grid_newline(UiGridContainer *grid) { |
194 if(grid->current) { |
196 if(grid->current) { |
366 UIWIDGET ui_hbox(UiObject *obj) { |
368 UIWIDGET ui_hbox(UiObject *obj) { |
367 return ui_box(obj, UI_BOX_HORIZONTAL); |
369 return ui_box(obj, UI_BOX_HORIZONTAL); |
368 } |
370 } |
369 |
371 |
370 UIWIDGET ui_grid(UiObject *obj) { |
372 UIWIDGET ui_grid(UiObject *obj) { |
|
373 return ui_grid_sp(obj, 0, 0); |
|
374 } |
|
375 |
|
376 UIWIDGET ui_grid_sp(UiObject *obj, int margin, int columnspacing, int rowspacing) { |
371 UiContainer *ct = uic_get_current_container(obj); |
377 UiContainer *ct = uic_get_current_container(obj); |
372 |
378 |
373 Arg args[16]; |
379 Arg args[16]; |
374 int n = 0; |
380 int n = 0; |
375 Widget parent = ct->prepare(ct, args, &n, TRUE); |
381 Widget parent = ct->prepare(ct, args, &n, TRUE); |
376 Widget grid = XmCreateDrawingArea(parent, "grid", args, n); |
382 Widget grid = XmCreateDrawingArea(parent, "grid", args, n); |
377 ct->add(ct, grid); |
383 ct->add(ct, grid); |
378 XtManageChild(grid); |
384 XtManageChild(grid); |
379 |
385 |
380 UiObject *newobj = uic_object_new(obj, grid); |
386 UiObject *newobj = uic_object_new(obj, grid); |
381 newobj->container = ui_grid_container(obj, grid); |
387 newobj->container = ui_grid_container(obj, grid, columnspacing, rowspacing); |
382 uic_obj_add(obj, newobj); |
388 uic_obj_add(obj, newobj); |
383 |
389 |
384 XtAddCallback (grid, XmNresizeCallback , ui_grid_resize, newobj->container); |
390 XtAddCallback (grid, XmNresizeCallback , ui_grid_resize, newobj->container); |
385 |
391 |
386 return grid; |
392 return grid; |