ui/gtk/container.c

branch
newapi
changeset 178
7c3ff86ee9d4
parent 174
0358f1d9c506
child 253
087cc9216f28
equal deleted inserted replaced
177:e79a60b3a7cb 178:7c3ff86ee9d4
67 #endif 67 #endif
68 } 68 }
69 69
70 /* -------------------- Frame Container (deprecated) -------------------- */ 70 /* -------------------- Frame Container (deprecated) -------------------- */
71 UiContainer* ui_frame_container(UiObject *obj, GtkWidget *frame) { 71 UiContainer* ui_frame_container(UiObject *obj, GtkWidget *frame) {
72 UiContainer *ct = ucx_mempool_calloc( 72 UiContainer *ct = cxCalloc(
73 obj->ctx->mempool, 73 obj->ctx->allocator,
74 1, 74 1,
75 sizeof(UiContainer)); 75 sizeof(UiContainer));
76 ct->widget = frame; 76 ct->widget = frame;
77 ct->add = ui_frame_container_add; 77 ct->add = ui_frame_container_add;
78 return ct; 78 return ct;
85 } 85 }
86 86
87 87
88 /* -------------------- Box Container -------------------- */ 88 /* -------------------- Box Container -------------------- */
89 UiContainer* ui_box_container(UiObject *obj, GtkWidget *box) { 89 UiContainer* ui_box_container(UiObject *obj, GtkWidget *box) {
90 UiBoxContainer *ct = ucx_mempool_calloc( 90 UiBoxContainer *ct = cxCalloc(
91 obj->ctx->mempool, 91 obj->ctx->allocator,
92 1, 92 1,
93 sizeof(UiBoxContainer)); 93 sizeof(UiBoxContainer));
94 ct->container.widget = box; 94 ct->container.widget = box;
95 ct->container.add = ui_box_container_add; 95 ct->container.add = ui_box_container_add;
96 return (UiContainer*)ct; 96 return (UiContainer*)ct;
116 ui_reset_layout(ct->layout); 116 ui_reset_layout(ct->layout);
117 ct->current = widget; 117 ct->current = widget;
118 } 118 }
119 119
120 UiContainer* ui_grid_container(UiObject *obj, GtkWidget *grid) { 120 UiContainer* ui_grid_container(UiObject *obj, GtkWidget *grid) {
121 UiGridContainer *ct = ucx_mempool_calloc( 121 UiGridContainer *ct = cxCalloc(
122 obj->ctx->mempool, 122 obj->ctx->allocator,
123 1, 123 1,
124 sizeof(UiGridContainer)); 124 sizeof(UiGridContainer));
125 ct->container.widget = grid; 125 ct->container.widget = grid;
126 ct->container.add = ui_grid_container_add; 126 ct->container.add = ui_grid_container_add;
127 #ifdef UI_GTK2 127 #ifdef UI_GTK2
200 ct->current = widget; 200 ct->current = widget;
201 } 201 }
202 #endif 202 #endif
203 203
204 UiContainer* ui_scrolledwindow_container(UiObject *obj, GtkWidget *scrolledwindow) { 204 UiContainer* ui_scrolledwindow_container(UiObject *obj, GtkWidget *scrolledwindow) {
205 UiContainer *ct = ucx_mempool_calloc( 205 UiContainer *ct = cxCalloc(
206 obj->ctx->mempool, 206 obj->ctx->allocator,
207 1, 207 1,
208 sizeof(UiContainer)); 208 sizeof(UiContainer));
209 ct->widget = scrolledwindow; 209 ct->widget = scrolledwindow;
210 ct->add = ui_scrolledwindow_container_add; 210 ct->add = ui_scrolledwindow_container_add;
211 return ct; 211 return ct;
221 ui_reset_layout(ct->layout); 221 ui_reset_layout(ct->layout);
222 ct->current = widget; 222 ct->current = widget;
223 } 223 }
224 224
225 UiContainer* ui_tabview_container(UiObject *obj, GtkWidget *tabview) { 225 UiContainer* ui_tabview_container(UiObject *obj, GtkWidget *tabview) {
226 UiTabViewContainer *ct = ucx_mempool_calloc( 226 UiTabViewContainer *ct = cxCalloc(
227 obj->ctx->mempool, 227 obj->ctx->allocator,
228 1, 228 1,
229 sizeof(UiTabViewContainer)); 229 sizeof(UiTabViewContainer));
230 ct->container.widget = tabview; 230 ct->container.widget = tabview;
231 ct->container.add = ui_tabview_container_add; 231 ct->container.add = ui_tabview_container_add;
232 return (UiContainer*)ct; 232 return (UiContainer*)ct;
406 UiContainer *ct = uic_get_current_container(obj); 406 UiContainer *ct = uic_get_current_container(obj);
407 ct->add(ct, paned, TRUE); 407 ct->add(ct, paned, TRUE);
408 408
409 if(max <= 0) max = INT_MAX; 409 if(max <= 0) max = INT_MAX;
410 410
411 UiPanedContainer *pctn = ucx_mempool_calloc( 411 UiPanedContainer *pctn = cxCalloc(
412 obj->ctx->mempool, 412 obj->ctx->allocator,
413 1, 413 1,
414 sizeof(UiPanedContainer)); 414 sizeof(UiPanedContainer));
415 pctn->container.widget = paned; 415 pctn->container.widget = paned;
416 pctn->container.add = ui_paned_container_add; 416 pctn->container.add = ui_paned_container_add;
417 pctn->current_pane = paned; 417 pctn->current_pane = paned;
480 UiObject *left = uic_object_new(obj, sidebar); 480 UiObject *left = uic_object_new(obj, sidebar);
481 UiContainer *ct1 = ui_box_container(obj, sidebar); 481 UiContainer *ct1 = ui_box_container(obj, sidebar);
482 left->container = ct1; 482 left->container = ct1;
483 483
484 UiObject *right = uic_object_new(obj, sidebar); 484 UiObject *right = uic_object_new(obj, sidebar);
485 UiContainer *ct2 = ucx_mempool_malloc( 485 UiContainer *ct2 = cxCalloc(
486 obj->ctx->mempool, 486 obj->ctx->allocator,
487 1,
487 sizeof(UiContainer)); 488 sizeof(UiContainer));
488 ct2->widget = paned; 489 ct2->widget = paned;
489 ct2->add = ui_split_container_add2; 490 ct2->add = ui_split_container_add2;
490 right->container = ct2; 491 right->container = ct2;
491 492
555 // TODO: label 556 // TODO: label
556 gtk_notebook_append_page(GTK_NOTEBOOK(view->widget), frame, NULL); 557 gtk_notebook_append_page(GTK_NOTEBOOK(view->widget), frame, NULL);
557 558
558 UiObject *tab = ui_malloc(view->ctx, sizeof(UiObject)); 559 UiObject *tab = ui_malloc(view->ctx, sizeof(UiObject));
559 tab->widget = NULL; // initialization for uic_context() 560 tab->widget = NULL; // initialization for uic_context()
560 tab->ctx = uic_context(tab, view->ctx->mempool); 561 tab->ctx = uic_context(tab, view->ctx->allocator);
561 tab->ctx->parent = view->ctx; 562 tab->ctx->parent = view->ctx;
562 tab->ctx->attach_document = uic_context_attach_document; 563 tab->ctx->attach_document = uic_context_attach_document;
563 tab->ctx->detach_document2 = uic_context_detach_document2; 564 tab->ctx->detach_document2 = uic_context_detach_document2;
564 tab->widget = frame; 565 tab->widget = frame;
565 tab->window = view->ctx->obj->window; 566 tab->window = view->ctx->obj->window;

mercurial