Added wxPGProperty::Enable() for conveniency. Refactored related code and improved related documentation.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65216 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1492,6 +1492,31 @@ wxVariant wxPGProperty::GetDefaultValue() const
|
||||
return wxVariant();
|
||||
}
|
||||
|
||||
void wxPGProperty::Enable( bool enable )
|
||||
{
|
||||
wxPropertyGrid* pg = GetGrid();
|
||||
|
||||
// Preferably call the version in the owning wxPropertyGrid,
|
||||
// since it handles the editor de-activation.
|
||||
if ( pg )
|
||||
pg->EnableProperty(this, enable);
|
||||
else
|
||||
DoEnable(enable);
|
||||
}
|
||||
|
||||
void wxPGProperty::DoEnable( bool enable )
|
||||
{
|
||||
if ( enable )
|
||||
ClearFlag(wxPG_PROP_DISABLED);
|
||||
else
|
||||
SetFlag(wxPG_PROP_DISABLED);
|
||||
|
||||
// Apply same to sub-properties as well
|
||||
unsigned int i;
|
||||
for ( i = 0; i < GetChildCount(); i++ )
|
||||
Item(i)->DoEnable( enable );
|
||||
}
|
||||
|
||||
void wxPGProperty::EnsureCells( unsigned int column )
|
||||
{
|
||||
if ( column >= m_cells.size() )
|
||||
|
||||
@@ -277,7 +277,7 @@ bool wxPropertyGridInterface::EnableProperty( wxPGPropArg id, bool enable )
|
||||
grid->DoSelectProperty( p, wxPG_SEL_FORCE );
|
||||
}
|
||||
|
||||
state->DoEnableProperty(p, enable);
|
||||
p->DoEnable(enable);
|
||||
|
||||
RefreshProperty( p );
|
||||
|
||||
|
||||
@@ -1398,42 +1398,6 @@ bool wxPropertyGridPageState::DoHideProperty( wxPGProperty* p, bool hide, int fl
|
||||
return true;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
bool wxPropertyGridPageState::DoEnableProperty( wxPGProperty* p, bool enable )
|
||||
{
|
||||
if ( p )
|
||||
{
|
||||
if ( enable )
|
||||
{
|
||||
if ( !(p->m_flags & wxPG_PROP_DISABLED) )
|
||||
return false;
|
||||
|
||||
// Enabling
|
||||
|
||||
p->m_flags &= ~(wxPG_PROP_DISABLED);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( p->m_flags & wxPG_PROP_DISABLED )
|
||||
return false;
|
||||
|
||||
// Disabling
|
||||
|
||||
p->m_flags |= wxPG_PROP_DISABLED;
|
||||
|
||||
}
|
||||
|
||||
// Apply same to sub-properties as well
|
||||
unsigned int i;
|
||||
for ( i = 0; i < p->GetChildCount(); i++ )
|
||||
DoEnableProperty( p->Item(i), enable );
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// wxPropertyGridPageState wxVariant related routines
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user