1 typedef struct _GList GList;
2 typedef struct _GdkRectangle GdkRectangle;
10 GTK_PACK_START, GTK_PACK_END
13 GTK_POS_LEFT, GTK_POS_RIGHT, GTK_POS_TOP, GTK_POS_BOTTOM
15 typedef struct _GtkWidget GtkWidget;
16 typedef struct _GtkRequisition GtkRequisition;
17 typedef GdkRectangle GtkAllocation;
18 struct _GtkRequisition {
25 typedef struct _GtkNotebook GtkNotebook;
26 typedef struct _GtkNotebookPage GtkNotebookPage;
28 GtkNotebookPage *cur_page;
29 unsigned int homogeneous:1;
32 DRAG_OPERATION_NONE, DRAG_OPERATION_REORDER, DRAG_OPERATION_DETACH
33 } GtkNotebookDragOperation;
34 struct _GtkNotebookPage {
37 GtkRequisition requisition;
38 GtkAllocation allocation;
40 typedef struct _GtkNotebookPrivate GtkNotebookPrivate;
41 struct _GtkNotebookPrivate {
42 GtkNotebookDragOperation operation;
45 GtkNotebookPage *detached_tab;
47 int gtk_notebook_calculate_tabs_allocation(GtkNotebook * notebook,
49 GList * last_child, int showarrow,
50 int direction, int *remaining_space,
51 int *expanded_tabs, int min, int max)
53 GtkNotebookPrivate *priv;
54 GtkNotebookPage *page;
55 int allocate_at_bottom;
67 GtkAllocation child_allocation;
68 while (*children && *children != last_child) {
70 (((GtkNotebookPage *) (page))->tab_label->parent ==
71 ((GtkWidget *) (notebook))))
73 if (*expanded_tabs && (notebook->homogeneous)) {
74 tab_extra_space = *remaining_space / *expanded_tabs;
75 *remaining_space -= tab_extra_space;
80 child_allocation.width =
81 page->requisition.width + tab_overlap +
83 if (!gap_left && packing_changed) {
84 if (!allocate_at_bottom) {
86 left_x = priv->drag_window_x =
93 if ((notebook->cur_page->pack ==
95 && right_x > anchor)) {
99 left_x = priv->drag_window_x =
104 if (allocate_at_bottom)
105 anchor -= child_allocation.width;
106 if (priv->operation == DRAG_OPERATION_REORDER
107 && page->pack == notebook->cur_page->pack) {
108 if (!allocate_at_bottom
111 anchor + child_allocation.width / 2)
116 else if (allocate_at_bottom
119 child_allocation.width / 2
122 child_allocation.width)
128 child_allocation.x = anchor;
133 child_allocation.height =
134 page->requisition.height + tab_overlap +
136 if (packing_changed) {
137 priv->drag_window_x = child_allocation.x;
138 priv->drag_window_y = top_y;
139 if (priv->operation == DRAG_OPERATION_REORDER
140 && page->pack == notebook->cur_page->pack) {
141 if (!allocate_at_bottom
145 child_allocation.height / 2)
153 if ((page == priv->detached_tab
154 && priv->operation == DRAG_OPERATION_DETACH)
155 || (page == notebook->cur_page
156 && priv->operation == DRAG_OPERATION_REORDER)) {
157 page->allocation.x = 0;
159 if (page != notebook->cur_page) {
162 page->allocation.y += ythickness;
164 page->allocation.height =
166 (page->allocation.height -
167 ythickness)) ? (1) : (page->allocation.
172 page->allocation.x += xthickness;
174 page->allocation.width =
176 (page->allocation.width -
177 xthickness)) ? (1) : (page->allocation.
185 if (priv->operation != DRAG_OPERATION_REORDER
186 || (priv->operation == DRAG_OPERATION_REORDER
187 && page != notebook->cur_page))
188 if (!allocate_at_bottom)
190 child_allocation.width -
194 if (priv->operation != DRAG_OPERATION_REORDER
195 || (priv->operation == DRAG_OPERATION_REORDER
196 && page != notebook->cur_page))
197 if (priv->operation == DRAG_OPERATION_REORDER)
199 notebook->cur_page->pack
200 && !allocate_at_bottom
202 anchor + child_allocation.height / 2
204 anchor + child_allocation.height)
211 IA__gtk_widget_set_child_visible(page->tab_label,