From 9be1251f020a6708112189e7e2c8b0ccec1b8608 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Fri, 8 Jul 2016 19:51:02 +0200 Subject: [PATCH] Modified methods used to set/unset wxPGProperty as read-only and to hide/show it. If there is requested to set/unset a single property (without recursion) as a read-only (wxPropertyGridInterface::SetPropertyReadOnly) or to hide/show it (wxPropertyGridInterface::HideProperty) then first check if property is already in the requested state and if so do nothing. This prevents from unneeded refreshing of the display. --- src/propgrid/propgridiface.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/propgrid/propgridiface.cpp b/src/propgrid/propgridiface.cpp index 85e8f95c2a..52c10de16c 100644 --- a/src/propgrid/propgridiface.cpp +++ b/src/propgrid/propgridiface.cpp @@ -279,9 +279,17 @@ void wxPropertyGridInterface::SetPropertyReadOnly( wxPGPropArg id, bool set, int wxPG_PROP_ARG_CALL_PROLOG() if ( flags & wxPG_RECURSE ) + { p->SetFlagRecursively(wxPG_PROP_READONLY, set); + } else + { + // Do nothing if flag is already set. + if ( p->HasFlag(wxPG_PROP_READONLY) ) + return; + p->ChangeFlag(wxPG_PROP_READONLY, set); + } wxPropertyGridPageState* state = p->GetParentState(); if( state ) @@ -557,6 +565,15 @@ bool wxPropertyGridInterface::HideProperty( wxPGPropArg id, bool hide, int flags { wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false) + // Do nothing if single property is already hidden/visible as requested. + if ( !(flags & wxPG_RECURSE) ) + { + if ( hide && p->HasFlag(wxPG_PROP_HIDDEN) ) + return false; + if ( !hide && !p->HasFlag(wxPG_PROP_HIDDEN) ) + return false; + } + wxPropertyGrid* pg = m_pState->GetGrid(); if ( pg == p->GetGrid() )