X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/703ee9f5eccb0a002c02b60d87f239a2b6529e1e..30050c958fd7f1a85db21a8b351ad54be764fdc1:/samples/propgrid/sampleprops.cpp diff --git a/samples/propgrid/sampleprops.cpp b/samples/propgrid/sampleprops.cpp index 142771bd11..e7c29c9d19 100644 --- a/samples/propgrid/sampleprops.cpp +++ b/samples/propgrid/sampleprops.cpp @@ -68,8 +68,8 @@ wxFontDataProperty::wxFontDataProperty( const wxString& label, const wxString& n m_value_wxFontData << value; // Add extra children. - AddChild( new wxColourProperty(_("Colour"), wxPG_LABEL, - fontData.GetColour() ) ); + AddPrivateChild( new wxColourProperty(_("Colour"), wxPG_LABEL, + fontData.GetColour() ) ); } wxFontDataProperty::~wxFontDataProperty () { } @@ -197,8 +197,8 @@ wxSizeProperty::wxSizeProperty( const wxString& label, const wxString& name, const wxSize& value) : wxPGProperty(label,name) { SetValueI(value); - AddChild( new wxIntProperty(wxT("Width"),wxPG_LABEL,value.x) ); - AddChild( new wxIntProperty(wxT("Height"),wxPG_LABEL,value.y) ); + AddPrivateChild( new wxIntProperty(wxT("Width"),wxPG_LABEL,value.x) ); + AddPrivateChild( new wxIntProperty(wxT("Height"),wxPG_LABEL,value.y) ); } wxSizeProperty::~wxSizeProperty() { } @@ -233,8 +233,8 @@ wxPointProperty::wxPointProperty( const wxString& label, const wxString& name, const wxPoint& value) : wxPGProperty(label,name) { SetValueI(value); - AddChild( new wxIntProperty(wxT("X"),wxPG_LABEL,value.x) ); - AddChild( new wxIntProperty(wxT("Y"),wxPG_LABEL,value.y) ); + AddPrivateChild( new wxIntProperty(wxT("X"),wxPG_LABEL,value.x) ); + AddPrivateChild( new wxIntProperty(wxT("Y"),wxPG_LABEL,value.y) ); } wxPointProperty::~wxPointProperty() { } @@ -509,16 +509,29 @@ wxArrayDoubleProperty::~wxArrayDoubleProperty () { } void wxArrayDoubleProperty::OnSetValue() { + // Generate cached display string, to optimize grid drawing GenerateValueAsString( m_display, m_precision, true ); } -wxString wxArrayDoubleProperty::GetValueAsString( int arg_flags ) const +wxString wxArrayDoubleProperty::ValueToString( wxVariant& value, + int argFlags ) const { - if ( !(arg_flags & wxPG_FULL_VALUE )) - return m_display; - wxString s; - GenerateValueAsString(s,-1,false); + + if ( argFlags & wxPG_FULL_VALUE ) + { + GenerateValueAsString(s,-1,false); + } + else + { + // + // Display cached string only if value truly matches m_value + if ( value.GetData() == m_value.GetData() ) + return m_display; + else + GenerateValueAsString( s, m_precision, true ); + } + return s; }