*/
void DeleteChoice( int index );
+ /**
+ Enables or disables the property. Disabled property usually appears
+ as having grey text.
+
+ @param enable
+ If @false, property is disabled instead.
+
+ @see wxPropertyGridInterface::EnableProperty()
+ */
+ void Enable( bool enable = true );
+
/**
Call to enable or disable usage of common value (integer value that can
be selected for properties instead of their normal values) for this
// Removes child property with given pointer. Does not delete it.
void RemoveChild( wxPGProperty* p );
+ void DoEnable( bool enable );
+
void DoPreAddChild( int index, wxPGProperty* prop );
void SetParentState( wxPropertyGridPageState* pstate )
*/
wxPGProperty* RemoveProperty( wxPGPropArg id );
- /** Disables property. */
+ /**
+ Disables a property.
+
+ @see EnableProperty(), wxPGProperty::Enable()
+ */
bool DisableProperty( wxPGPropArg id ) { return EnableProperty(id,false); }
/**
/**
Enables or disables property, depending on whether enable is true or
- false.
+ false. Disabled property usually appears as having grey text.
+
+ @param id
+ Name or pointer to a property.
+ @param enable
+ If @false, property is disabled instead.
+
+ @see wxPGProperty::Enable()
*/
bool EnableProperty( wxPGPropArg id, bool enable = true );
}
}
- /** Enables or disables given property and its subproperties. */
- bool DoEnableProperty( wxPGProperty* p, bool enable );
-
/** Returns (precalculated) height of contained visible properties.
*/
unsigned int GetVirtualHeight() const
/** Deletes all child properties. */
void Empty();
+ /**
+ Enables or disables the property. Disabled property usually appears
+ as having grey text.
+
+ @param enable
+ If @false, property is disabled instead.
+
+ @see wxPropertyGridInterface::EnableProperty()
+ */
+ void Enable( bool enable = true );
+
/**
Composes text from values of child properties.
*/
/**
Disables a property.
+
+ @see EnableProperty(), wxPGProperty::Enable()
*/
bool DisableProperty( wxPGPropArg id );
bool EditorValidate();
/**
- Enables or disables property.
+ Enables or disables property. Disabled property usually appears as
+ having grey text.
@param id
Name or pointer to a property.
@param enable
If @false, property is disabled instead.
+
+ @see wxPGProperty::Enable()
*/
bool EnableProperty( wxPGPropArg id, bool enable = true );
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() )
grid->DoSelectProperty( p, wxPG_SEL_FORCE );
}
- state->DoEnableProperty(p, enable);
+ p->DoEnable(enable);
RefreshProperty( p );
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
// -----------------------------------------------------------------------