60 Grid grid = Grid(); |
60 Grid grid = Grid(); |
61 current->container->Add(grid, true); |
61 current->container->Add(grid, true); |
62 |
62 |
63 UIElement elm = grid; |
63 UIElement elm = grid; |
64 UiWidget* widget = new UiWidget(elm); |
64 UiWidget* widget = new UiWidget(elm); |
|
65 ui_context_add_widget_destructor(current->ctx, widget); |
65 |
66 |
66 UiObject* newobj = uic_object_new(obj, widget); |
67 UiObject* newobj = uic_object_new(obj, widget); |
67 newobj->container = new UiBoxContainer(grid, type, args.margin, args.spacing); |
68 newobj->container = new UiBoxContainer(grid, type, args.margin, args.spacing); |
|
69 ui_context_add_container_destructor(current->ctx, newobj->container); |
68 uic_obj_add(obj, newobj); |
70 uic_obj_add(obj, newobj); |
69 |
71 |
70 return widget; |
72 return widget; |
71 } |
73 } |
72 |
74 |
153 Grid grid = Grid(); |
155 Grid grid = Grid(); |
154 current->container->Add(grid, true); |
156 current->container->Add(grid, true); |
155 |
157 |
156 UIElement elm = grid; |
158 UIElement elm = grid; |
157 UiWidget* widget = new UiWidget(elm); |
159 UiWidget* widget = new UiWidget(elm); |
|
160 ui_context_add_widget_destructor(current->ctx, widget); |
158 |
161 |
159 UiObject* newobj = uic_object_new(obj, widget); |
162 UiObject* newobj = uic_object_new(obj, widget); |
160 newobj->container = new UiGridContainer(grid, args.margin, args.columnspacing, args.rowspacing); |
163 newobj->container = new UiGridContainer(grid, args.margin, args.columnspacing, args.rowspacing); |
|
164 ui_context_add_container_destructor(current->ctx, newobj->container); |
161 uic_obj_add(obj, newobj); |
165 uic_obj_add(obj, newobj); |
162 |
166 |
163 return widget; |
167 return widget; |
164 } |
168 } |
165 |
169 |
298 UI_APPLY_LAYOUT1(current, args); |
302 UI_APPLY_LAYOUT1(current, args); |
299 current->container->Add(frame, true); |
303 current->container->Add(frame, true); |
300 |
304 |
301 UIElement elm = frame; |
305 UIElement elm = frame; |
302 UiWidget* widget = new UiWidget(elm); |
306 UiWidget* widget = new UiWidget(elm); |
|
307 ui_context_add_widget_destructor(current->ctx, widget); |
303 |
308 |
304 // sub container |
309 // sub container |
305 UiContainer* ctn = nullptr; |
310 UiContainer* ctn = nullptr; |
306 switch (args.subcontainer) { |
311 switch (args.subcontainer) { |
307 default: |
312 default: |
316 case UI_CONTAINER_GRID: { |
321 case UI_CONTAINER_GRID: { |
317 ctn = new UiGridContainer(workarea, args.margin, args.columnspacing, args.rowspacing); |
322 ctn = new UiGridContainer(workarea, args.margin, args.columnspacing, args.rowspacing); |
318 break; |
323 break; |
319 } |
324 } |
320 } |
325 } |
|
326 ui_context_add_container_destructor(current->ctx, ctn); |
321 |
327 |
322 UiObject* newobj = uic_object_new(obj, widget); |
328 UiObject* newobj = uic_object_new(obj, widget); |
323 newobj->container = ctn; |
329 newobj->container = ctn; |
324 uic_obj_add(obj, newobj); |
330 uic_obj_add(obj, newobj); |
325 |
331 |
342 UI_APPLY_LAYOUT1(current, args); |
348 UI_APPLY_LAYOUT1(current, args); |
343 current->container->Add(expander, true); |
349 current->container->Add(expander, true); |
344 |
350 |
345 UIElement elm = expander; |
351 UIElement elm = expander; |
346 UiWidget* widget = new UiWidget(elm); |
352 UiWidget* widget = new UiWidget(elm); |
|
353 ui_context_add_widget_destructor(current->ctx, widget); |
347 |
354 |
348 Grid content = Grid(); |
355 Grid content = Grid(); |
349 expander.Content(content); |
356 expander.Content(content); |
350 |
357 |
351 UiContainer* ctn = nullptr; |
358 UiContainer* ctn = nullptr; |
362 case UI_CONTAINER_GRID: { |
369 case UI_CONTAINER_GRID: { |
363 ctn = new UiGridContainer(content, args.margin, args.columnspacing, args.rowspacing); |
370 ctn = new UiGridContainer(content, args.margin, args.columnspacing, args.rowspacing); |
364 break; |
371 break; |
365 } |
372 } |
366 } |
373 } |
|
374 ui_context_add_container_destructor(current->ctx, ctn); |
367 |
375 |
368 UiObject* newobj = uic_object_new(obj, widget); |
376 UiObject* newobj = uic_object_new(obj, widget); |
369 newobj->container = ctn; |
377 newobj->container = ctn; |
370 uic_obj_add(obj, newobj); |
378 uic_obj_add(obj, newobj); |
371 |
379 |
382 UI_APPLY_LAYOUT1(current, args); |
390 UI_APPLY_LAYOUT1(current, args); |
383 current->container->Add(scrollW, true); |
391 current->container->Add(scrollW, true); |
384 |
392 |
385 UIElement elm = scrollW; |
393 UIElement elm = scrollW; |
386 UiWidget* widget = new UiWidget(elm); |
394 UiWidget* widget = new UiWidget(elm); |
|
395 ui_context_add_widget_destructor(current->ctx, widget); |
387 |
396 |
388 // create child container |
397 // create child container |
389 Grid content = Grid(); |
398 Grid content = Grid(); |
390 scrollW.Content(content); |
399 scrollW.Content(content); |
391 |
400 |
392 UiContainer* ctn = nullptr; |
401 UiContainer* ctn = nullptr; |
393 switch (args.subcontainer) { |
402 switch (args.subcontainer) { |
394 default: |
403 default: |
395 case UI_CONTAINER_VBOX: { |
404 case UI_CONTAINER_VBOX: { |
396 ctn = new UiBoxContainer(content, UI_BOX_CONTAINER_VBOX, args.margin, args.spacing); |
405 ctn = new UiBoxContainer(content, UI_BOX_CONTAINER_VBOX, args.margin, args.spacing); |
397 break; |
406 break; |
398 } |
407 } |
399 case UI_CONTAINER_HBOX: { |
408 case UI_CONTAINER_HBOX: { |
400 ctn = new UiBoxContainer(content, UI_BOX_CONTAINER_HBOX, args.margin, args.spacing); |
409 ctn = new UiBoxContainer(content, UI_BOX_CONTAINER_HBOX, args.margin, args.spacing); |
401 break; |
410 break; |
402 } |
411 } |
403 case UI_CONTAINER_GRID: { |
412 case UI_CONTAINER_GRID: { |
404 ctn = new UiGridContainer(content, args.margin, args.columnspacing, args.rowspacing); |
413 ctn = new UiGridContainer(content, args.margin, args.columnspacing, args.rowspacing); |
405 break; |
414 break; |
406 } |
415 } |
407 } |
416 } |
|
417 ui_context_add_container_destructor(current->ctx, ctn); |
408 |
418 |
409 UiObject* newobj = uic_object_new(obj, widget); |
419 UiObject* newobj = uic_object_new(obj, widget); |
410 newobj->container = ctn; |
420 newobj->container = ctn; |
411 uic_obj_add(obj, newobj); |
421 uic_obj_add(obj, newobj); |
412 |
422 |
424 } |
434 } |
425 |
435 |
426 static UiObject* create_subcontainer_obj(UiObject* current, Grid subcontainer, UiSubContainerType type, int margin, int spacing, int columnspacing, int rowspacing) { |
436 static UiObject* create_subcontainer_obj(UiObject* current, Grid subcontainer, UiSubContainerType type, int margin, int spacing, int columnspacing, int rowspacing) { |
427 UiContainer* ctn = nullptr; |
437 UiContainer* ctn = nullptr; |
428 switch (type) { |
438 switch (type) { |
429 default: |
439 default: |
430 case UI_CONTAINER_VBOX: { |
440 case UI_CONTAINER_VBOX: { |
431 ctn = new UiBoxContainer(subcontainer, UI_BOX_CONTAINER_VBOX, margin, spacing); |
441 ctn = new UiBoxContainer(subcontainer, UI_BOX_CONTAINER_VBOX, margin, spacing); |
432 break; |
442 break; |
433 } |
443 } |
434 case UI_CONTAINER_HBOX: { |
444 case UI_CONTAINER_HBOX: { |
435 ctn = new UiBoxContainer(subcontainer, UI_BOX_CONTAINER_HBOX, margin, spacing); |
445 ctn = new UiBoxContainer(subcontainer, UI_BOX_CONTAINER_HBOX, margin, spacing); |
436 break; |
446 break; |
437 } |
447 } |
438 case UI_CONTAINER_GRID: { |
448 case UI_CONTAINER_GRID: { |
439 ctn = new UiGridContainer(subcontainer, margin, columnspacing, rowspacing); |
449 ctn = new UiGridContainer(subcontainer, margin, columnspacing, rowspacing); |
440 break; |
450 break; |
441 } |
451 } |
442 } |
452 } |
|
453 ui_context_add_container_destructor(current->ctx, ctn); |
443 |
454 |
444 UIElement elm = subcontainer; |
455 UIElement elm = subcontainer; |
445 UiWidget* widget = new UiWidget(elm); |
456 UiWidget* widget = new UiWidget(elm); |
|
457 ui_context_add_widget_destructor(current->ctx, widget); |
446 UiObject* newobj = uic_object_new(current, widget); |
458 UiObject* newobj = uic_object_new(current, widget); |
447 newobj->container = ctn; |
459 newobj->container = ctn; |
448 return newobj; |
460 return newobj; |
449 } |
461 } |
450 |
462 |
625 UI_APPLY_LAYOUT1(current, args); |
637 UI_APPLY_LAYOUT1(current, args); |
626 current->container->Add(tabview->GetFrameworkElement(), true); |
638 current->container->Add(tabview->GetFrameworkElement(), true); |
627 |
639 |
628 UIElement elm = tabview->GetFrameworkElement(); |
640 UIElement elm = tabview->GetFrameworkElement(); |
629 UiWidget* widget = new UiWidget(elm); |
641 UiWidget* widget = new UiWidget(elm); |
|
642 ui_context_add_widget_destructor(current->ctx, widget); |
630 widget->data1 = tabview; |
643 widget->data1 = tabview; |
631 |
644 |
632 UiObject* newobj = uic_object_new(obj, widget); |
645 UiObject* newobj = uic_object_new(obj, widget); |
633 newobj->container = ctn; |
646 newobj->container = ctn; |
634 uic_obj_add(obj, newobj); |
647 uic_obj_add(obj, newobj); |