-wxSlider::wxSlider( wxWindow *parent, wxWindowID id,
- int value, int minValue, int maxValue,
- const wxPoint& pos, const wxSize& size,
- long style,
-/* const wxValidator& validator = wxDefaultValidator, */
- const wxString& name )
+// process a scroll event
+static void
+ProcessScrollEvent(wxSlider *win, wxEventType evtType, double dvalue)
+{
+ int orient = win->GetWindowStyleFlag() & wxSL_VERTICAL ? wxVERTICAL
+ : wxHORIZONTAL;
+
+ int value = (int)(dvalue < 0 ? dvalue - 0.5 : dvalue + 0.5);
+ wxScrollEvent event( evtType, win->GetId(), value, orient );
+ event.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent( event );
+
+ if ( evtType != wxEVT_SCROLL_THUMBTRACK )
+ {
+ wxScrollEvent event2(wxEVT_SCROLL_CHANGED, win->GetId(), value, orient);
+ event2.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent( event2 );
+ }
+
+ wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, win->GetId() );
+ cevent.SetEventObject( win );
+ cevent.SetInt( value );
+ win->GetEventHandler()->ProcessEvent( cevent );
+}
+
+//-----------------------------------------------------------------------------
+// "value_changed"
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static void gtk_slider_callback( GtkAdjustment *adjust,
+ SCROLLBAR_CBACK_ARG
+ wxSlider *win )
+{
+ if (g_isIdle) wxapp_install_idle_handler();
+
+ if (!win->m_hasVMT) return;
+ if (g_blockEventsOnDrag) return;
+
+ const double dvalue = adjust->value;
+ const double diff = dvalue - win->m_oldPos;
+ if ( AreSameAdjustValues(diff, 0) )
+ return;
+
+ wxEventType evtType;
+ evtType = GtkScrollTypeToWx(GET_SCROLL_TYPE(win->m_widget));
+
+ ProcessScrollEvent(win, evtType, dvalue);
+
+ win->m_oldPos = dvalue;
+}
+
+static gint gtk_slider_button_press_callback( GtkWidget * /* widget */,
+ GdkEventButton * /* gdk_event */,
+ wxWindowGTK *win)