+void wxSlider::Command(wxCommandEvent &event)
+{
+ SetValue(event.GetInt());
+ ProcessCommand(event);
+}
+
+void wxSlider::MacHandleControlClick( WXWidget control, wxInt16 controlpart, bool mouseStillDown )
+{
+ // Whatever the native value is, we may need to invert it for calling
+ // SetValue and putting the possibly inverted value in the event
+ int value = ValueInvertOrNot( m_peer->GetValue() );
+
+ SetValue( value );
+
+ wxScrollEvent event( wxEVT_SCROLL_THUMBTRACK, m_windowId );
+ event.SetPosition( value );
+ event.SetEventObject( this );
+ GetEventHandler()->ProcessEvent( event );
+
+ wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, m_windowId );
+ cevent.SetInt( value );
+ cevent.SetEventObject( this );
+ GetEventHandler()->ProcessEvent( cevent );
+}
+
+wxInt32 wxSlider::MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF mevent )
+{
+ // Whatever the native value is, we may need to invert it for calling
+ // SetValue and putting the possibly inverted value in the event
+ int value = ValueInvertOrNot( m_peer->GetValue() ) ;
+
+ SetValue( value ) ;
+
+ wxScrollEvent event( wxEVT_SCROLL_THUMBRELEASE, m_windowId );
+ event.SetPosition( value );
+ event.SetEventObject( this );
+ GetEventHandler()->ProcessEvent( event );
+
+ wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, m_windowId );
+ cevent.SetInt( value );
+ cevent.SetEventObject( this );
+
+ GetEventHandler()->ProcessEvent( cevent );
+
+ return noErr;
+}
+
+// This is overloaded in wxSlider so that the proper width/height will always be used
+// for the slider different values would cause redrawing and mouse detection problems
+//
+void wxSlider::DoSetSizeHints( int minW, int minH,
+ int maxW, int maxH,
+ int incW, int incH )
+{
+ wxSize size = GetBestSize();
+
+ if (GetWindowStyle() & wxSL_VERTICAL)
+ wxWindow::DoSetSizeHints(size.x, minH, size.x, maxH, incW, incH);
+ else
+ wxWindow::DoSetSizeHints(minW, size.y, maxW, size.y, incW, incH);
+}
+
+wxSize wxSlider::DoGetBestSize() const
+{
+ wxSize size;
+ int textwidth, textheight;
+ int mintwidth, mintheight;
+ int maxtwidth, maxtheight;
+
+ textwidth = textheight = 0;
+ mintwidth = mintheight = 0;
+ maxtwidth = maxtheight = 0;
+
+ if (GetWindowStyle() & wxSL_LABELS)
+ {
+ wxString text;
+
+ // Get maximum text label width and height
+ text.Printf( wxT("%d"), ValueInvertOrNot( m_rangeMin ) );
+ GetTextExtent(text, &mintwidth, &mintheight);
+ text.Printf( wxT("%d"), ValueInvertOrNot( m_rangeMax ) );
+ GetTextExtent(text, &maxtwidth, &maxtheight);
+
+ if (maxtheight > mintheight)
+ textheight = maxtheight;
+ else
+ textheight = mintheight;
+
+ if (maxtwidth > mintwidth)
+ textwidth = maxtwidth;
+ else
+ textwidth = mintwidth;
+ }
+
+ if (GetWindowStyle() & wxSL_VERTICAL)
+ {
+ size.y = 150;
+
+ if (GetWindowStyle() & wxSL_AUTOTICKS)
+ size.x = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
+ else
+ size.x = wxSLIDER_DIMENSIONACROSS_ARROW;
+
+ if (GetWindowStyle() & wxSL_LABELS)
+ size.x += textwidth + wxSLIDER_BORDERTEXT;
+ }
+ else
+ {
+ size.x = 150;
+
+ if (GetWindowStyle() & wxSL_AUTOTICKS)
+ size.y = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
+ else
+ size.y = wxSLIDER_DIMENSIONACROSS_ARROW;
+
+ if (GetWindowStyle() & wxSL_LABELS)
+ {
+ size.y += textheight + wxSLIDER_BORDERTEXT;
+ size.x += (mintwidth / 2) + (maxtwidth / 2);
+ }
+ }
+
+ return size;
+}
+
+void wxSlider::DoSetSize(int x, int y, int w, int h, int sizeFlags)