Moved wxPGProperty::SetFlag() to protected API since it does not have any side-effects that are usually desired in the user code. Added wxPGProperty::SetAutoUnspecified() since wxPG_PROP_AUTO_UNSPECIFIED can no longer be set (conveniently) with SetFlag().
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65218 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
346f3fd640
commit
6c78066f22
@ -1015,6 +1015,11 @@ without warnings or errors.
|
||||
- wxPropertyGrid::CanClose() has been removed. Call
|
||||
wxPropertyGridInterface::EditorValidate() instead.
|
||||
|
||||
- wxPGProperty::SetFlag() has been moved to private API. This was done to
|
||||
underline the fact that it was not the preferred method to change a
|
||||
property's state since it never had any desired side-effects. ChangeFlag()
|
||||
still exists for those who really need to achieve the same effect.
|
||||
|
||||
@subsection propgrid_compat_propdev Property and Editor Sub-classing Changes
|
||||
|
||||
- Confusing custom property macros have been eliminated.
|
||||
|
@ -473,6 +473,8 @@ wxPG_PROP_USES_COMMON_VALUE = 0x00020000,
|
||||
|
||||
@remarks
|
||||
This flag cannot be used with property iterators.
|
||||
|
||||
@see wxPGProperty::SetAutoUnspecified()
|
||||
*/
|
||||
wxPG_PROP_AUTO_UNSPECIFIED = 0x00040000,
|
||||
|
||||
@ -1908,6 +1910,21 @@ public:
|
||||
|
||||
void SetAttributes( const wxPGAttributeStorage& attributes );
|
||||
|
||||
/**
|
||||
Set if user can change the property's value to unspecified by
|
||||
modifying the value of the editor control (usually by clearing
|
||||
it). Currently, this can work with following properties:
|
||||
wxIntProperty, wxUIntProperty, wxFloatProperty, wxEditEnumProperty.
|
||||
|
||||
@param enable
|
||||
Whether to enable or disable this behavior (it is disabled by
|
||||
default).
|
||||
*/
|
||||
void SetAutoUnspecified( bool enable = true )
|
||||
{
|
||||
ChangeFlag(wxPG_PROP_AUTO_UNSPECIFIED, enable);
|
||||
}
|
||||
|
||||
/**
|
||||
Sets property's background colour.
|
||||
|
||||
@ -2039,23 +2056,14 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
Sets given property flag.
|
||||
Sets or clears given property flag. Mainly for internal use.
|
||||
|
||||
@see propgrid_propflags
|
||||
*/
|
||||
void SetFlag( wxPGPropertyFlags flag )
|
||||
{
|
||||
//
|
||||
// NB: While using wxPGPropertyFlags here makes it difficult to
|
||||
// combine different flags, it usefully prevents user from
|
||||
// using incorrect flags (say, wxWindow styles).
|
||||
m_flags |= flag;
|
||||
}
|
||||
@remarks Setting a property flag never has any side-effect, and is
|
||||
intended almost exclusively for internal use. So, for
|
||||
example, if you want to disable a property, call
|
||||
Enable(false) instead of setting wxPG_PROP_DISABLED flag.
|
||||
|
||||
/**
|
||||
Sets or clears given property flag.
|
||||
|
||||
@see propgrid_propflags
|
||||
@see HasFlag(), GetFlags()
|
||||
*/
|
||||
void ChangeFlag( wxPGPropertyFlags flag, bool set )
|
||||
{
|
||||
@ -2066,9 +2074,10 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
Sets or clears given property flag, recursively.
|
||||
Sets or clears given property flag, recursively. This function is
|
||||
primarily intended for internal use.
|
||||
|
||||
@see propgrid_propflags
|
||||
@see ChangeFlag()
|
||||
*/
|
||||
void SetFlagRecursively( wxPGPropertyFlags flag, bool set );
|
||||
|
||||
@ -2181,8 +2190,6 @@ public:
|
||||
return m_helpString;
|
||||
}
|
||||
|
||||
void ClearFlag( FlagType flag ) { m_flags &= ~(flag); }
|
||||
|
||||
// Use, for example, to detect if item is inside collapsed section.
|
||||
bool IsSomeParent( wxPGProperty* candidate_parent ) const;
|
||||
|
||||
@ -2375,6 +2382,17 @@ protected:
|
||||
void SetParentState( wxPropertyGridPageState* pstate )
|
||||
{ m_parentState = pstate; }
|
||||
|
||||
void SetFlag( wxPGPropertyFlags flag )
|
||||
{
|
||||
//
|
||||
// NB: While using wxPGPropertyFlags here makes it difficult to
|
||||
// combine different flags, it usefully prevents user from
|
||||
// using incorrect flags (say, wxWindow styles).
|
||||
m_flags |= flag;
|
||||
}
|
||||
|
||||
void ClearFlag( FlagType flag ) { m_flags &= ~(flag); }
|
||||
|
||||
// Call after fixed sub-properties added/removed after creation.
|
||||
// if oldSelInd >= 0 and < new max items, then selection is
|
||||
// moved to it.
|
||||
|
@ -287,6 +287,8 @@ wxPG_PROP_USES_COMMON_VALUE = 0x00020000,
|
||||
|
||||
@remarks
|
||||
This flag cannot be used with property iterators.
|
||||
|
||||
@see wxPGProperty::SetAutoUnspecified()
|
||||
*/
|
||||
wxPG_PROP_AUTO_UNSPECIFIED = 0x00040000,
|
||||
|
||||
@ -1140,9 +1142,14 @@ public:
|
||||
bool AreChildrenComponents() const;
|
||||
|
||||
/**
|
||||
Sets or clears given property flag.
|
||||
Sets or clears given property flag. Mainly for internal use.
|
||||
|
||||
@see propgrid_propflags
|
||||
@remarks Setting a property flag never has any side-effect, and is
|
||||
intended almost exclusively for internal use. So, for
|
||||
example, if you want to disable a property, call
|
||||
Enable(false) instead of setting wxPG_PROP_DISABLED flag.
|
||||
|
||||
@see HasFlag(), GetFlags()
|
||||
*/
|
||||
void ChangeFlag( wxPGPropertyFlags flag, bool set );
|
||||
|
||||
@ -1510,6 +1517,18 @@ public:
|
||||
*/
|
||||
void SetAttribute( const wxString& name, wxVariant value );
|
||||
|
||||
/**
|
||||
Set if user can change the property's value to unspecified by
|
||||
modifying the value of the editor control (usually by clearing
|
||||
it). Currently, this can work with following properties:
|
||||
wxIntProperty, wxUIntProperty, wxFloatProperty, wxEditEnumProperty.
|
||||
|
||||
@param enable
|
||||
Whether to enable or disable this behavior (it is disabled by
|
||||
default).
|
||||
*/
|
||||
void SetAutoUnspecified( bool enable = true );
|
||||
|
||||
/**
|
||||
Sets property's background colour.
|
||||
|
||||
@ -1581,16 +1600,10 @@ public:
|
||||
void SetDefaultValue( wxVariant& value );
|
||||
|
||||
/**
|
||||
Sets given property flag.
|
||||
Sets or clears given property flag, recursively. This function is
|
||||
primarily intended for internal use.
|
||||
|
||||
@see propgrid_propflags
|
||||
*/
|
||||
void SetFlag( wxPGPropertyFlags flag );
|
||||
|
||||
/**
|
||||
Sets or clears given property flag, recursively.
|
||||
|
||||
@see propgrid_propflags
|
||||
@see ChangeFlag()
|
||||
*/
|
||||
void SetFlagRecursively( wxPGPropertyFlags flag, bool set );
|
||||
|
||||
|
@ -1516,7 +1516,7 @@ void FormMain::PopulateWithExamples ()
|
||||
pid = pg->Append( new wxColourProperty(wxT("ColourProperty"),wxPG_LABEL,*wxRED) );
|
||||
//pg->SetPropertyAttribute(pid,wxPG_COLOUR_ALLOW_CUSTOM,false);
|
||||
pg->SetPropertyEditor( wxT("ColourProperty"), wxPGEditor_ComboBox );
|
||||
pg->GetProperty(wxT("ColourProperty"))->SetFlag(wxPG_PROP_AUTO_UNSPECIFIED);
|
||||
pg->GetProperty(wxT("ColourProperty"))->SetAutoUnspecified(true);
|
||||
pg->SetPropertyHelpString( wxT("ColourProperty"),
|
||||
wxT("wxPropertyGrid::SetPropertyEditor method has been used to change ")
|
||||
wxT("editor of this property to wxPGEditor_ComboBox)"));
|
||||
|
@ -106,7 +106,7 @@ public:
|
||||
void FormMain::AddTestProperties( wxPropertyGridPage* pg )
|
||||
{
|
||||
pg->Append( new MyColourProperty(wxT("CustomColourProperty"), wxPG_LABEL, *wxGREEN) );
|
||||
pg->GetProperty(wxT("CustomColourProperty"))->SetFlag(wxPG_PROP_AUTO_UNSPECIFIED);
|
||||
pg->GetProperty(wxT("CustomColourProperty"))->SetAutoUnspecified(true);
|
||||
pg->SetPropertyEditor( wxT("CustomColourProperty"), wxPGEditor_ComboBox );
|
||||
|
||||
pg->SetPropertyHelpString(wxT("CustomColourProperty"),
|
||||
|
@ -1343,7 +1343,7 @@ void wxFlagsProperty::OnSetValue()
|
||||
flag = choices.GetValue(i);
|
||||
|
||||
if ( (newFlags & flag) != (m_oldValue & flag) )
|
||||
Item(i)->SetFlag( wxPG_PROP_MODIFIED );
|
||||
Item(i)->ChangeFlag( wxPG_PROP_MODIFIED, true );
|
||||
}
|
||||
|
||||
m_oldValue = newFlags;
|
||||
@ -1451,7 +1451,7 @@ void wxFlagsProperty::RefreshChildren()
|
||||
wxPGProperty* p = Item(i);
|
||||
|
||||
if ( subVal != (m_oldValue & flag) )
|
||||
p->SetFlag( wxPG_PROP_MODIFIED );
|
||||
p->ChangeFlag( wxPG_PROP_MODIFIED, true );
|
||||
|
||||
p->SetValue( subVal?true:false );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user