| 225 UiGridContainer *grid = (UiGridContainer*)ctn; |
225 UiGridContainer *grid = (UiGridContainer*)ctn; |
| 226 grid->x++; |
226 grid->x++; |
| 227 grid->container.container.newline = FALSE; |
227 grid->container.container.newline = FALSE; |
| 228 } |
228 } |
| 229 |
229 |
| |
230 /* -------------------------- Frame Container -------------------------- */ |
| |
231 |
| |
232 UIWIDGET ui_frame_create(UiObject *obj, UiFrameArgs *args) { |
| |
233 Arg xargs[16]; |
| |
234 int n = 0; |
| |
235 |
| |
236 UiContainerPrivate *ctn = ui_obj_container(obj); |
| |
237 UiLayout layout = UI_ARGS2LAYOUT(args); |
| |
238 |
| |
239 Widget parent = ui_container_prepare(ctn, &layout, xargs, &n); |
| |
240 |
| |
241 char *name = args->name ? (char*)args->name : "frame"; |
| |
242 Widget frame = XmCreateFrame(parent, name, xargs, 6); |
| |
243 XtManageChild(frame); |
| |
244 ui_container_add(ctn, frame); |
| |
245 |
| |
246 if(args->label) { |
| |
247 XmString s = XmStringCreateLocalized((char*)args->label); |
| |
248 n = 0; |
| |
249 XtSetArg(xargs[n], XmNlabelString, s); n++; |
| |
250 XtSetArg(xargs[n], XmNchildType, XmFRAME_TITLE_CHILD); n++; |
| |
251 Widget label = XmCreateLabel(frame, "frame_label", xargs, n); |
| |
252 XtManageChild(label); |
| |
253 XmStringFree(s); |
| |
254 } |
| |
255 |
| |
256 UiContainerX *container = ui_frame_container(obj, frame); |
| |
257 uic_object_push_container(obj, container); |
| |
258 |
| |
259 UiContainerArgs sub_args = { |
| |
260 .spacing = args->spacing, |
| |
261 .columnspacing = args->columnspacing, |
| |
262 .rowspacing = args->rowspacing |
| |
263 }; |
| |
264 switch(args->subcontainer) { |
| |
265 default: break; |
| |
266 case UI_CONTAINER_VBOX: { |
| |
267 ui_vbox_create(obj, &sub_args); |
| |
268 uic_object_remove_second_last_container(obj); |
| |
269 break; |
| |
270 } |
| |
271 case UI_CONTAINER_HBOX: { |
| |
272 ui_hbox_create(obj, &sub_args); |
| |
273 uic_object_remove_second_last_container(obj); |
| |
274 break; |
| |
275 } |
| |
276 case UI_CONTAINER_GRID: { |
| |
277 ui_grid_create(obj, &sub_args); |
| |
278 uic_object_remove_second_last_container(obj); |
| |
279 break; |
| |
280 } |
| |
281 } |
| |
282 |
| |
283 |
| |
284 return frame; |
| |
285 } |
| |
286 |
| |
287 UiContainerX* ui_frame_container(UiObject *obj, Widget frame) { |
| |
288 UiContainerPrivate *ctn = ui_malloc(obj->ctx, sizeof(UiContainerPrivate)); |
| |
289 memset(ctn, 0, sizeof(UiContainerPrivate)); |
| |
290 ctn->prepare = ui_frame_container_prepare; |
| |
291 ctn->add = ui_frame_container_add; |
| |
292 ctn->widget = frame; |
| |
293 return (UiContainerX*)ctn; |
| |
294 } |
| |
295 |
| |
296 Widget ui_frame_container_prepare(UiContainerPrivate *ctn, UiLayout *layout, Arg *args, int *n) { |
| |
297 int a = *n; |
| |
298 XtSetArg(args[a], XmNchildType, XmFRAME_WORKAREA_CHILD); |
| |
299 *n = a+1; |
| |
300 return ctn->widget; |
| |
301 } |
| |
302 |
| |
303 void ui_frame_container_add(UiContainerPrivate *ctn, Widget widget) { |
| |
304 // NOOP |
| |
305 } |
| |
306 |
| |
307 /* -------------------------- SplitPane -------------------------- */ |
| |
308 |
| |
309 UIWIDGET ui_splitpane_create(UiObject *obj, UiSplitPaneArgs *args, int orientation) { |
| |
310 return NULL; // TODO |
| |
311 } |
| |
312 |
| |
313 UIWIDGET ui_hsplitpane_create(UiObject *obj, UiSplitPaneArgs *args) { |
| |
314 return ui_splitpane_create(obj, args, XmHORIZONTAL); |
| |
315 } |
| |
316 |
| |
317 UIWIDGET ui_vsplitpane_create(UiObject *obj, UiSplitPaneArgs *args) { |
| |
318 return ui_splitpane_create(obj, args, XmVERTICAL); |
| |
319 } |
| 230 |
320 |
| 231 /* -------------------------- TabView Container -------------------------- */ |
321 /* -------------------------- TabView Container -------------------------- */ |
| 232 |
322 |
| 233 static void ui_tabbar_resize(Widget widget, XtPointer udata, XtPointer cdata) { |
323 static void ui_tabbar_resize(Widget widget, XtPointer udata, XtPointer cdata) { |
| 234 UiMotifTabView *tabview = udata; |
324 UiMotifTabView *tabview = udata; |