From: Rafał Długołęcki Date: Sun, 25 Jan 2015 21:41:22 +0000 (+0100) Subject: Add mouse vertical scrolling. X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=53d9ddd557f5c7543a14402a2a01b0119eadbbfa;p=familia.git Add mouse vertical scrolling. --- diff --git a/data/gui.glade b/data/gui.glade index 8b559af..6140265 100644 --- a/data/gui.glade +++ b/data/gui.glade @@ -1,6 +1,7 @@ + - + FileAccel @@ -98,13 +99,82 @@ True False gtk-missing-image - 1 + 1 True False gtk-missing-image + + False + 5 + dialog + + + False + vertical + 2 + + + False + end + + + gtk-cancel + True + True + True + True + + + False + True + 0 + + + + + gtk-open + True + True + True + True + True + True + + + False + True + 1 + + + + + False + True + end + 0 + + + + + + + + + openfiledialog-cancel + openfiledialog-ok + + + + -100 + 100 + 0.10000000000000001 + 10 + + + False 400 @@ -321,10 +391,12 @@ True True False - + GDK_STRUCTURE_MASK | GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK - + + + True @@ -374,73 +446,4 @@ - - False - 5 - dialog - - - False - vertical - 2 - - - False - end - - - gtk-cancel - True - True - True - True - - - False - True - 0 - - - - - gtk-open - True - True - True - True - True - True - - - False - True - 1 - - - - - False - True - end - 0 - - - - - - - - - openfiledialog-cancel - openfiledialog-ok - - - - -100 - 100 - 0.10000000000000001 - 10 - - - diff --git a/src/ui/drawing_area.c b/src/ui/drawing_area.c index 8eefe5f..491906e 100644 --- a/src/ui/drawing_area.c +++ b/src/ui/drawing_area.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "../debug.h" #include "drawing_area.h" @@ -148,3 +149,19 @@ void drawing_area_unrealize (GtkWidget *widget, gpointer data) { /* Code */ } + +void drawing_area_event_scroll (GtkWidget *widget, GdkEventScroll *event, gpointer user_data) +{ + assert(event->type == GDK_SCROLL); + + switch(event->direction) { + case GDK_SCROLL_UP: + camera_pos_y++; + gtk_widget_queue_draw(widget); + break; + case GDK_SCROLL_DOWN: + camera_pos_y--; + gtk_widget_queue_draw(widget); + break; + } +}