119 x++; |
120 x++; |
120 |
121 |
121 ui_reset_layout(layout); |
122 ui_reset_layout(layout); |
122 } |
123 } |
123 |
124 |
|
125 |
|
126 /* -------------------- UiTabViewContainer -------------------- */ |
|
127 |
|
128 UiTabViewContainer::UiTabViewContainer(QTabWidget* tabwidget) { |
|
129 this->tabwidget = tabwidget; |
|
130 } |
|
131 |
|
132 void UiTabViewContainer::add(QWidget* widget, bool fill) { |
|
133 QString str = QString::fromUtf8(layout.label); |
|
134 tabwidget->addTab(widget, str); |
|
135 } |
|
136 |
|
137 UiStackContainer::UiStackContainer(QStackedWidget *stack) { |
|
138 this->stack = stack; |
|
139 } |
|
140 |
|
141 void UiStackContainer::add(QWidget* widget, bool fill) { |
|
142 stack->addWidget(widget); |
|
143 } |
|
144 |
|
145 UIWIDGET ui_tabview(UiObject *obj) { |
|
146 QStackedWidget *tabwidget = new QStackedWidget(); |
|
147 |
|
148 UiContainer *ct = uic_get_current_container(obj); |
|
149 ct->add(tabwidget, true); |
|
150 |
|
151 UiObject *tabviewobj = uic_object_new(obj, tabwidget); |
|
152 tabviewobj->container = new UiStackContainer(tabwidget); |
|
153 uic_obj_add(obj, tabviewobj); |
|
154 |
|
155 return tabwidget; |
|
156 } |
|
157 |
|
158 void ui_tab(UiObject *obj, char *title) { |
|
159 UiContainer *ct = uic_get_current_container(obj); |
|
160 ct->layout.label = title; |
|
161 ui_vbox(obj); |
|
162 } |
|
163 |
|
164 void ui_select_tab(UIWIDGET tabview, int tab) { |
|
165 QStackedWidget *w = (QStackedWidget*)tabview; |
|
166 w->setCurrentIndex(tab); |
|
167 } |
|
168 |
|
169 |
124 UIWIDGET ui_grid(UiObject *obj) { |
170 UIWIDGET ui_grid(UiObject *obj) { |
125 UiContainer *ct = uic_get_current_container(obj); |
171 UiContainer *ct = uic_get_current_container(obj); |
126 QWidget *widget = new QWidget(); |
172 QWidget *widget = new QWidget(); |
127 QGridLayout *grid = new QGridLayout(); |
173 QGridLayout *grid = new QGridLayout(); |
128 widget->setLayout(grid); |
174 widget->setLayout(grid); |