diff options
author | Anders Carlsson <andersca@src.gnome.org> | 2000-07-08 15:18:47 +0800 |
---|---|---|
committer | Anders Carlsson <andersca@src.gnome.org> | 2000-07-08 15:18:47 +0800 |
commit | 2219b51a72c7c598777a64f1b39f329c12a7e9c6 (patch) | |
tree | a58246cb8ae77146198382c7ad8e8037531e7551 /calendar/gui/e-day-view.c | |
parent | d93826e6b32b5ab3fde15eaa5746df1fbff76a60 (diff) | |
download | gsoc2013-evolution-2219b51a72c7c598777a64f1b39f329c12a7e9c6.tar gsoc2013-evolution-2219b51a72c7c598777a64f1b39f329c12a7e9c6.tar.gz gsoc2013-evolution-2219b51a72c7c598777a64f1b39f329c12a7e9c6.tar.bz2 gsoc2013-evolution-2219b51a72c7c598777a64f1b39f329c12a7e9c6.tar.lz gsoc2013-evolution-2219b51a72c7c598777a64f1b39f329c12a7e9c6.tar.xz gsoc2013-evolution-2219b51a72c7c598777a64f1b39f329c12a7e9c6.tar.zst gsoc2013-evolution-2219b51a72c7c598777a64f1b39f329c12a7e9c6.zip |
Add mouse wheel scrolling support to the calendar day and week views
svn path=/trunk/; revision=3971
Diffstat (limited to 'calendar/gui/e-day-view.c')
-rw-r--r-- | calendar/gui/e-day-view.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index ab789437e7..a0dfb177bb 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -133,6 +133,11 @@ static gboolean e_day_view_on_main_canvas_button_press (GtkWidget *widget, static gboolean e_day_view_on_main_canvas_button_release (GtkWidget *widget, GdkEventButton *event, EDayView *day_view); + +static gboolean e_day_view_on_time_canvas_button_press (GtkWidget *widget, + GdkEventButton *event, + EDayView *day_view); + static void e_day_view_update_calendar_selection_time (EDayView *day_view); static gboolean e_day_view_on_main_canvas_motion (GtkWidget *widget, GdkEventMotion *event, @@ -759,7 +764,11 @@ e_day_view_init (EDayView *day_view) 0, 1, 1, 2, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); gtk_widget_show (day_view->time_canvas); - + gtk_signal_connect_after (GTK_OBJECT (day_view->time_canvas), + "button_press_event", + GTK_SIGNAL_FUNC (e_day_view_on_time_canvas_button_press), + day_view); + canvas_group = GNOME_CANVAS_GROUP (GNOME_CANVAS (day_view->time_canvas)->root); day_view->time_canvas_item = @@ -1906,6 +1915,20 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget, gint event_x, event_y, scroll_x, scroll_y, row, day, event_num; EDayViewPosition pos; + /* Handle scroll wheel events */ + if (event->button == 4 || event->button == 5) { + GtkAdjustment *adj = GTK_LAYOUT (day_view->main_canvas)->vadjustment; + gfloat new_value; + + 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; + } + /* Convert the coords to the main canvas window, or return if the window is not found. */ if (!e_day_view_convert_event_coords (day_view, (GdkEvent*) event, @@ -1957,6 +1980,29 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget, static gboolean +e_day_view_on_time_canvas_button_press (GtkWidget *widget, + GdkEventButton *event, + EDayView *day_view) +{ + /* Handle scroll wheel events */ + if (event->button == 4 || event->button == 5) { + GtkAdjustment *adj = GTK_LAYOUT (day_view->main_canvas)->vadjustment; + gfloat new_value; + + 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; +} + + +static gboolean e_day_view_on_long_event_button_press (EDayView *day_view, gint event_num, GdkEventButton *event, |