1028 current->container->add(current->container, pane0, TRUE); |
1028 current->container->add(current->container, pane0, TRUE); |
1029 |
1029 |
1030 int max = args.max_panes == 0 ? 2 : args.max_panes; |
1030 int max = args.max_panes == 0 ? 2 : args.max_panes; |
1031 |
1031 |
1032 UiObject *newobj = uic_object_new(obj, pane0); |
1032 UiObject *newobj = uic_object_new(obj, pane0); |
1033 newobj->container = ui_splitpane_container(obj, pane0, orientation, max); |
1033 newobj->container = ui_splitpane_container(obj, pane0, orientation, max, args.initial_position); |
1034 uic_obj_add(obj, newobj); |
1034 uic_obj_add(obj, newobj); |
1035 |
1035 |
1036 g_object_set_data(G_OBJECT(pane0), "ui_splitpane", newobj->container); |
1036 g_object_set_data(G_OBJECT(pane0), "ui_splitpane", newobj->container); |
1037 |
1037 |
1038 return pane0; |
1038 return pane0; |
1044 |
1044 |
1045 UIWIDGET ui_vsplitpane_create(UiObject *obj, UiSplitPaneArgs args) { |
1045 UIWIDGET ui_vsplitpane_create(UiObject *obj, UiSplitPaneArgs args) { |
1046 return splitpane_create(obj, UI_VERTICAL, args); |
1046 return splitpane_create(obj, UI_VERTICAL, args); |
1047 } |
1047 } |
1048 |
1048 |
1049 UiContainer* ui_splitpane_container(UiObject *obj, GtkWidget *pane, UiOrientation orientation, int max) { |
1049 UiContainer* ui_splitpane_container(UiObject *obj, GtkWidget *pane, UiOrientation orientation, int max, int init) { |
1050 UiSplitPaneContainer *ct = ui_calloc(obj->ctx, 1, sizeof(UiSplitPaneContainer)); |
1050 UiSplitPaneContainer *ct = ui_calloc(obj->ctx, 1, sizeof(UiSplitPaneContainer)); |
1051 ct->container.widget = pane; |
1051 ct->container.widget = pane; |
1052 ct->container.add = ui_splitpane_container_add; |
1052 ct->container.add = ui_splitpane_container_add; |
1053 ct->current_pane = pane; |
1053 ct->current_pane = pane; |
1054 ct->orientation = orientation; |
1054 ct->orientation = orientation; |
1055 ct->max = max; |
1055 ct->max = max; |
|
1056 ct->initial_position = init; |
1056 ct->children = cxArrayListCreateSimple(CX_STORE_POINTERS, 4); |
1057 ct->children = cxArrayListCreateSimple(CX_STORE_POINTERS, 4); |
1057 return (UiContainer*)ct; |
1058 return (UiContainer*)ct; |
1058 } |
1059 } |
1059 |
1060 |
1060 void ui_splitpane_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill) { |
1061 void ui_splitpane_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill) { |
1067 |
1068 |
1068 cxListAdd(s->children, widget); |
1069 cxListAdd(s->children, widget); |
1069 |
1070 |
1070 if(s->pos == 0) { |
1071 if(s->pos == 0) { |
1071 PANED_SET_CHILD1(s->current_pane, widget); |
1072 PANED_SET_CHILD1(s->current_pane, widget); |
|
1073 if(s->initial_position > 0) { |
|
1074 gtk_paned_set_position(GTK_PANED(s->current_pane), s->initial_position); |
|
1075 } |
1072 s->pos++; |
1076 s->pos++; |
1073 s->nchildren++; |
1077 s->nchildren++; |
1074 } else { |
1078 } else { |
1075 if(s->nchildren+1 == s->max) { |
1079 if(s->nchildren+1 == s->max) { |
1076 PANED_SET_CHILD2(s->current_pane, widget); |
1080 PANED_SET_CHILD2(s->current_pane, widget); |