- wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, win->GetId() );
- cevent.SetEventObject( win );
- cevent.SetInt( value );
- win->GetEventHandler()->ProcessEvent( cevent );
+ wxEventType eventType = wxEVT_NULL;
+ if (win->m_isScrolling)
+ {
+ eventType = wxEVT_SCROLL_THUMBTRACK;
+ }
+ else if (win->m_scrollEventType != GTK_SCROLL_NONE)
+ {
+ // Scroll event from "move-slider" (keyboard)
+ eventType = GtkScrollTypeToWx(win->m_scrollEventType);
+ }
+ else if (win->m_mouseButtonDown)
+ {
+ // Difference from last change event
+ const double diff = value - oldPos;
+ const bool isDown = diff > 0;
+
+ GtkAdjustment* adj = gtk_range_get_adjustment(range);
+ if (IsScrollIncrement(gtk_adjustment_get_page_increment(adj), diff))
+ {
+ eventType = isDown ? wxEVT_SCROLL_PAGEDOWN : wxEVT_SCROLL_PAGEUP;
+ }
+ else if (wxIsSameDouble(value, 0))
+ {
+ eventType = wxEVT_SCROLL_PAGEUP;
+ }
+ else if (wxIsSameDouble(value, gtk_adjustment_get_upper(adj)))
+ {
+ eventType = wxEVT_SCROLL_PAGEDOWN;
+ }
+ else
+ {
+ // Assume track event
+ eventType = wxEVT_SCROLL_THUMBTRACK;
+ // Remember that we're tracking
+ win->m_isScrolling = true;
+ }
+ }
+
+ win->m_scrollEventType = GTK_SCROLL_NONE;
+
+ // If integral position has changed
+ if (wxRound(oldPos) != wxRound(value))
+ {
+ ProcessScrollEvent(win, eventType);
+ win->m_needThumbRelease = eventType == wxEVT_SCROLL_THUMBTRACK;
+ }
+}