added runtime protection for no SL_LABEL style case
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36619 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -44,6 +44,10 @@ END_EVENT_TABLE()
|
|||||||
m_rangeMax = 0;
|
m_rangeMax = 0;
|
||||||
m_rangeMin = 0;
|
m_rangeMin = 0;
|
||||||
m_tickFreq = 0;
|
m_tickFreq = 0;
|
||||||
|
|
||||||
|
m_macMinimumStatic = NULL ;
|
||||||
|
m_macMaximumStatic = NULL ;
|
||||||
|
m_macValueStatic = NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSlider::Create(wxWindow *parent, wxWindowID id,
|
bool wxSlider::Create(wxWindow *parent, wxWindowID id,
|
||||||
@@ -55,6 +59,18 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
|
|||||||
{
|
{
|
||||||
m_macIsUserPane = false ;
|
m_macIsUserPane = false ;
|
||||||
|
|
||||||
|
m_macMinimumStatic = NULL ;
|
||||||
|
m_macMaximumStatic = NULL ;
|
||||||
|
m_macValueStatic = NULL ;
|
||||||
|
|
||||||
|
m_lineSize = 1;
|
||||||
|
m_tickFreq = 0;
|
||||||
|
|
||||||
|
m_rangeMax = maxValue;
|
||||||
|
m_rangeMin = minValue;
|
||||||
|
|
||||||
|
m_pageSize = (int)((maxValue-minValue)/10);
|
||||||
|
|
||||||
// our styles are redundant: wxSL_LEFT/RIGHT imply wxSL_VERTICAL and
|
// our styles are redundant: wxSL_LEFT/RIGHT imply wxSL_VERTICAL and
|
||||||
// wxSL_TOP/BOTTOM imply wxSL_HORIZONTAL, but for backwards compatibility
|
// wxSL_TOP/BOTTOM imply wxSL_HORIZONTAL, but for backwards compatibility
|
||||||
// reasons we can't really change it, instead try to infer the orientation
|
// reasons we can't really change it, instead try to infer the orientation
|
||||||
@@ -72,13 +88,15 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
|
default:
|
||||||
// no specific direction, do we have at least the orientation?
|
// no specific direction, do we have at least the orientation?
|
||||||
if ( !(style & (wxSL_HORIZONTAL | wxSL_VERTICAL)) )
|
if ( !(style & (wxSL_HORIZONTAL | wxSL_VERTICAL)) )
|
||||||
{
|
{
|
||||||
// no, choose default
|
// no, choose default
|
||||||
style |= wxSL_BOTTOM | wxSL_HORIZONTAL;
|
style |= wxSL_BOTTOM | wxSL_HORIZONTAL;
|
||||||
}
|
}
|
||||||
};
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
wxASSERT_MSG( !(style & wxSL_VERTICAL) || !(style & wxSL_HORIZONTAL),
|
wxASSERT_MSG( !(style & wxSL_VERTICAL) || !(style & wxSL_HORIZONTAL),
|
||||||
_T("incompatible slider direction and orientation") );
|
_T("incompatible slider direction and orientation") );
|
||||||
@@ -86,18 +104,6 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
|
|||||||
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
|
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_macMinimumStatic = NULL ;
|
|
||||||
m_macMaximumStatic = NULL ;
|
|
||||||
m_macValueStatic = NULL ;
|
|
||||||
|
|
||||||
m_lineSize = 1;
|
|
||||||
m_tickFreq = 0;
|
|
||||||
|
|
||||||
m_rangeMax = maxValue;
|
|
||||||
m_rangeMin = minValue;
|
|
||||||
|
|
||||||
m_pageSize = (int)((maxValue-minValue)/10);
|
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -131,10 +137,11 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_macMinimumStatic = new wxStaticText( parent, wxID_ANY, wxEmptyString );
|
m_macMinimumStatic = new wxStaticText( parent, wxID_ANY, wxEmptyString );
|
||||||
m_macMaximumStatic = new wxStaticText( parent, wxID_ANY, wxEmptyString );
|
m_macMaximumStatic = new wxStaticText( parent, wxID_ANY, wxEmptyString );
|
||||||
m_macValueStatic = new wxStaticText( parent, wxID_ANY, wxEmptyString );
|
m_macValueStatic = new wxStaticText( parent, wxID_ANY, wxEmptyString );
|
||||||
SetRange(minValue, maxValue);
|
|
||||||
SetValue(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetRange(minValue, maxValue);
|
||||||
|
SetValue(value);
|
||||||
|
|
||||||
MacPostControlCreate(pos,size) ;
|
MacPostControlCreate(pos,size) ;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -160,10 +167,12 @@ int wxSlider::GetValue() const
|
|||||||
|
|
||||||
void wxSlider::SetValue(int value)
|
void wxSlider::SetValue(int value)
|
||||||
{
|
{
|
||||||
wxString valuestring ;
|
|
||||||
valuestring.Printf( wxT("%d") , value ) ;
|
|
||||||
if ( m_macValueStatic )
|
if ( m_macValueStatic )
|
||||||
|
{
|
||||||
|
wxString valuestring ;
|
||||||
|
valuestring.Printf( wxT("%d") , value ) ;
|
||||||
m_macValueStatic->SetLabel( valuestring ) ;
|
m_macValueStatic->SetLabel( valuestring ) ;
|
||||||
|
}
|
||||||
|
|
||||||
// We only invert for the setting of the actual native widget
|
// We only invert for the setting of the actual native widget
|
||||||
m_peer->SetValue( ValueInvertOrNot ( value ) ) ;
|
m_peer->SetValue( ValueInvertOrNot ( value ) ) ;
|
||||||
|
Reference in New Issue
Block a user