ui/winui/container.cpp

branch
newapi
changeset 188
fbbae6738252
parent 186
5db4979bf482
child 190
70fd1b24e395
equal deleted inserted replaced
187:24ce2c326d85 188:fbbae6738252
47 } 47 }
48 48
49 49
50 // --------------------- UiBoxContainer --------------------- 50 // --------------------- UiBoxContainer ---------------------
51 51
52 static UIWIDGET ui_box(UiObject* obj, UiBoxContainerType type) {
53 UiContainer* ct = uic_get_current_container(obj);
54
55 Grid grid = Grid();
56 ct->Add(grid, true);
57
58 UIElement elm = grid;
59 UiWidget* widget = new UiWidget(elm);
60
61 UiObject* newobj = uic_object_new(obj, widget);
62 newobj->container = new UiBoxContainer(grid, type);
63 uic_obj_add(obj, newobj);
64
65 return widget;
66 }
67
68 UIWIDGET ui_vbox(UiObject* obj) {
69 return ui_box(obj, UI_CONTAINER_VBOX);
70 }
71
72 UIWIDGET ui_hbox(UiObject* obj) {
73 return ui_box(obj, UI_CONTAINER_HBOX);
74 }
75
52 UiBoxContainer::UiBoxContainer(Grid grid, enum UiBoxContainerType type) { 76 UiBoxContainer::UiBoxContainer(Grid grid, enum UiBoxContainerType type) {
53 this->grid = grid; 77 this->grid = grid;
54 this->type = type; 78 this->type = type;
55 79
56 GridLength gl; 80 GridLength gl;
107 grid.Children().Append(control); 131 grid.Children().Append(control);
108 132
109 ui_reset_layout(layout); 133 ui_reset_layout(layout);
110 } 134 }
111 135
112 // --------------------- UiBoxContainer --------------------- 136
137 // --------------------- UiGridContainer ---------------------
113 138
114 UIWIDGET ui_grid(UiObject* obj) { 139 UIWIDGET ui_grid(UiObject* obj) {
115 return ui_grid_sp(obj, 0, 0, 0); 140 return ui_grid_sp(obj, 0, 0, 0);
116 } 141 }
117 142

mercurial