1 *** gtknotebook.c 2011-05-01 17:26:36.000000000 +0200
2 --- /tmp/gtknotebook.c 2011-05-01 17:26:31.000000000 +0200
7 static gint gtk_notebook_button_press (GtkWidget *widget,
8 GdkEventButton *event);
9 + static gboolean gtk_notebook_scroll (GtkWidget *widget,
10 + GdkEventScroll *event);
11 static gint gtk_notebook_button_release (GtkWidget *widget,
12 GdkEventButton *event);
13 static gboolean gtk_notebook_popup_menu (GtkWidget *widget);
17 widget_class->drag_data_received = gtk_notebook_drag_data_received;
18 widget_class->drag_failed = gtk_notebook_drag_failed;
19 widget_class->compute_expand = gtk_notebook_compute_expand;
20 + widget_class->scroll_event = gtk_notebook_scroll;
22 container_class->add = gtk_notebook_add;
23 container_class->remove = gtk_notebook_remove;
26 attributes.event_mask = gtk_widget_get_events (widget);
27 attributes.event_mask |= (GDK_BUTTON_PRESS_MASK |
28 GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK |
29 ! GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
30 attributes_mask = GDK_WA_X | GDK_WA_Y;
32 priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
34 attributes.event_mask = gtk_widget_get_events (widget);
35 attributes.event_mask |= (GDK_BUTTON_PRESS_MASK |
36 GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK |
37 ! GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK);
38 attributes_mask = GDK_WA_X | GDK_WA_Y;
40 priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
48 + gtk_notebook_scroll (GtkWidget *widget,
49 + GdkEventScroll *event)
51 + GtkNotebook *notebook = GTK_NOTEBOOK (widget);
52 + GtkNotebookPrivate *priv = notebook->priv;
53 + GtkWidget *child, *event_widget;
56 + if (!priv->cur_page)
59 + child = priv->cur_page->child;
60 + event_widget = gtk_get_event_widget ((GdkEvent *)event);
62 + /* ignore scroll events from the content of the page */
63 + if (!event_widget || gtk_widget_is_ancestor (event_widget, child) || event_widget == child)
66 + /* nor from the action area */
67 + for (i = 0; i < 2; i++)
69 + if (event_widget == priv->action_widget[i] ||
70 + (priv->action_widget[i] &&
71 + gtk_widget_is_ancestor (event_widget, priv->action_widget[i])))
75 + switch (event->direction)
77 + case GDK_SCROLL_RIGHT:
78 + case GDK_SCROLL_DOWN:
79 + gtk_notebook_next_page (notebook);
81 + case GDK_SCROLL_LEFT:
83 + gtk_notebook_prev_page (notebook);
92 gtk_notebook_get_preferred_width (GtkWidget *widget,