// "scroll_event" (mouse wheel event)
//-----------------------------------------------------------------------------
+static gboolean
+window_scroll_event_hscrollbar(GtkWidget*, GdkEventScroll* gdk_event, wxWindow* win)
+{
+ if (gdk_event->direction != GDK_SCROLL_LEFT &&
+ gdk_event->direction != GDK_SCROLL_RIGHT)
+ {
+ return false;
+ }
+
+ wxMouseEvent event(wxEVT_MOUSEWHEEL);
+ InitMouseEvent(win, event, gdk_event);
+
+ GtkRange *range = win->m_scrollBar[wxWindow::ScrollDir_Horz];
+ if (!range) return FALSE;
+
+ if (range && GTK_WIDGET_VISIBLE (range))
+ {
+ GtkAdjustment *adj = range->adjustment;
+ gdouble delta = adj->step_increment * 3;
+ if (gdk_event->direction == GDK_SCROLL_LEFT)
+ delta = -delta;
+
+ gdouble new_value = CLAMP (adj->value + delta, adj->lower, adj->upper - adj->page_size);
+
+ gtk_adjustment_set_value (adj, new_value);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static gboolean
window_scroll_event(GtkWidget*, GdkEventScroll* gdk_event, wxWindow* win)
{
else
event.m_wheelRotation = -120;
- return win->GTKProcessEvent(event);
+ if (win->GTKProcessEvent(event))
+ return TRUE;
+
+ GtkRange *range = win->m_scrollBar[wxWindow::ScrollDir_Vert];
+ if (!range) return FALSE;
+
+ if (range && GTK_WIDGET_VISIBLE (range))
+ {
+ GtkAdjustment *adj = range->adjustment;
+ gdouble delta = adj->step_increment * 3;
+ if (gdk_event->direction == GDK_SCROLL_UP)
+ delta = -delta;
+
+ gdouble new_value = CLAMP (adj->value + delta, adj->lower, adj->upper - adj->page_size);
+
+ gtk_adjustment_set_value (adj, new_value);
+
+ return TRUE;
+ }
+
+ return FALSE;
}
//-----------------------------------------------------------------------------
// find the scrollbar which generated the event
wxWindowGTK::ScrollDir dir = win->ScrollDirFromRange(range);
-
+
// generate the corresponding wx event
const int orient = wxWindow::OrientFromScrollDir(dir);
wxScrollWinEvent event(eventType, win->GetScrollPos(orient), orient);
G_CALLBACK (gtk_window_button_release_callback), this);
g_signal_connect (widget, "motion_notify_event",
G_CALLBACK (gtk_window_motion_notify_callback), this);
+
g_signal_connect (widget, "scroll_event",
G_CALLBACK (window_scroll_event), this);
+ if (m_scrollBar[ScrollDir_Horz])
+ g_signal_connect (m_scrollBar[ScrollDir_Horz], "scroll_event",
+ G_CALLBACK (window_scroll_event_hscrollbar), this);
+ if (m_scrollBar[ScrollDir_Vert])
+ g_signal_connect (m_scrollBar[ScrollDir_Vert], "scroll_event",
+ G_CALLBACK (window_scroll_event), this);
+
g_signal_connect (widget, "popup_menu",
G_CALLBACK (wxgtk_window_popup_menu_callback), this);
g_signal_connect (widget, "enter_notify_event",
GtkAdjustment * const adj = sb->adjustment;
adj->step_increment = 1;
- adj->page_increment =
+ adj->page_increment =
adj->page_size = thumbVisible;
adj->value = pos;
// No scrolling requested.
if ((dx == 0) && (dy == 0)) return;
-
+
m_clipPaintRegion = true;
WX_PIZZA(m_wxwindow)->scroll(dx, dy);