From 71db47d26a095b2e164b9a8ccf731fccb9f5aa26 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Mon, 7 Jul 2014 22:32:57 +0000 Subject: [PATCH] Refresh property grid when property is switched to read-only state. Property grid is refreshed to reflect the new state of the property. Small refactoring of wxPropertyGridInterface class: SetPropertyReadOnly() function body moved from header file to source file. Closes #16306. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76875 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/propgrid/propgridiface.h | 9 +-------- src/propgrid/propgridiface.cpp | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/include/wx/propgrid/propgridiface.h b/include/wx/propgrid/propgridiface.h index a553d6dba1..542f60b795 100644 --- a/include/wx/propgrid/propgridiface.h +++ b/include/wx/propgrid/propgridiface.h @@ -1070,14 +1070,7 @@ public: */ void SetPropertyReadOnly( wxPGPropArg id, bool set = true, - int flags = wxPG_RECURSE ) - { - wxPG_PROP_ARG_CALL_PROLOG() - if ( flags & wxPG_RECURSE ) - p->SetFlagRecursively(wxPG_PROP_READONLY, set); - else - p->ChangeFlag(wxPG_PROP_READONLY, set); - } + int flags = wxPG_RECURSE ); /** Sets property's value to unspecified. If it has children (it may be category), then the same thing is done to diff --git a/src/propgrid/propgridiface.cpp b/src/propgrid/propgridiface.cpp index 5605f7a7ce..e6082b7765 100644 --- a/src/propgrid/propgridiface.cpp +++ b/src/propgrid/propgridiface.cpp @@ -283,6 +283,24 @@ bool wxPropertyGridInterface::EnableProperty( wxPGPropArg id, bool enable ) return true; } +void wxPropertyGridInterface::SetPropertyReadOnly( wxPGPropArg id, bool set, int flags) +{ + wxPG_PROP_ARG_CALL_PROLOG() + + if ( flags & wxPG_RECURSE ) + p->SetFlagRecursively(wxPG_PROP_READONLY, set); + else + p->ChangeFlag(wxPG_PROP_READONLY, set); + + wxPropertyGridPageState* state = p->GetParentState(); + if( state ) + { + // If property is attached to the property grid + // then refresh the view. + RefreshProperty( p ); + } +} + // ----------------------------------------------------------------------- bool wxPropertyGridInterface::ExpandAll( bool doExpand )