X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e40298d54ecd5b109222a7c60aa2ef084a304d69..3ef37e7f4ec5f0688a4fb47e530ca2d30a6bb3ed:/src/mac/carbon/slider.cpp diff --git a/src/mac/carbon/slider.cpp b/src/mac/carbon/slider.cpp index 2a95191da2..4bd4bab532 100644 --- a/src/mac/carbon/slider.cpp +++ b/src/mac/carbon/slider.cpp @@ -57,6 +57,9 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { + if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) + return false; + Rect bounds ; Str255 title ; SInt16 procID; @@ -74,7 +77,7 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id, m_pageSize = (int)((maxValue-minValue)/10); - MacPreControlCreate( parent, id, "", pos, size, style, + MacPreControlCreate( parent, id, wxEmptyString, pos, size, style, validator, name, &bounds, title ); procID = kControlSliderProc + kControlSliderLiveFeedback; @@ -86,15 +89,15 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id, m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()), &bounds, title, false, value, minValue, maxValue, procID, (long) this); - wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ; + wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ; ::SetControlAction( (ControlHandle) m_macControl , wxMacLiveScrollbarActionUPP ) ; if(style & wxSL_LABELS) { - m_macMinimumStatic = new wxStaticText( this, -1, "" ); - m_macMaximumStatic = new wxStaticText( this, -1, "" ); - m_macValueStatic = new wxStaticText( this, -1, "" ); + m_macMinimumStatic = new wxStaticText( this, -1, wxEmptyString ); + m_macMaximumStatic = new wxStaticText( this, -1, wxEmptyString ); + m_macValueStatic = new wxStaticText( this, -1, wxEmptyString ); SetRange(minValue, maxValue); SetValue(value); } @@ -132,7 +135,7 @@ int wxSlider::GetValue() const void wxSlider::SetValue(int value) { wxString valuestring ; - valuestring.Printf( "%d" , value ) ; + valuestring.Printf( wxT("%d") , value ) ; if ( m_macValueStatic ) m_macValueStatic->SetLabel( valuestring ) ; SetControl32BitValue( (ControlHandle) m_macControl , value ) ; @@ -149,11 +152,11 @@ void wxSlider::SetRange(int minValue, int maxValue) SetControl32BitMaximum( (ControlHandle) m_macControl, m_rangeMax); if(m_macMinimumStatic) { - value.Printf("%d", m_rangeMin); + value.Printf(wxT("%d"), m_rangeMin); m_macMinimumStatic->SetLabel(value); } if(m_macMaximumStatic) { - value.Printf("%d", m_rangeMax); + value.Printf(wxT("%d"), m_rangeMax); m_macMaximumStatic->SetLabel(value); } SetValue(m_rangeMin); @@ -238,13 +241,20 @@ void wxSlider::Command (wxCommandEvent & event) ProcessCommand (event); } -void wxSlider::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) +void wxSlider::MacHandleControlClick( WXWidget control , wxInt16 controlpart, bool mouseStillDown ) { SInt16 value = ::GetControl32BitValue( (ControlHandle) m_macControl ) ; SetValue( value ) ; - wxScrollEvent event(wxEVT_SCROLL_THUMBTRACK, m_windowId); + wxEventType scrollEvent = wxEVT_NULL ; + + if ( mouseStillDown ) + scrollEvent = wxEVT_SCROLL_THUMBTRACK; + else + scrollEvent = wxEVT_SCROLL_THUMBRELEASE; + + wxScrollEvent event(scrollEvent, m_windowId); event.SetPosition(value); event.SetEventObject( this ); GetEventHandler()->ProcessEvent(event); @@ -283,9 +293,9 @@ wxSize wxSlider::DoGetBestSize() const int ht, wd; // Get maximum text label width and height - text.Printf("%d", m_rangeMin); + text.Printf(wxT("%d"), m_rangeMin); GetTextExtent(text, &textwidth, &textheight); - text.Printf("%d", m_rangeMax); + text.Printf(wxT("%d"), m_rangeMax); GetTextExtent(text, &wd, &ht); if(ht > textheight) { textheight = ht; @@ -356,9 +366,9 @@ void wxSlider::MacUpdateDimensions() int ht; // Get maximum text label width and height - text.Printf("%d", m_rangeMin); + text.Printf(wxT("%d"), m_rangeMin); GetTextExtent(text, &minValWidth, &textheight); - text.Printf("%d", m_rangeMax); + text.Printf(wxT("%d"), m_rangeMax); GetTextExtent(text, &maxValWidth, &ht); if(ht > textheight) { textheight = ht;