X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9b5bafcf38a1c6b1ad9f8974e4745c73a559a26e..bce49490f66910767d8a3dd7ea5ebafc5f40005b:/src/propgrid/advprops.cpp diff --git a/src/propgrid/advprops.cpp b/src/propgrid/advprops.cpp index f50ce38f49..7a58087922 100644 --- a/src/propgrid/advprops.cpp +++ b/src/propgrid/advprops.cpp @@ -477,6 +477,8 @@ wxFontProperty::wxFontProperty( const wxString& label, const wxString& name, wxFont font; font << m_value; + SetParentalType(wxPG_PROP_AGGREGATE); + AddChild( new wxIntProperty( _("Point Size"), wxS("Point Size"),(long)font.GetPointSize() ) ); AddChild( new wxEnumProperty(_("Family"), wxS("PointSize"), @@ -520,9 +522,10 @@ void wxFontProperty::OnSetValue() } } -wxString wxFontProperty::GetValueAsString( int argFlags ) const +wxString wxFontProperty::ValueToString( wxVariant& value, + int argFlags ) const { - return wxPGProperty::GetValueAsString(argFlags); + return wxPGProperty::ValueToString(value, argFlags); } bool wxFontProperty::OnEvent( wxPropertyGrid* propgrid, wxWindow* WXUNUSED(primary), @@ -531,7 +534,7 @@ bool wxFontProperty::OnEvent( wxPropertyGrid* propgrid, wxWindow* WXUNUSED(prima if ( propgrid->IsMainButtonEvent(event) ) { // Update value from last minute changes - wxVariant useValue = propgrid->GetPendingEditedValue(); + wxVariant useValue = propgrid->GetUncommittedPropertyValue(); wxFontData data; wxFont font; @@ -997,24 +1000,12 @@ wxString wxSystemColourProperty::ColourToString( const wxColour& col, int index return m_choices.GetLabel(index); } -wxString wxSystemColourProperty::GetValueAsString( int argFlags ) const +wxString wxSystemColourProperty::ValueToString( wxVariant& value, + int WXUNUSED(argFlags) ) const { - wxColourPropertyValue val = GetVal(); - - int ind = GetIndex(); + wxColourPropertyValue val = GetVal(&value); - // Always show custom colour for textctrl-editor - if ( val.m_type == wxPG_COLOUR_CUSTOM || - ind == GetCustomColourIndex() || - (argFlags & wxPG_PROPERTY_SPECIFIC) ) - { - return ColourToString(val.m_colour, wxNOT_FOUND); - } - - if ( ind == -1 ) - return wxEmptyString; - - return ColourToString(val.m_colour, ind); + return ColourToString(val.m_colour, m_choices.Index(val.m_type)); } @@ -1390,7 +1381,8 @@ void wxColourProperty::Init( wxColour colour ) SetIndex( ind ); } -wxString wxColourProperty::GetValueAsString( int argFlags ) const +wxString wxColourProperty::ValueToString( wxVariant& value, + int argFlags ) const { const wxPGEditor* editor = GetEditorClass(); if ( editor != wxPGEditor_Choice && @@ -1398,7 +1390,7 @@ wxString wxColourProperty::GetValueAsString( int argFlags ) const editor != wxPGEditor_ComboBox ) argFlags |= wxPG_PROPERTY_SPECIFIC; - return wxSystemColourProperty::GetValueAsString(argFlags); + return wxSystemColourProperty::ValueToString(value, argFlags); } wxColour wxColourProperty::GetColour( int index ) const @@ -1649,10 +1641,12 @@ void wxImageFileProperty::OnSetValue() m_pBitmap = NULL; } + wxFileName filename = GetFileName(); + // Create the image thumbnail - if ( m_filename.FileExists() ) + if ( filename.FileExists() ) { - m_pImage = new wxImage( m_filename.GetFullPath() ); + m_pImage = new wxImage( filename.GetFullPath() ); } } @@ -1737,22 +1731,30 @@ wxMultiChoiceProperty::~wxMultiChoiceProperty() void wxMultiChoiceProperty::OnSetValue() { - GenerateValueAsString(); + GenerateValueAsString(m_value, &m_display); } -wxString wxMultiChoiceProperty::GetValueAsString( int ) const +wxString wxMultiChoiceProperty::ValueToString( wxVariant& value, + int argFlags ) const { - return m_display; + // If possible, use cached string + if ( argFlags & wxPG_VALUE_IS_CURRENT ) + return m_display; + + wxString s; + GenerateValueAsString(value, &s); + return s; } -void wxMultiChoiceProperty::GenerateValueAsString() +void wxMultiChoiceProperty::GenerateValueAsString( wxVariant& value, + wxString* target ) const { wxArrayString strings; - if ( m_value.GetType() == wxPG_VARIANT_TYPE_ARRSTRING ) - strings = m_value.GetArrayString(); + if ( value.GetType() == wxPG_VARIANT_TYPE_ARRSTRING ) + strings = value.GetArrayString(); - wxString& tempStr = m_display; + wxString& tempStr = *target; unsigned int i; unsigned int itemCount = strings.size(); @@ -1803,7 +1805,7 @@ bool wxMultiChoiceProperty::OnEvent( wxPropertyGrid* propgrid, if ( propgrid->IsMainButtonEvent(event) ) { // Update the value - wxVariant useValue = propgrid->GetPendingEditedValue(); + wxVariant useValue = propgrid->GetUncommittedPropertyValue(); wxArrayString labels = m_choices.GetLabels(); unsigned int choiceCount; @@ -1949,11 +1951,12 @@ bool wxDateProperty::StringToValue( wxVariant& variant, const wxString& text, return false; } -wxString wxDateProperty::GetValueAsString( int argFlags ) const +wxString wxDateProperty::ValueToString( wxVariant& value, + int argFlags ) const { const wxChar* format = (const wxChar*) NULL; - wxDateTime dateTime = m_value.GetDateTime(); + wxDateTime dateTime = value.GetDateTime(); if ( !dateTime.IsValid() ) return wxT("Invalid");