aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@src.gnome.org>2000-07-08 15:18:47 +0800
committerAnders Carlsson <andersca@src.gnome.org>2000-07-08 15:18:47 +0800
commit2219b51a72c7c598777a64f1b39f329c12a7e9c6 (patch)
treea58246cb8ae77146198382c7ad8e8037531e7551 /calendar/gui
parentd93826e6b32b5ab3fde15eaa5746df1fbff76a60 (diff)
downloadgsoc2013-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')
-rw-r--r--calendar/gui/e-day-view.c48
-rw-r--r--calendar/gui/e-week-view.c14
2 files changed, 61 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,
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index db27ef3404..ee237abffb 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -1355,6 +1355,20 @@ e_week_view_on_button_press (GtkWidget *widget,
g_print ("In e_week_view_on_button_press\n");
#endif
+ /* Handle scroll wheel events */
+ if (event->button == 4 || event->button == 5) {
+ GtkAdjustment *adj = GTK_RANGE (week_view->vscrollbar)->adjustment;
+ gfloat new_value;
+
+ new_value = adj->value + ((event->button == 4) ?
+ -adj->page_increment:
+ adj->page_increment);
+ new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
+ gtk_adjustment_set_value (adj, new_value);
+
+ return TRUE;
+ }
+
/* If an event is pressed just return. */
if (week_view->pressed_event_num != -1)
return FALSE;