ui/gtk/container.c

changeset 120
49bc645df8b7
parent 116
480354705c2f
child 121
1cc365c34125
equal deleted inserted replaced
119:d7a7fb79b5f7 120:49bc645df8b7
181 ui_reset_layout(ct->layout); 181 ui_reset_layout(ct->layout);
182 ct->current = widget; 182 ct->current = widget;
183 } 183 }
184 #endif 184 #endif
185 185
186 UiContainer* ui_scrolledwindow_container(UiObject *obj, GtkWidget *scrolledwindow) {
187 UiContainer *ct = ucx_mempool_calloc(
188 obj->ctx->mempool,
189 1,
190 sizeof(UiContainer));
191 ct->widget = scrolledwindow;
192 ct->add = ui_scrolledwindow_container_add;
193 return ct;
194 }
195
196 void ui_scrolledwindow_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill) {
197 gtk_container_add(GTK_CONTAINER(ct->widget), widget);
198 ui_reset_layout(ct->layout);
199 ct->current = widget;
200 }
201
186 UiContainer* ui_tabview_container(UiObject *obj, GtkWidget *tabview) { 202 UiContainer* ui_tabview_container(UiObject *obj, GtkWidget *tabview) {
187 UiTabViewContainer *ct = ucx_mempool_calloc( 203 UiTabViewContainer *ct = ucx_mempool_calloc(
188 obj->ctx->mempool, 204 obj->ctx->mempool,
189 1, 205 1,
190 sizeof(UiTabViewContainer)); 206 sizeof(UiTabViewContainer));
306 uic_obj_add(obj, newobj); 322 uic_obj_add(obj, newobj);
307 323
308 return widget; 324 return widget;
309 } 325 }
310 326
327 UIWIDGET ui_scrolledwindow(UiObject *obj) {
328 UiContainer *ct = uic_get_current_container(obj);
329 GtkWidget *sw = gtk_scrolled_window_new(NULL, NULL);
330 ct->add(ct, sw, TRUE);
331
332 UiObject *newobj = uic_object_new(obj, sw);
333 newobj->container = ui_scrolledwindow_container(obj, sw);
334 uic_obj_add(obj, newobj);
335
336 return sw;
337 }
338
311 UIWIDGET ui_tabview(UiObject *obj) { 339 UIWIDGET ui_tabview(UiObject *obj) {
312 GtkWidget *tabview = gtk_notebook_new(); 340 GtkWidget *tabview = gtk_notebook_new();
313 gtk_notebook_set_show_border(GTK_NOTEBOOK(tabview), FALSE); 341 gtk_notebook_set_show_border(GTK_NOTEBOOK(tabview), FALSE);
314 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(tabview), FALSE); 342 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(tabview), FALSE);
315 343

mercurial