Used specialized template functions to assign wxColour and wxFont to wxVariant

This commit is contained in:
Artur Wieczorek 2019-07-07 23:14:36 +02:00
parent 0b27a66700
commit 21f9329836
2 changed files with 6 additions and 10 deletions

View File

@ -155,7 +155,7 @@ void wxFontDataProperty::RefreshChildren()
if ( GetChildCount() < 6 ) // Number is count of wxFontProperty's children + 1. if ( GetChildCount() < 6 ) // Number is count of wxFontProperty's children + 1.
return; return;
wxFontData fontData; fontData << m_value_wxFontData; wxFontData fontData; fontData << m_value_wxFontData;
wxVariant variant; variant << fontData.GetColour(); wxVariant variant = WXVARIANT(fontData.GetColour());
Item(6)->SetValue( variant ); Item(6)->SetValue( variant );
} }

View File

@ -645,7 +645,7 @@ void wxFontProperty::OnSetValue()
if ( !font.IsOk() ) if ( !font.IsOk() )
{ {
m_value << *wxNORMAL_FONT; m_value = WXVARIANT(*wxNORMAL_FONT);
} }
} }
@ -744,8 +744,7 @@ wxVariant wxFontProperty::ChildChanged( wxVariant& thisValue,
font.SetFamily( static_cast<wxFontFamily>(fam) ); font.SetFamily( static_cast<wxFontFamily>(fam) );
} }
wxVariant newVariant; wxVariant newVariant = WXVARIANT(font);
newVariant << font;
return newVariant; return newVariant;
} }
@ -1022,7 +1021,7 @@ void wxSystemColourProperty::OnSetValue()
if ( m_value.IsType(wxS("wxColour*")) ) if ( m_value.IsType(wxS("wxColour*")) )
{ {
wxColour* pCol = wxStaticCast(m_value.GetWxObjectPtr(), wxColour); wxColour* pCol = wxStaticCast(m_value.GetWxObjectPtr(), wxColour);
m_value << *pCol; m_value = WXVARIANT(*pCol);
} }
wxColourPropertyValue val = GetVal(&m_value); wxColourPropertyValue val = GetVal(&m_value);
@ -1638,9 +1637,7 @@ void wxColourProperty::Init( wxColour colour )
{ {
if ( !colour.IsOk() ) if ( !colour.IsOk() )
colour = *wxWHITE; colour = *wxWHITE;
wxVariant variant; m_value = WXVARIANT(colour);
variant << colour;
m_value = variant;
int ind = ColToInd(colour); int ind = ColToInd(colour);
if ( ind < 0 ) if ( ind < 0 )
ind = m_choices.GetCount() - 1; ind = m_choices.GetCount() - 1;
@ -1666,8 +1663,7 @@ wxColour wxColourProperty::GetColour( int index ) const
wxVariant wxColourProperty::DoTranslateVal( wxColourPropertyValue& v ) const wxVariant wxColourProperty::DoTranslateVal( wxColourPropertyValue& v ) const
{ {
wxVariant variant; wxVariant variant = WXVARIANT(v.m_colour);
variant << v.m_colour;
return variant; return variant;
} }