From: Jaakko Salli <jaakko.salli@dnainternet.net> Date: Sun, 11 Jan 2009 16:24:00 +0000 (+0000) Subject: Fixed bug: SetPropertyValueUnspecified(p) and p->SetValue(wxNullVariant) were out... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/daeb4e4d4c10132ddc84bb5417a4c4618026979a Fixed bug: SetPropertyValueUnspecified(p) and p->SetValue(wxNullVariant) were out of sync git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58026 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/propgrid/propgrid.h b/include/wx/propgrid/propgrid.h index 2146da9de1..9341c69db7 100644 --- a/include/wx/propgrid/propgrid.h +++ b/include/wx/propgrid/propgrid.h @@ -1748,8 +1748,6 @@ protected: const wxRect* clip_rect, bool isBuffered ) const; - void DoSetPropertyValueUnspecified( wxPGProperty* p ); - /** Draws an expand/collapse (ie. +/-) button. */ virtual void DrawExpanderButton( wxDC& dc, const wxRect& rect, diff --git a/include/wx/propgrid/propgridiface.h b/include/wx/propgrid/propgridiface.h index fb8158ed0d..dda25e1faf 100644 --- a/include/wx/propgrid/propgridiface.h +++ b/include/wx/propgrid/propgridiface.h @@ -1030,7 +1030,12 @@ public: If it has children (it may be category), then the same thing is done to them. */ - void SetPropertyValueUnspecified( wxPGPropArg id ); + void SetPropertyValueUnspecified( wxPGPropArg id ) + { + wxPG_PROP_ARG_CALL_PROLOG() + wxVariant nullVariant; + SetPropVal(p, nullVariant); + } #ifndef SWIG /** Sets various property values from a list of wxVariants. If property with diff --git a/include/wx/propgrid/propgridpagestate.h b/include/wx/propgrid/propgridpagestate.h index 658147f150..ec1c8064ef 100644 --- a/include/wx/propgrid/propgridpagestate.h +++ b/include/wx/propgrid/propgridpagestate.h @@ -606,8 +606,6 @@ public: void DoSetPropertyValues( const wxVariantList& list, wxPGProperty* default_category ); - void DoSetPropertyValueUnspecified( wxPGProperty* p ); - void SetSplitterLeft( bool subProps = false ); /** Set virtual width for this particular page. */ diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp index 1663eda6f9..aea73df3b9 100644 --- a/src/propgrid/property.cpp +++ b/src/propgrid/property.cpp @@ -1285,9 +1285,6 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags ) { m_value = value; OnSetValue(); - - if ( !(flags & wxPG_SETVAL_FROM_PARENT) ) - UpdateParentValues(); } if ( flags & wxPG_SETVAL_BY_USER ) @@ -1317,6 +1314,9 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags ) } } + if ( !(flags & wxPG_SETVAL_FROM_PARENT) ) + UpdateParentValues(); + // // Update editor control // diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 2d91cae007..b68131499e 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -1185,24 +1185,6 @@ void wxPropertyGrid::PrepareAfterItemsAdded() RecalculateVirtualSize(); } -// ----------------------------------------------------------------------- -// wxPropertyGrid property value setting and getting -// ----------------------------------------------------------------------- - -void wxPropertyGrid::DoSetPropertyValueUnspecified( wxPGProperty* p ) -{ - m_pState->DoSetPropertyValueUnspecified(p); - DrawItemAndChildren(p); - - wxPGProperty* parent = p->GetParent(); - while ( parent && - (parent->GetFlags() & wxPG_PROP_PARENTAL_FLAGS) == wxPG_PROP_MISC_PARENT ) - { - DrawItem(parent); - parent = parent->GetParent(); - } -} - // ----------------------------------------------------------------------- // wxPropertyGrid property operations // ----------------------------------------------------------------------- @@ -3635,7 +3617,12 @@ void wxPropertyGrid::RefreshEditor() wnd->SetFont(GetFont()); } - p->GetEditorClass()->UpdateControl(p, wnd); + const wxPGEditor* editorClass = p->GetEditorClass(); + + editorClass->UpdateControl(p, wnd); + + if ( p->IsValueUnspecified() ) + editorClass ->SetValueToUnspecified(p, wnd); } // ----------------------------------------------------------------------- diff --git a/src/propgrid/propgridiface.cpp b/src/propgrid/propgridiface.cpp index afa04000c8..8f0bab8b5a 100644 --- a/src/propgrid/propgridiface.cpp +++ b/src/propgrid/propgridiface.cpp @@ -498,18 +498,6 @@ bool wxPropertyGridInterface::ExpandAll( bool doExpand ) // ----------------------------------------------------------------------- -void wxPropertyGridInterface::SetPropertyValueUnspecified( wxPGPropArg id ) -{ - wxPG_PROP_ARG_CALL_PROLOG() - wxPropertyGrid* propGrid = p->GetGridIfDisplayed(); - if ( propGrid ) - propGrid->DoSetPropertyValueUnspecified(p); - else - p->GetParentState()->DoSetPropertyValueUnspecified(p); -} - -// ----------------------------------------------------------------------- - void wxPropertyGridInterface::ClearModifiedStatus() { unsigned int pageIndex = 0; diff --git a/src/propgrid/propgridpagestate.cpp b/src/propgrid/propgridpagestate.cpp index 0803b12037..9caa7f35cc 100644 --- a/src/propgrid/propgridpagestate.cpp +++ b/src/propgrid/propgridpagestate.cpp @@ -1208,33 +1208,6 @@ bool wxPropertyGridPageState::DoSetPropertyValueWxObjectPtr( wxPGProperty* p, wx return false; } -// ----------------------------------------------------------------------- - -void wxPropertyGridPageState::DoSetPropertyValueUnspecified( wxPGProperty* p ) -{ - wxCHECK_RET( p, wxT("invalid property id") ); - - if ( !p->IsValueUnspecified() ) - { - // Value should be set first - editor class methods may need it - p->m_value.MakeNull(); - - wxASSERT( m_pPropGrid ); - - if ( m_pPropGrid->GetState() == this ) - { - if ( m_pPropGrid->m_selected == p && m_pPropGrid->m_wndEditor ) - { - p->GetEditorClass()->SetValueToUnspecified(p, m_pPropGrid->GetEditorControl()); - } - } - - unsigned int i; - for ( i = 0; i < p->GetChildCount(); i++ ) - DoSetPropertyValueUnspecified( p->Item(i) ); - } -} - // ----------------------------------------------------------------------- // wxPropertyGridPageState property operations // -----------------------------------------------------------------------