*/
#define wxPG_ATTR_AUTOCOMPLETE wxS("AutoComplete")
-/** wxBoolProperty specific, int, default 0. When 1 sets bool property to
- use checkbox instead of choice.
+/** wxBoolProperty and wxFlagsProperty specific. Value type is bool.
+ Default value is False.
+
+ When set to True, bool property will use check box instead of a
+ combo box as its editor control. If you set this attribute
+ for a wxFlagsProperty, it is automatically applied to child
+ bool properties.
*/
#define wxPG_BOOL_USE_CHECKBOX wxS("UseCheckbox")
-/** wxBoolProperty specific, int, default 0. When 1 sets bool property value
- to cycle on double click (instead of showing the popup listbox).
+/** wxBoolProperty and wxFlagsProperty specific. Value type is bool.
+ Default value is False.
+
+ Set to True for the bool property to cycle value on double click
+ (instead of showing the popup listbox). If you set this attribute
+ for a wxFlagsProperty, it is automatically applied to child
+ bool properties.
*/
#define wxPG_BOOL_USE_DOUBLE_CLICK_CYCLING wxS("UseDClickCycling")
int childIndex,
wxVariant& childValue ) const;
virtual void RefreshChildren();
+ virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
// GetChoiceSelection needs to overridden since m_choices is
// used and value is integer, but it is not index.
*/
#define wxPG_ATTR_AUTOCOMPLETE wxS("AutoComplete")
-/** wxBoolProperty specific, int, default 0. When 1 sets bool property to
- use checkbox instead of choice.
+/** wxBoolProperty and wxFlagsProperty specific. Value type is bool.
+ Default value is False.
+
+ When set to True, bool property will use check box instead of a
+ combo box as its editor control. If you set this attribute
+ for a wxFlagsProperty, it is automatically applied to child
+ bool properties.
*/
#define wxPG_BOOL_USE_CHECKBOX wxS("UseCheckbox")
-/** wxBoolProperty specific, int, default 0. When 1 sets bool property value
- to cycle on double click (instead of showing the popup listbox).
+/** wxBoolProperty and wxFlagsProperty specific. Value type is bool.
+ Default value is False.
+
+ Set to True for the bool property to cycle value on double click
+ (instead of showing the popup listbox). If you set this attribute
+ for a wxFlagsProperty, it is automatically applied to child
+ bool properties.
*/
#define wxPG_BOOL_USE_DOUBLE_CLICK_CYCLING wxS("UseDClickCycling")
@subsection wxFlagsProperty
- Represents a bit set that fits in a long integer. wxBoolProperty sub-properties
- are created for editing individual bits. Textctrl is created to manually edit
- the flags as a text; a continous sequence of spaces, commas and semicolons
- is considered as a flag id separator.
- <b>Note: </b> When changing "choices" (ie. flag labels) of wxFlagsProperty, you
- will need to use wxPGProperty::SetChoices() - otherwise they will not get updated
- properly.
+ Represents a bit set that fits in a long integer. wxBoolProperty sub-
+ properties are created for editing individual bits. Textctrl is created to
+ manually edit the flags as a text; a continous sequence of spaces, commas
+ and semicolons are considered as a flag id separator.
+
+ <b>Note:</b> When changing "choices" (ie. flag labels) of wxFlagsProperty,
+ you will need to use wxPGProperty::SetChoices() - otherwise they will not
+ get updated properly.
+
+ wxFlagsProperty supports the same attributes as wxBoolProperty.
@subsection wxArrayStringProperty
Helper class for managing choices of wxPropertyGrid properties.
Each entry can have label, value, bitmap, text colour, and background
colour.
-
+
wxPGChoices uses reference counting, similar to other wxWidgets classes.
This means that assignment operator and copy constructor only copy the
reference and not the actual data. Use Copy() member function to create a
m_children.clear();
+ // Relay wxPG_BOOL_USE_CHECKBOX and wxPG_BOOL_USE_DOUBLE_CLICK_CYCLING
+ // to child bool property controls.
+ long attrUseCheckBox = GetAttributeAsLong(wxPG_BOOL_USE_CHECKBOX, 0);
+ long attrUseDCC = GetAttributeAsLong(wxPG_BOOL_USE_DOUBLE_CLICK_CYCLING,
+ 0);
+
if ( m_choices.IsOk() )
{
const wxPGChoices& choices = m_choices;
{
boolProp = new wxBoolProperty( label, label, child_val );
}
+ if ( attrUseCheckBox )
+ boolProp->SetAttribute(wxPG_BOOL_USE_CHECKBOX,
+ true);
+ if ( attrUseDCC )
+ boolProp->SetAttribute(wxPG_BOOL_USE_DOUBLE_CLICK_CYCLING,
+ true);
AddPrivateChild(boolProp);
}
thisValue = (long)(oldValue & ~(vi));
}
+bool wxFlagsProperty::DoSetAttribute( const wxString& name, wxVariant& value )
+{
+ if ( name == wxPG_BOOL_USE_CHECKBOX ||
+ name == wxPG_BOOL_USE_DOUBLE_CLICK_CYCLING )
+ {
+ for ( size_t i=0; i<GetChildCount(); i++ )
+ {
+ Item(i)->SetAttribute(name, value);
+ }
+ // Must return false so that the attribute is stored in
+ // flag property's actual property storage
+ return false;
+ }
+ return false;
+}
+
// -----------------------------------------------------------------------
// wxDirProperty
// -----------------------------------------------------------------------