1 typedef struct _GList GList;
2 typedef struct _GdkRectangle GdkRectangle;
9 typedef enum { GTK_PACK_END } GtkPathType;
11 GTK_POS_LEFT, GTK_POS_RIGHT, GTK_POS_TOP, GTK_POS_BOTTOM
13 typedef struct _GtkWidget GtkWidget;
17 typedef struct _GtkNotebook GtkNotebook;
18 typedef struct _GtkNotebookPage GtkNotebookPage;
20 GtkNotebookPage *cur_page;
21 unsigned int homogeneous:1;
24 DRAG_OPERATION_NONE, DRAG_OPERATION_REORDER, DRAG_OPERATION_DETACH
25 } GtkNotebookDragOperation;
26 struct _GtkNotebookPage {
29 GdkRectangle requisition, allocation;
31 typedef struct _GtkNotebookPrivate GtkNotebookPrivate;
32 struct _GtkNotebookPrivate {
33 GtkNotebookDragOperation operation;
36 GtkNotebookPage *detached_tab;
38 int gtk_notebook_calculate_tabs_allocation(GtkNotebook * notebook,
40 GList * last_child, int showarrow,
42 int *expanded_tabs, int min, int max)
44 GtkNotebookPrivate *priv;
45 GtkNotebookPage *page;
46 int allocate_at_bottom;
58 GdkRectangle child_allocation;
61 && *children != last_child
64 (((GtkNotebookPage *) (page))->tab_label->parent
66 ((GtkWidget *) (notebook)))
69 if (*expanded_tabs && (notebook->homogeneous)) {
70 tab_extra_space = *remaining_space / *expanded_tabs;
71 *remaining_space -= tab_extra_space;
76 child_allocation.width =
77 page->requisition.width +
80 if (gap_left && packing_changed) {
81 if (allocate_at_bottom) {
88 if (notebook->cur_page->pack
89 && right_x > anchor) {
97 if (allocate_at_bottom)
98 anchor -= child_allocation.width;
100 == DRAG_OPERATION_REORDER
101 && page->pack == notebook->cur_page->pack) {
102 if (!allocate_at_bottom
105 anchor + child_allocation.width / 2)
110 else if (allocate_at_bottom
113 child_allocation.width / 2
116 child_allocation.width)
122 child_allocation.x = anchor;
127 child_allocation.height =
128 page->requisition.height + tab_overlap +
130 if (packing_changed) {
131 priv->x = child_allocation.x;
133 if (priv->operation == DRAG_OPERATION_REORDER
134 && page->pack == notebook->cur_page->pack) {
135 if (!allocate_at_bottom
139 child_allocation.height / 2)
147 if ((page == priv->detached_tab
148 && priv->operation == DRAG_OPERATION_DETACH)
149 || (page == notebook->cur_page
150 && priv->operation == DRAG_OPERATION_REORDER)) {
151 page->allocation.x = 0;
153 if (page != notebook->cur_page) {
156 page->allocation.y += ythickness;
158 page->allocation.height =
159 1 > page->allocation.height - ythickness ? 1 : page->allocation.
164 page->allocation.x += xthickness;
166 page->allocation.width =
167 1 > page->allocation.width - xthickness ? 1 : page->allocation.width - xthickness;
174 priv->operation != DRAG_OPERATION_REORDER ||
175 priv->operation == DRAG_OPERATION_REORDER
176 && page != notebook->cur_page
178 if (!allocate_at_bottom)
180 child_allocation.width -
184 if (priv->operation != DRAG_OPERATION_REORDER
185 || priv->operation == DRAG_OPERATION_REORDER
186 && page != notebook->cur_page)
187 if (priv->operation == DRAG_OPERATION_REORDER)
189 notebook->cur_page->pack
190 && !allocate_at_bottom
192 anchor + child_allocation.height / 2
194 anchor + child_allocation.height)
201 IA__gtk_widget_set_child_visible(page->tab_label, 1);