diff options
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/misc/ChangeLog | 5 | ||||
-rw-r--r-- | widgets/misc/e-scroll-frame.c | 33 |
2 files changed, 36 insertions, 2 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index 2529f8f9f7..51a3b2d029 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,8 @@ +2000-06-11 Anders Carlsson <andersca@gnu.org> + + * e-scroll-frame.c (e_scroll_frame_button_press): Add support + for mouse wheel scrolling in EScrollFrame. + 2000-06-10 Ettore Perazzoli <ettore@helixcode.com> * e-title-bar.c (close_button_realize_cb): Unref the pixmap and diff --git a/widgets/misc/e-scroll-frame.c b/widgets/misc/e-scroll-frame.c index f36e5a1fbe..f4317d51d7 100644 --- a/widgets/misc/e-scroll-frame.c +++ b/widgets/misc/e-scroll-frame.c @@ -128,7 +128,7 @@ static void e_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area); static void e_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition); static void e_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static gint e_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event); - +static gint e_scroll_frame_button_press (GtkWidget *widget, GdkEventButton *event); static void e_scroll_frame_add (GtkContainer *container, GtkWidget *widget); static void e_scroll_frame_remove (GtkContainer *container, GtkWidget *widget); static void e_scroll_frame_forall (GtkContainer *container, gboolean include_internals, @@ -223,7 +223,8 @@ e_scroll_frame_class_init (EScrollFrameClass *class) widget_class->size_request = e_scroll_frame_size_request; widget_class->size_allocate = e_scroll_frame_size_allocate; widget_class->expose_event = e_scroll_frame_expose; - + widget_class->button_press_event = e_scroll_frame_button_press; + container_class->add = e_scroll_frame_add; container_class->remove = e_scroll_frame_remove; container_class->forall = e_scroll_frame_forall; @@ -778,6 +779,34 @@ e_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) gtk_widget_hide (priv->vsb); } +/* Button press handler for the scroll framw diget */ +static gint +e_scroll_frame_button_press (GtkWidget *widget, GdkEventButton *event) +{ + g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (E_IS_SCROLL_FRAME (widget), FALSE); + g_return_val_if_fail (event != NULL, FALSE); + + /* This is to handle mouse wheel scrolling */ + if (event->button == 4 || event->button == 5) { + GtkAdjustment *adj; + gfloat new_value; + + gtk_object_get (GTK_OBJECT (widget), + "vadjustment", &adj, + NULL); + new_value = adj->value + ((event->button == 4) ? + -adj->page_increment / 2: + adj->page_increment / 2); + new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size); + gtk_adjustment_set_value (adj, new_value); + + return TRUE; + } + + return FALSE; +} + /* Expose handler for the scroll frame widget */ static gint e_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event) |