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")
|
#define wxPG_ATTR_AUTOCOMPLETE wxS("AutoComplete")
|
||||||
|
|
||||||
/** wxBoolProperty specific, int, default 0. When 1 sets bool property to
|
/** wxBoolProperty and wxFlagsProperty specific. Value type is bool.
|
||||||
use checkbox instead of choice.
|
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")
|
#define wxPG_BOOL_USE_CHECKBOX wxS("UseCheckbox")
|
||||||
|
|
||||||
/** wxBoolProperty specific, int, default 0. When 1 sets bool property value
|
/** wxBoolProperty and wxFlagsProperty specific. Value type is bool.
|
||||||
to cycle on double click (instead of showing the popup listbox).
|
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")
|
#define wxPG_BOOL_USE_DOUBLE_CLICK_CYCLING wxS("UseDClickCycling")
|
||||||
|
|
||||||
|
@@ -538,6 +538,7 @@ public:
|
|||||||
int childIndex,
|
int childIndex,
|
||||||
wxVariant& childValue ) const;
|
wxVariant& childValue ) const;
|
||||||
virtual void RefreshChildren();
|
virtual void RefreshChildren();
|
||||||
|
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
|
||||||
|
|
||||||
// GetChoiceSelection needs to overridden since m_choices is
|
// GetChoiceSelection needs to overridden since m_choices is
|
||||||
// used and value is integer, but it is not index.
|
// used and value is integer, but it is not index.
|
||||||
|
@@ -51,13 +51,23 @@
|
|||||||
*/
|
*/
|
||||||
#define wxPG_ATTR_AUTOCOMPLETE wxS("AutoComplete")
|
#define wxPG_ATTR_AUTOCOMPLETE wxS("AutoComplete")
|
||||||
|
|
||||||
/** wxBoolProperty specific, int, default 0. When 1 sets bool property to
|
/** wxBoolProperty and wxFlagsProperty specific. Value type is bool.
|
||||||
use checkbox instead of choice.
|
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")
|
#define wxPG_BOOL_USE_CHECKBOX wxS("UseCheckbox")
|
||||||
|
|
||||||
/** wxBoolProperty specific, int, default 0. When 1 sets bool property value
|
/** wxBoolProperty and wxFlagsProperty specific. Value type is bool.
|
||||||
to cycle on double click (instead of showing the popup listbox).
|
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")
|
#define wxPG_BOOL_USE_DOUBLE_CLICK_CYCLING wxS("UseDClickCycling")
|
||||||
|
|
||||||
@@ -300,13 +310,16 @@
|
|||||||
|
|
||||||
@subsection wxFlagsProperty
|
@subsection wxFlagsProperty
|
||||||
|
|
||||||
Represents a bit set that fits in a long integer. wxBoolProperty sub-properties
|
Represents a bit set that fits in a long integer. wxBoolProperty sub-
|
||||||
are created for editing individual bits. Textctrl is created to manually edit
|
properties are created for editing individual bits. Textctrl is created to
|
||||||
the flags as a text; a continous sequence of spaces, commas and semicolons
|
manually edit the flags as a text; a continous sequence of spaces, commas
|
||||||
is considered as a flag id separator.
|
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
|
<b>Note:</b> When changing "choices" (ie. flag labels) of wxFlagsProperty,
|
||||||
properly.
|
you will need to use wxPGProperty::SetChoices() - otherwise they will not
|
||||||
|
get updated properly.
|
||||||
|
|
||||||
|
wxFlagsProperty supports the same attributes as wxBoolProperty.
|
||||||
|
|
||||||
@subsection wxArrayStringProperty
|
@subsection wxArrayStringProperty
|
||||||
|
|
||||||
@@ -1454,7 +1467,7 @@ public:
|
|||||||
Helper class for managing choices of wxPropertyGrid properties.
|
Helper class for managing choices of wxPropertyGrid properties.
|
||||||
Each entry can have label, value, bitmap, text colour, and background
|
Each entry can have label, value, bitmap, text colour, and background
|
||||||
colour.
|
colour.
|
||||||
|
|
||||||
wxPGChoices uses reference counting, similar to other wxWidgets classes.
|
wxPGChoices uses reference counting, similar to other wxWidgets classes.
|
||||||
This means that assignment operator and copy constructor only copy the
|
This means that assignment operator and copy constructor only copy the
|
||||||
reference and not the actual data. Use Copy() member function to create a
|
reference and not the actual data. Use Copy() member function to create a
|
||||||
|
@@ -1224,6 +1224,12 @@ void wxFlagsProperty::Init()
|
|||||||
|
|
||||||
m_children.clear();
|
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() )
|
if ( m_choices.IsOk() )
|
||||||
{
|
{
|
||||||
const wxPGChoices& choices = m_choices;
|
const wxPGChoices& choices = m_choices;
|
||||||
@@ -1246,6 +1252,12 @@ void wxFlagsProperty::Init()
|
|||||||
{
|
{
|
||||||
boolProp = new wxBoolProperty( label, label, child_val );
|
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);
|
AddPrivateChild(boolProp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1494,6 +1506,22 @@ void wxFlagsProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVari
|
|||||||
thisValue = (long)(oldValue & ~(vi));
|
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
|
// wxDirProperty
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user