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
This commit is contained in:
Artur Wieczorek
2014-07-07 22:32:57 +00:00
parent e73166e01e
commit 71db47d26a
2 changed files with 19 additions and 8 deletions

View File

@@ -1070,14 +1070,7 @@ public:
*/ */
void SetPropertyReadOnly( wxPGPropArg id, void SetPropertyReadOnly( wxPGPropArg id,
bool set = true, bool set = true,
int flags = wxPG_RECURSE ) 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);
}
/** Sets property's value to unspecified. /** Sets property's value to unspecified.
If it has children (it may be category), then the same thing is done to If it has children (it may be category), then the same thing is done to

View File

@@ -283,6 +283,24 @@ bool wxPropertyGridInterface::EnableProperty( wxPGPropArg id, bool enable )
return true; 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 ) bool wxPropertyGridInterface::ExpandAll( bool doExpand )