Fixed setting colours of wxPGProperty

When wxPGProperty's text or background colours are modified with dedicated wxPropertyGridInterface utility functions (SetPropertyBackgroundColour, SetPropertyTextColour, SetPropertyColoursToDefault) then it is enough to redraw the property with new colours because its internal state remains unmodified and full refreshing is not necessary.

Closes #17588
This commit is contained in:
Artur Wieczorek
2016-07-08 19:44:32 +02:00
parent d2b3484e60
commit 4f1e3b7172
3 changed files with 83 additions and 12 deletions

View File

@@ -669,7 +669,16 @@ wxPropertyGridInterface::SetPropertyBackgroundColour( wxPGPropArg id,
{
wxPG_PROP_ARG_CALL_PROLOG()
p->SetBackgroundColour(colour, flags);
RefreshProperty(p);
// Redraw the control
wxPropertyGrid* pg = m_pState->GetGrid();
if ( pg == p->GetGrid() )
{
if ( flags & wxPG_RECURSE )
pg->DrawItemAndChildren(p);
else
pg->DrawItem(p);
}
}
// -----------------------------------------------------------------------
@@ -680,7 +689,16 @@ void wxPropertyGridInterface::SetPropertyTextColour( wxPGPropArg id,
{
wxPG_PROP_ARG_CALL_PROLOG()
p->SetTextColour(colour, flags);
RefreshProperty(p);
// Redraw the control
wxPropertyGrid* pg = m_pState->GetGrid();
if ( pg == p->GetGrid() )
{
if ( flags & wxPG_RECURSE )
pg->DrawItemAndChildren(p);
else
pg->DrawItem(p);
}
}
// -----------------------------------------------------------------------
@@ -695,8 +713,17 @@ void wxPropertyGridInterface::SetPropertyColoursToDefault(wxPGPropArg id)
void wxPropertyGridInterface::SetPropertyColoursToDefault(wxPGPropArg id, int flags)
{
wxPG_PROP_ARG_CALL_PROLOG()
p->SetDefaultColours(flags);
// Redraw the control
wxPropertyGrid* pg = m_pState->GetGrid();
if ( pg == p->GetGrid() )
{
if ( flags & wxPG_RECURSE )
pg->DrawItemAndChildren(p);
else
pg->DrawItem(p);
}
}
// -----------------------------------------------------------------------