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.
This commit is contained in:
Artur Wieczorek
2016-07-08 19:51:02 +02:00
parent c910085507
commit 9be1251f02

View File

@@ -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() )