From: Jaakko Salli Date: Sat, 24 Apr 2010 10:13:22 +0000 (+0000) Subject: Allow wxPGProperty::Hide() to be called on unattached property (see #11987) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/3ded4b22fe0fa21b6bada0beede43cb4d06b233f Allow wxPGProperty::Hide() to be called on unattached property (see #11987) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64121 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/propgrid/property.h b/include/wx/propgrid/property.h index ab4aae0f12..5e0afbf884 100644 --- a/include/wx/propgrid/property.h +++ b/include/wx/propgrid/property.h @@ -1858,7 +1858,7 @@ public: By default changes are applied recursively. Set this paramter wxPG_DONT_RECURSE to prevent this. */ - inline bool Hide( bool hide, int flags = wxPG_RECURSE ); + bool Hide( bool hide, int flags = wxPG_RECURSE ); bool IsExpanded() const { return (!(m_flags & wxPG_PROP_COLLAPSED) && GetChildCount()); } @@ -2328,6 +2328,8 @@ protected: const wxVariantList* valueOverrides = NULL, wxPGHashMapS2S* childResults = NULL ) const; + bool DoHide( bool hide, int flags ); + void DoSetName(const wxString& str) { m_name = str; } /** Deletes all sub-properties. */ diff --git a/include/wx/propgrid/propgrid.h b/include/wx/propgrid/propgrid.h index 8729f1a92a..0a950f9818 100644 --- a/include/wx/propgrid/propgrid.h +++ b/include/wx/propgrid/propgrid.h @@ -2200,11 +2200,6 @@ inline void wxPGProperty::SetEditor( const wxString& editorName ) m_customEditor = wxPropertyGridInterface::GetEditorByName(editorName); } -inline bool wxPGProperty::Hide( bool hide, int flags ) -{ - return GetGrid()->HideProperty(this, hide, flags); -} - inline bool wxPGProperty::SetMaxLength( int maxLen ) { return GetGrid()->SetPropertyMaxLength(this,maxLen); diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp index 44dd00af8f..36b9f47bd5 100644 --- a/src/propgrid/property.cpp +++ b/src/propgrid/property.cpp @@ -1962,6 +1962,32 @@ const wxPGEditor* wxPGProperty::GetEditorClass() const return editor; } +bool wxPGProperty::Hide( bool hide, int flags ) +{ + wxPropertyGrid* pg = GetGrid(); + if ( pg ) + return pg->HideProperty(this, hide, flags); + + return DoHide( hide, flags ); +} + +bool wxPGProperty::DoHide( bool hide, int flags ) +{ + if ( !hide ) + ClearFlag( wxPG_PROP_HIDDEN ); + else + SetFlag( wxPG_PROP_HIDDEN ); + + if ( flags & wxPG_RECURSE ) + { + unsigned int i; + for ( i = 0; i < GetChildCount(); i++ ) + Item(i)->DoHide(hide, flags | wxPG_RECURSE_STARTS); + } + + return true; +} + bool wxPGProperty::HasVisibleChildren() const { unsigned int i; diff --git a/src/propgrid/propgridpagestate.cpp b/src/propgrid/propgridpagestate.cpp index cf059678a0..1279370d12 100644 --- a/src/propgrid/propgridpagestate.cpp +++ b/src/propgrid/propgridpagestate.cpp @@ -1397,18 +1397,7 @@ bool wxPropertyGridPageState::DoSelectProperty( wxPGProperty* p, unsigned int fl bool wxPropertyGridPageState::DoHideProperty( wxPGProperty* p, bool hide, int flags ) { - if ( !hide ) - p->ClearFlag( wxPG_PROP_HIDDEN ); - else - p->SetFlag( wxPG_PROP_HIDDEN ); - - if ( flags & wxPG_RECURSE ) - { - unsigned int i; - for ( i = 0; i < p->GetChildCount(); i++ ) - DoHideProperty(p->Item(i), hide, flags | wxPG_RECURSE_STARTS); - } - + p->DoHide(hide, flags); VirtualHeightChanged(); return true;