diff --git a/ChangeLog b/ChangeLog index e46c27ac34..e933565a53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Mon Nov 17 23:23:49 2003 Matthias Clasen + + * gtk/gtkcombobox.c: Add mouse wheel support. (#126517) + Mon Nov 17 22:56:09 2003 Kristian Rietveld * gtk/gtkentryprivate.h: add _gtk_entry_completion_resize_popup. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e46c27ac34..e933565a53 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,7 @@ +Mon Nov 17 23:23:49 2003 Matthias Clasen + + * gtk/gtkcombobox.c: Add mouse wheel support. (#126517) + Mon Nov 17 22:56:09 2003 Kristian Rietveld * gtk/gtkentryprivate.h: add _gtk_entry_completion_resize_popup. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index e46c27ac34..e933565a53 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,7 @@ +Mon Nov 17 23:23:49 2003 Matthias Clasen + + * gtk/gtkcombobox.c: Add mouse wheel support. (#126517) + Mon Nov 17 22:56:09 2003 Kristian Rietveld * gtk/gtkentryprivate.h: add _gtk_entry_completion_resize_popup. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index e46c27ac34..e933565a53 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,7 @@ +Mon Nov 17 23:23:49 2003 Matthias Clasen + + * gtk/gtkcombobox.c: Add mouse wheel support. (#126517) + Mon Nov 17 22:56:09 2003 Kristian Rietveld * gtk/gtkentryprivate.h: add _gtk_entry_completion_resize_popup. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index e46c27ac34..e933565a53 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,7 @@ +Mon Nov 17 23:23:49 2003 Matthias Clasen + + * gtk/gtkcombobox.c: Add mouse wheel support. (#126517) + Mon Nov 17 22:56:09 2003 Kristian Rietveld * gtk/gtkentryprivate.h: add _gtk_entry_completion_resize_popup. diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 6f9099de61..1e9d37145b 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -182,6 +182,8 @@ static void gtk_combo_box_forall (GtkContainer *container, gpointer callback_data); static gboolean gtk_combo_box_expose_event (GtkWidget *widget, GdkEventExpose *event); +static gboolean gtk_combo_box_scroll_event (GtkWidget *widget, + GdkEventScroll *event); /* list */ static void gtk_combo_box_list_setup (GtkComboBox *combo_box); @@ -313,6 +315,7 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) widget_class->size_allocate = gtk_combo_box_size_allocate; widget_class->size_request = gtk_combo_box_size_request; widget_class->expose_event = gtk_combo_box_expose_event; + widget_class->scroll_event = gtk_combo_box_scroll_event; object_class = (GObjectClass *)klass; object_class->set_property = gtk_combo_box_set_property; @@ -2686,3 +2689,29 @@ gtk_combo_box_prepend_text (GtkComboBox *combo_box, gtk_list_store_prepend (store, &iter); gtk_list_store_set (store, &iter, 0, text, -1); } + +static gboolean +gtk_combo_box_scroll_event (GtkWidget *widget, + GdkEventScroll *event) +{ + GtkComboBox *combo_box = GTK_COMBO_BOX (widget); + gint index; + gint items; + + index = gtk_combo_box_get_active (combo_box); + + if (index != -1) + { + items = gtk_tree_model_iter_n_children (combo_box->priv->model, NULL); + + if (event->direction == GDK_SCROLL_UP) + index--; + else + index++; + + gtk_combo_box_set_active (combo_box, CLAMP (index, 0, items - 1)); + } + + return TRUE; +} +