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) {
90 if ((notebook->cur_page->pack ==
92 && right_x > anchor)) {
101 if (allocate_at_bottom)
102 anchor -= child_allocation.width;
103 if (priv->operation == DRAG_OPERATION_REORDER
104 && page->pack == notebook->cur_page->pack) {
105 if (!allocate_at_bottom
108 anchor + child_allocation.width / 2)
113 else if (allocate_at_bottom
116 child_allocation.width / 2
119 child_allocation.width)
125 child_allocation.x = anchor;
130 child_allocation.height =
131 page->requisition.height + tab_overlap +
133 if (packing_changed) {
134 priv->x = child_allocation.x;
136 if (priv->operation == DRAG_OPERATION_REORDER
137 && page->pack == notebook->cur_page->pack) {
138 if (!allocate_at_bottom
142 child_allocation.height / 2)
150 if ((page == priv->detached_tab
151 && priv->operation == DRAG_OPERATION_DETACH)
152 || (page == notebook->cur_page
153 && priv->operation == DRAG_OPERATION_REORDER)) {
154 page->allocation.x = 0;
156 if (page != notebook->cur_page) {
159 page->allocation.y += ythickness;
161 page->allocation.height =
163 (page->allocation.height -
164 ythickness)) ? (1) : (page->allocation.
169 page->allocation.x += xthickness;
171 page->allocation.width =
173 (page->allocation.width -
174 xthickness)) ? (1) : (page->allocation.
182 if (priv->operation != DRAG_OPERATION_REORDER
183 || (priv->operation == DRAG_OPERATION_REORDER
184 && page != notebook->cur_page))
185 if (!allocate_at_bottom)
187 child_allocation.width -
191 if (priv->operation != DRAG_OPERATION_REORDER
192 || (priv->operation == DRAG_OPERATION_REORDER
193 && page != notebook->cur_page))
194 if (priv->operation == DRAG_OPERATION_REORDER)
196 notebook->cur_page->pack
197 && !allocate_at_bottom
199 anchor + child_allocation.height / 2
201 anchor + child_allocation.height)
208 IA__gtk_widget_set_child_visible(page->tab_label,