wxFlagsProperty now automatically relays wxBOOL_USE_CHECKBOX and wxBOOL_USE_DOUBLE_CLICK_CYCLING to child bool properties (closes #10690)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60207 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -520,13 +520,23 @@ wxPG_PROP_CLASS_SPECIFIC_2 = 0x00100000
|
||||
*/
|
||||
#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")
|
||||
|
||||
|
@@ -538,6 +538,7 @@ public:
|
||||
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.
|
||||
|
@@ -51,13 +51,23 @@
|
||||
*/
|
||||
#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")
|
||||
|
||||
@@ -300,13 +310,16 @@
|
||||
|
||||
@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
|
||||
|
||||
|
@@ -1224,6 +1224,12 @@ void wxFlagsProperty::Init()
|
||||
|
||||
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;
|
||||
@@ -1246,6 +1252,12 @@ void wxFlagsProperty::Init()
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1494,6 +1506,22 @@ void wxFlagsProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVari
|
||||
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
|
||||
// -----------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user