diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 5 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 5 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 5 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 5 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 5 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 5 | ||||
-rw-r--r-- | gtk/gtkoptionmenu.c | 49 |
8 files changed, 84 insertions, 0 deletions
@@ -1,3 +1,8 @@ +2001-09-16 Alexander Larsson <alla@lysator.liu.se> + + * gtk/gtkoptionmenu.c: + Handle scroll wheel events. + Fri Sep 14 22:31:25 2001 Matthias Clasen <matthiasc@poet.de> * demos/gtk-demo/main.c (setup_default_icon): Use a shaped diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 4ab2e19dad..8011ff903f 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +2001-09-16 Alexander Larsson <alla@lysator.liu.se> + + * gtk/gtkoptionmenu.c: + Handle scroll wheel events. + Fri Sep 14 22:31:25 2001 Matthias Clasen <matthiasc@poet.de> * demos/gtk-demo/main.c (setup_default_icon): Use a shaped diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 4ab2e19dad..8011ff903f 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +2001-09-16 Alexander Larsson <alla@lysator.liu.se> + + * gtk/gtkoptionmenu.c: + Handle scroll wheel events. + Fri Sep 14 22:31:25 2001 Matthias Clasen <matthiasc@poet.de> * demos/gtk-demo/main.c (setup_default_icon): Use a shaped diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 4ab2e19dad..8011ff903f 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +2001-09-16 Alexander Larsson <alla@lysator.liu.se> + + * gtk/gtkoptionmenu.c: + Handle scroll wheel events. + Fri Sep 14 22:31:25 2001 Matthias Clasen <matthiasc@poet.de> * demos/gtk-demo/main.c (setup_default_icon): Use a shaped diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 4ab2e19dad..8011ff903f 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +2001-09-16 Alexander Larsson <alla@lysator.liu.se> + + * gtk/gtkoptionmenu.c: + Handle scroll wheel events. + Fri Sep 14 22:31:25 2001 Matthias Clasen <matthiasc@poet.de> * demos/gtk-demo/main.c (setup_default_icon): Use a shaped diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 4ab2e19dad..8011ff903f 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +2001-09-16 Alexander Larsson <alla@lysator.liu.se> + + * gtk/gtkoptionmenu.c: + Handle scroll wheel events. + Fri Sep 14 22:31:25 2001 Matthias Clasen <matthiasc@poet.de> * demos/gtk-demo/main.c (setup_default_icon): Use a shaped diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 4ab2e19dad..8011ff903f 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +2001-09-16 Alexander Larsson <alla@lysator.liu.se> + + * gtk/gtkoptionmenu.c: + Handle scroll wheel events. + Fri Sep 14 22:31:25 2001 Matthias Clasen <matthiasc@poet.de> * demos/gtk-demo/main.c (setup_default_icon): Use a shaped diff --git a/gtk/gtkoptionmenu.c b/gtk/gtkoptionmenu.c index 3af74664ad..6e8f10e856 100644 --- a/gtk/gtkoptionmenu.c +++ b/gtk/gtkoptionmenu.c @@ -80,6 +80,8 @@ static void gtk_option_menu_position (GtkMenu *menu, static void gtk_option_menu_show_all (GtkWidget *widget); static void gtk_option_menu_hide_all (GtkWidget *widget); static GtkType gtk_option_menu_child_type (GtkContainer *container); +static gint gtk_option_menu_scroll_event (GtkWidget *widget, + GdkEventScroll *event); enum { @@ -147,6 +149,7 @@ gtk_option_menu_class_init (GtkOptionMenuClass *class) widget_class->expose_event = gtk_option_menu_expose; widget_class->button_press_event = gtk_option_menu_button_press; widget_class->key_press_event = gtk_option_menu_key_press; + widget_class->scroll_event = gtk_option_menu_scroll_event; widget_class->show_all = gtk_option_menu_show_all; widget_class->hide_all = gtk_option_menu_hide_all; @@ -883,3 +886,49 @@ gtk_option_menu_hide_all (GtkWidget *widget) gtk_container_foreach (container, (GtkCallback) gtk_widget_hide_all, NULL); } +static gint +gtk_option_menu_scroll_event (GtkWidget *widget, + GdkEventScroll *event) +{ + GtkOptionMenu *option_menu = GTK_OPTION_MENU (widget); + gint index; + gint n_children; + gint index_dir; + GList *l; + GtkMenuItem *item; + + index = gtk_option_menu_get_history (option_menu); + + if (index != -1) + { + n_children = g_list_length (GTK_MENU_SHELL (option_menu->menu)->children); + + if (event->direction == GDK_SCROLL_UP) + index_dir = -1; + else + index_dir = 1; + + + while (TRUE) + { + index += index_dir; + + if (index < 0) + break; + if (index >= n_children) + break; + + l = g_list_nth (GTK_MENU_SHELL (option_menu->menu)->children, index); + item = GTK_MENU_ITEM (l->data); + if (GTK_WIDGET_VISIBLE (item) && GTK_WIDGET_IS_SENSITIVE (item)) + { + gtk_option_menu_set_history (option_menu, index); + break; + } + + } + } + + return TRUE; +} + |