Make wxPGPropertyFlags a bitmask

To improve type safety of flags.
This commit is contained in:
Artur Wieczorek 2023-12-23 18:45:57 +01:00
parent 1b5a43599a
commit c8552aec0c
19 changed files with 763 additions and 615 deletions

View file

@ -150,8 +150,8 @@ protected:
#if WXWIN_COMPATIBILITY_3_2
// If set, then match from list is searched for a custom colour.
wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_TRANSLATE_CUSTOM is intended for internal use.")
constexpr wxPGPropertyFlags wxPG_PROP_TRANSLATE_CUSTOM = wxPG_PROP_RESERVED_1;
wxDEPRECATED_MSG("wxPG_PROP_TRANSLATE_CUSTOM is intended for internal use.")
constexpr wxPGPropertyFlags wxPG_PROP_TRANSLATE_CUSTOM = wxPGPropertyFlags::Reserved_1;
#endif // WXWIN_COMPATIBILITY_3_2
// Has dropdown list of wxWidgets system colours. Value used is

View file

@ -188,31 +188,29 @@ wxDECLARE_EVENT(wxEVT_PG_COLS_RESIZED, wxPropertyGridEvent);
// Flags used only internally
// wxBoolProperty, wxFlagsProperty specific flags
constexpr wxPGPropertyFlags wxPG_PROP_USE_CHECKBOX = wxPG_PROP_RESERVED_1;
constexpr wxPGPropertyFlags wxPGPropertyFlags_UseCheckBox = wxPGPropertyFlags::Reserved_1;
// DCC = Double Click Cycles
constexpr wxPGPropertyFlags wxPG_PROP_USE_DCC = wxPG_PROP_RESERVED_2;
constexpr wxPGPropertyFlags wxPGPropertyFlags_UseDCC = wxPGPropertyFlags::Reserved_2;
// wxStringProperty flag
constexpr wxPGPropertyFlags wxPG_PROP_PASSWORD = wxPG_PROP_RESERVED_2;
constexpr wxPGPropertyFlags wxPGPropertyFlags_Password = wxPGPropertyFlags::Reserved_2;
#if !WXWIN_COMPATIBILITY_3_2
// wxColourProperty flag - if set, then match from list is searched for a custom colour.
constexpr wxPGPropertyFlags wxPG_PROP_TRANSLATE_CUSTOM = wxPG_PROP_RESERVED_1;
constexpr wxPGPropertyFlags wxPGPropertyFlags_TranslateCustom = wxPGPropertyFlags::Reserved_1;
// wxCursorProperty, wxSystemColourProperty - If set, then selection of choices is static
// and should not be changed (i.e. returns nullptr in GetPropertyChoices).
constexpr wxPGPropertyFlags wxPG_PROP_STATIC_CHOICES = wxPG_PROP_RESERVED_1;
constexpr wxPGPropertyFlags wxPGPropertyFlags_StaticChoices = wxPGPropertyFlags::Reserved_1;
// wxSystemColourProperty - wxEnumProperty based classes cannot use wxPG_PROP_RESERVED_1
constexpr wxPGPropertyFlags wxPG_PROP_HIDE_CUSTOM_COLOUR = wxPG_PROP_RESERVED_2;
constexpr wxPGPropertyFlags wxPG_PROP_COLOUR_HAS_ALPHA = wxPG_PROP_RESERVED_3;
// wxSystemColourProperty - wxEnumProperty based classes cannot use wxPGPropertyFlags::Reserved_1
constexpr wxPGPropertyFlags wxPGPropertyFlags_HideCustomColour = wxPGPropertyFlags::Reserved_2;
constexpr wxPGPropertyFlags wxPGPropertyFlags_ColourHasAlpha = wxPGPropertyFlags::Reserved_3;
// wxFileProperty - if set, full path is shown in wxFileProperty.
constexpr wxPGPropertyFlags wxPG_PROP_SHOW_FULL_FILENAME = wxPG_PROP_RESERVED_1;
constexpr wxPGPropertyFlags wxPGPropertyFlags_ShowFullFileName = wxPGPropertyFlags::Reserved_1;
// wxLongStringProperty - flag used to mark that edit button
// should be enabled even in the read-only mode.
constexpr wxPGPropertyFlags wxPG_PROP_ACTIVE_BTN = wxPG_PROP_RESERVED_3;
#endif // !WXWIN_COMPATIBILITY_3_2
constexpr wxPGPropertyFlags wxPGPropertyFlags_ActiveButton = wxPGPropertyFlags::Reserved_3;
#endif // _WX_PROPGRID_PRIVATE_H_

View file

@ -304,70 +304,69 @@ protected:
std::unordered_map<wxString, wxVariantData*> m_map;
};
// -----------------------------------------------------------------------
enum wxPGPropertyFlags
enum class wxPGPropertyFlags : int
{
// No flags.
Null = 0,
// Indicates bold font.
wxPG_PROP_MODIFIED = 0x0001,
Modified = 0x0001,
// Disables ('greyed' text and editor does not activate) property.
wxPG_PROP_DISABLED = 0x0002,
Disabled = 0x0002,
// Hider button will hide this property.
wxPG_PROP_HIDDEN = 0x0004,
Hidden = 0x0004,
// This property has custom paint image just in front of its value.
// If property only draws custom images into a popup list, then this
// flag should not be set.
wxPG_PROP_CUSTOMIMAGE = 0x0008,
CustomImage = 0x0008,
// Do not create text based editor for this property (but button-triggered
// dialog and choice are ok).
wxPG_PROP_NOEDITOR = 0x0010,
NoEditor = 0x0010,
// Property is collapsed, ie. its children are hidden.
wxPG_PROP_COLLAPSED = 0x0020,
// Property is collapsed, ie. it's children are hidden.
Collapsed = 0x0020,
// If property is selected, then indicates that validation failed for pending
// value.
// If property is not selected, that indicates that the actual property
// value has failed validation (NB: this behaviour is not currently supported,
// but may be used in future).
wxPG_PROP_INVALID_VALUE = 0x0040,
InvalidValue = 0x0040,
// 0x0080,
// Switched via SetWasModified(). Temporary flag - only used when
// setting/changing property value.
wxPG_PROP_WAS_MODIFIED = 0x0200,
WasModified = 0x0200,
// If set, then child properties (if any) are private, and should be
// "invisible" to the application.
wxPG_PROP_AGGREGATE = 0x0400,
Aggregate = 0x0400,
// If set, then child properties (if any) are copies and should not
// be deleted in dtor.
wxPG_PROP_CHILDREN_ARE_COPIES = 0x0800,
ChildrenAreCopies = 0x0800,
// Classifies this item as a non-category.
// Used for faster item type identification.
wxPG_PROP_PROPERTY = 0x1000,
Property = 0x1000,
// Classifies this item as a category.
// Used for faster item type identification.
wxPG_PROP_CATEGORY = 0x2000,
Category = 0x2000,
// Classifies this item as a property that has children,
//but is not aggregate (i.e. children are not private).
wxPG_PROP_MISC_PARENT = 0x4000,
MiscParent = 0x4000,
// Property is read-only. Editor is still created for wxTextCtrl-based
// property editors. For others, editor is not usually created because
// they do implement wxTE_READONLY style or equivalent.
wxPG_PROP_READONLY = 0x8000,
ReadOnly = 0x8000,
//
// NB: FLAGS ABOVE 0x8000 CANNOT BE USED WITH PROPERTY ITERATORS
@ -375,57 +374,158 @@ wxPG_PROP_READONLY = 0x8000,
// Property's value is composed from values of child properties.
// This flag cannot be used with property iterators.
wxPG_PROP_COMPOSED_VALUE = 0x00010000,
ComposedValue = 0x00010000,
// Common value of property is selectable in editor.
// This flag cannot be used with property iterators.
wxPG_PROP_USES_COMMON_VALUE = 0x00020000,
UsesCommonValue = 0x00020000,
// Property can be set to unspecified value via editor.
// Currently, this applies to following properties:
// Currently, this applxPGies to following properties:
// - wxIntProperty, wxUIntProperty, wxFloatProperty, wxEditEnumProperty:
// Clear the text field
// This flag cannot be used with property iterators.
// See wxPGProperty::SetAutoUnspecified().
wxPG_PROP_AUTO_UNSPECIFIED = 0x00040000,
// For internal use only.
wxPG_PROP_RESERVED_1 = 0x00080000,
// For internal use only.
wxPG_PROP_RESERVED_2 = 0x00100000,
AutoUnspecified = 0x00040000,
// Indicates that the property is being deleted and should be ignored.
wxPG_PROP_BEING_DELETED = 0x00200000,
BeingDeleted = 0x00080000,
// If set, full path is shown in wxFileProperty.
ShowFullFileName = 0x00100000,
// For internal use only.
wxPG_PROP_RESERVED_3 = 0x00400000
};
Reserved_1 = 0x10000000,
#if WXWIN_COMPATIBILITY_3_2
// Indicates bits usable by derived properties.
wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_CLASS_SPECIFIC_1 in intended for internal use only.")
constexpr wxPGPropertyFlags wxPG_PROP_CLASS_SPECIFIC_1 = wxPG_PROP_RESERVED_1;
wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_CLASS_SPECIFIC_2 in intended for internal use only.")
constexpr wxPGPropertyFlags wxPG_PROP_CLASS_SPECIFIC_2 = wxPG_PROP_RESERVED_2;
wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_CLASS_SPECIFIC_3 in intended for internal use only.")
constexpr wxPGPropertyFlags wxPG_PROP_CLASS_SPECIFIC_3 = wxPG_PROP_RESERVED_3;
#endif // WXWIN_COMPATIBILITY_3_2
// For internal use only.
Reserved_2 = 0x20000000,
// For internal use only.
Reserved_3 = 0x40000000,
// Topmost flag.
constexpr wxPGPropertyFlags wxPG_PROP_MAX = wxPG_PROP_AUTO_UNSPECIFIED;
Max = ShowFullFileName,
// Property with children must have one of these set, otherwise iterators
// will not work correctly.
// Code should automatically take care of this, however.
#define wxPG_PROP_PARENTAL_FLAGS \
((wxPGPropertyFlags)(wxPG_PROP_AGGREGATE | \
wxPG_PROP_CATEGORY | \
wxPG_PROP_MISC_PARENT))
ParentalFlags = Aggregate | Category | MiscParent,
// Combination of flags that can be stored by GetFlagsAsString
#define wxPG_STRING_STORED_FLAGS \
(wxPG_PROP_DISABLED|wxPG_PROP_HIDDEN|wxPG_PROP_NOEDITOR|wxPG_PROP_COLLAPSED)
StringStoredFlags = Disabled | Hidden | NoEditor | Collapsed
};
constexpr wxPGPropertyFlags operator|(wxPGPropertyFlags a, wxPGPropertyFlags b)
{
return static_cast<wxPGPropertyFlags>(static_cast<int>(a) | static_cast<int>(b));
}
inline wxPGPropertyFlags operator|=(wxPGPropertyFlags & a, wxPGPropertyFlags b)
{
return a = a | b;
}
constexpr wxPGPropertyFlags operator&(wxPGPropertyFlags a, wxPGPropertyFlags b)
{
return static_cast<wxPGPropertyFlags>(static_cast<int>(a) & static_cast<int>(b));
}
inline wxPGPropertyFlags operator&=(wxPGPropertyFlags & a, wxPGPropertyFlags b)
{
return a = a & b;
}
constexpr wxPGPropertyFlags operator^(wxPGPropertyFlags a, wxPGPropertyFlags b)
{
return static_cast<wxPGPropertyFlags>(static_cast<int>(a) ^ static_cast<int>(b));
}
constexpr wxPGPropertyFlags operator~(wxPGPropertyFlags a)
{
return static_cast<wxPGPropertyFlags>(~static_cast<int>(a));
}
constexpr bool operator!(wxPGPropertyFlags a)
{
return static_cast<int>(a) == 0;
}
// We need these operators with int arguments for interoperability
// with wxPG_ITERATOR_FLAGS as plain enumeration).
// =====
constexpr int operator<<(wxPGPropertyFlags a, int n)
{
return static_cast<int>(a) << n;
}
constexpr int operator|(wxPGPropertyFlags a, int b)
{
return static_cast<int>(a) | b;
}
constexpr int operator|(int a, wxPGPropertyFlags b)
{
return a | static_cast<int>(b);
}
constexpr int operator&(int a, wxPGPropertyFlags b)
{
return a & static_cast<int>(b);
}
// =====
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use wxPGPropertyFlags::Modified instead")
constexpr wxPGPropertyFlags wxPG_PROP_MODIFIED = wxPGPropertyFlags::Modified;
wxDEPRECATED_MSG("use wxPGPropertyFlags::Disabled instead")
constexpr wxPGPropertyFlags wxPG_PROP_DISABLED = wxPGPropertyFlags::Disabled;
wxDEPRECATED_MSG("use wxPGPropertyFlags::Hidden instead")
constexpr wxPGPropertyFlags wxPG_PROP_HIDDEN = wxPGPropertyFlags::Hidden;
wxDEPRECATED_MSG("use wxPGPropertyFlags::CustomImage instead")
constexpr wxPGPropertyFlags wxPG_PROP_CUSTOMIMAGE = wxPGPropertyFlags::CustomImage;
wxDEPRECATED_MSG("use wxPGPropertyFlags::NoEditor instead")
constexpr wxPGPropertyFlags wxPG_PROP_NOEDITOR = wxPGPropertyFlags::NoEditor;
wxDEPRECATED_MSG("use wxPGPropertyFlags::Collapsed instead")
constexpr wxPGPropertyFlags wxPG_PROP_COLLAPSED = wxPGPropertyFlags::Collapsed;
wxDEPRECATED_MSG("use wxPGPropertyFlags::InvalidValue instead")
constexpr wxPGPropertyFlags wxPG_PROP_INVALID_VALUE = wxPGPropertyFlags::InvalidValue;
wxDEPRECATED_MSG("use wxPGPropertyFlags::WasModified instead")
constexpr wxPGPropertyFlags wxPG_PROP_WAS_MODIFIED = wxPGPropertyFlags::WasModified;
wxDEPRECATED_MSG("use wxPGPropertyFlags::Aggregate instead")
constexpr wxPGPropertyFlags wxPG_PROP_AGGREGATE = wxPGPropertyFlags::Aggregate;
wxDEPRECATED_MSG("use wxPGPropertyFlags::ChildrenAreCopies instead")
constexpr wxPGPropertyFlags wxPG_PROP_CHILDREN_ARE_COPIES = wxPGPropertyFlags::ChildrenAreCopies;
wxDEPRECATED_MSG("use wxPGPropertyFlags::Property instead")
constexpr wxPGPropertyFlags wxPG_PROP_PROPERTY = wxPGPropertyFlags::Property;
wxDEPRECATED_MSG("use wxPGPropertyFlags::Category instead")
constexpr wxPGPropertyFlags wxPG_PROP_CATEGORY = wxPGPropertyFlags::Category;
wxDEPRECATED_MSG("use wxPGPropertyFlags::MiscParent instead")
constexpr wxPGPropertyFlags wxPG_PROP_MISC_PARENT = wxPGPropertyFlags::MiscParent;
wxDEPRECATED_MSG("use wxPGPropertyFlags::ReadOnly instead")
constexpr wxPGPropertyFlags wxPG_PROP_READONLY = wxPGPropertyFlags::ReadOnly;
wxDEPRECATED_MSG("use wxPGPropertyFlags::ComposedValue instead")
constexpr wxPGPropertyFlags wxPG_PROP_COMPOSED_VALUE = wxPGPropertyFlags::ComposedValue;
wxDEPRECATED_MSG("use wxPGPropertyFlags::UsesCommonValue instead")
constexpr wxPGPropertyFlags wxPG_PROP_USES_COMMON_VALUE = wxPGPropertyFlags::UsesCommonValue;
wxDEPRECATED_MSG("use wxPGPropertyFlags::AutoUnspecified instead")
constexpr wxPGPropertyFlags wxPG_PROP_AUTO_UNSPECIFIED = wxPGPropertyFlags::AutoUnspecified;
wxDEPRECATED_MSG("use wxPGPropertyFlags::BeingDeleted instead")
constexpr wxPGPropertyFlags wxPG_PROP_BEING_DELETED = wxPGPropertyFlags::BeingDeleted;
wxDEPRECATED_MSG("use wxPGPropertyFlags::ParentalFlags instead")
constexpr wxPGPropertyFlags wxPG_PROP_PARENTAL_FLAGS = wxPGPropertyFlags::ParentalFlags;
wxDEPRECATED_MSG("use wxPGPropertyFlags::StringStoredFlags instead")
constexpr wxPGPropertyFlags wxPG_STRING_STORED_FLAGS = wxPGPropertyFlags::StringStoredFlags;
wxDEPRECATED_MSG("use wxPGPropertyFlags::Max instead")
constexpr wxPGPropertyFlags wxPG_PROP_MAX = wxPGPropertyFlags::Max;
// Indicates bits usable by derived properties.
wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_CLASS_SPECIFIC_1 in intended for internal use only.")
constexpr wxPGPropertyFlags wxPG_PROP_CLASS_SPECIFIC_1 = wxPGPropertyFlags::Reserved_1;
wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_CLASS_SPECIFIC_2 in intended for internal use only.")
constexpr wxPGPropertyFlags wxPG_PROP_CLASS_SPECIFIC_2 = wxPGPropertyFlags::Reserved_2;
wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_CLASS_SPECIFIC_3 in intended for internal use only.")
constexpr wxPGPropertyFlags wxPG_PROP_CLASS_SPECIFIC_3 = wxPGPropertyFlags::Reserved_3;
#endif // WXWIN_COMPATIBILITY_3_2
// -----------------------------------------------------------------------
@ -950,7 +1050,12 @@ class WXDLLIMPEXP_PROPGRID wxPGProperty : public wxObject
wxDECLARE_ABSTRACT_CLASS(wxPGProperty);
public:
#if WXWIN_COMPATIBILITY_3_0
typedef wxUint32 FlagType;
#elif WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use wxPGPropertyFlags type instead")
typedef wxUint32 FlagType;
#endif // WXWIN_COMPATIBILITY_3_0, WXWIN_COMPATIBILITY_3_2
// Virtual destructor.
// It is customary for derived properties to implement this.
@ -1197,7 +1302,7 @@ public:
// values of a font).
bool AreChildrenComponents() const
{
return (m_flags & (wxPG_PROP_COMPOSED_VALUE|wxPG_PROP_AGGREGATE)) != 0;
return !!(m_flags & (wxPGPropertyFlags::ComposedValue|wxPGPropertyFlags::Aggregate));
}
// Deletes children of the property.
@ -1219,7 +1324,7 @@ public:
// Common values are disabled by the default for all properties.
void EnableCommonValue( bool enable = true )
{
ChangeFlag(wxPG_PROP_USES_COMMON_VALUE, enable);
ChangeFlag(wxPGPropertyFlags::UsesCommonValue, enable);
}
// Composes text from values of child properties.
@ -1348,25 +1453,35 @@ public:
#if WXWIN_COMPATIBILITY_3_0
// Returns non-zero if property has given flag set.
FlagType HasFlag( wxPGPropertyFlags flag ) const
wxDEPRECATED_MSG("use HasFlag() with 'flag' argument as wxPGPropertyFlags")
FlagType HasFlag( FlagType flag ) const
{
return ( m_flags & flag );
}
#else
// Returns true if property has given flag set.
bool HasFlag(wxPGPropertyFlags flag) const
{
return (m_flags & flag) != 0;
return ( static_cast<FlagType>(m_flags) & flag );
}
#endif
// Returns true if property has given flag set.
bool HasFlag(FlagType flag) const
bool HasFlag(wxPGPropertyFlags flag) const
{
return (m_flags & flag) != 0;
return !!(m_flags & flag);
}
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use HasFlag() with 'flag' argument as wxPGPropertyFlags")
// Returns true if property has given flag set.
bool HasFlag(int flag) const
{
return HasFlag(static_cast<wxPGPropertyFlags>(flag));
}
#endif // WXWIN_COMPATIBILITY_3_2
// Returns true if property has all given flags set.
bool HasFlagsExact(FlagType flags) const
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use HasFlagExact() with 'flags' argument as wxPGPropertyFlags")
bool HasFlagsExact(int flags) const
{
return HasFlagsExact(static_cast<wxPGPropertyFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
bool HasFlagsExact(wxPGPropertyFlags flags) const
{
return (m_flags & flags) == flags;
}
@ -1385,7 +1500,7 @@ public:
wxDEPRECATED_MSG("Use HasFlag or HasFlagsExact functions instead.")
FlagType GetFlags() const
{
return m_flags;
return static_cast<FlagType>(m_flags);
}
#endif
@ -1425,7 +1540,7 @@ public:
int InsertChoice( const wxString& label, int index, int value = wxPG_INVALID_VALUE );
// Returns true if this property is actually a wxPropertyCategory.
bool IsCategory() const { return (m_flags & wxPG_PROP_CATEGORY) != 0; }
bool IsCategory() const { return !!(m_flags & wxPGPropertyFlags::Category); }
// Returns true if this property is actually a wxRootProperty.
bool IsRoot() const { return (m_parent == nullptr); }
@ -1467,7 +1582,7 @@ public:
// Returns true if containing grid uses wxPG_EX_AUTO_UNSPECIFIED_VALUES.
bool UsesAutoUnspecified() const
{
return (m_flags & wxPG_PROP_AUTO_UNSPECIFIED) != 0;
return !!(m_flags & wxPGPropertyFlags::AutoUnspecified);
}
// Returns bitmap that appears next to value text. Only returns non-null
@ -1492,9 +1607,16 @@ public:
unsigned int GetDepth() const { return (unsigned int)m_depth; }
// Gets flags as a'|' delimited string. Note that flag names are not
// prepended with 'wxPG_PROP_'.
// prepended with 'wxPGPropertyFlags'.
// flagmask - String will only be made to include flags combined by this parameter.
wxString GetFlagsAsString( FlagType flagsMask ) const;
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use GetFlagsAsString() with 'flags' argument as wxPGPropertyFlags")
wxString GetFlagsAsString( int flagsMask ) const
{
return GetFlagsAsString(static_cast<wxPGPropertyFlags>(flagsMask));
}
#endif // WXWIN_COMPATIBILITY_3_2
wxString GetFlagsAsString(wxPGPropertyFlags flagsMask) const;
// Returns position in parent's array.
unsigned int GetIndexInParent() const
@ -1517,13 +1639,13 @@ public:
// Returns true if property has visible children.
bool IsExpanded() const
{ return (!(m_flags & wxPG_PROP_COLLAPSED) && HasAnyChild()); }
{ return (!(m_flags & wxPGPropertyFlags::Collapsed) && HasAnyChild()); }
// Returns true if all parents expanded.
bool IsVisible() const;
// Returns true if property is enabled.
bool IsEnabled() const { return !(m_flags & wxPG_PROP_DISABLED); }
bool IsEnabled() const { return !(m_flags & wxPGPropertyFlags::Disabled); }
// If property's editor is created this forces its recreation.
// Useful in SetAttribute etc. Returns true if actually did anything.
@ -1549,7 +1671,7 @@ public:
// by default).
void SetAutoUnspecified( bool enable = true )
{
ChangeFlag(wxPG_PROP_AUTO_UNSPECIFIED, enable);
ChangeFlag(wxPGPropertyFlags::AutoUnspecified, enable);
}
// Sets property's background colour.
@ -1624,13 +1746,13 @@ public:
}
// Sets flags from a '|' delimited string. Note that flag names are not
// prepended with 'wxPG_PROP_'.
// prepended with 'wxPGPropertyFlags'.
void SetFlagsFromString( const wxString& str );
// Sets property's "is it modified?" flag. Affects children recursively.
void SetModifiedStatus( bool modified )
{
SetFlagRecursively(wxPG_PROP_MODIFIED, modified);
SetFlagRecursively(wxPGPropertyFlags::Modified, modified);
}
// Call in OnEvent(), OnButtonClick() etc. to change the property value
@ -1671,14 +1793,14 @@ public:
void SetExpanded( bool expanded )
{
ChangeFlag(wxPG_PROP_COLLAPSED, !expanded);
ChangeFlag(wxPGPropertyFlags::Collapsed, !expanded);
}
// Sets or clears given property flag. Mainly for internal use.
// 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.
// Enable(false) instead of setting wxPGPropertyFlags::Disabled flag.
void ChangeFlag( wxPGPropertyFlags flag, bool set )
{
if ( set )
@ -1707,14 +1829,21 @@ public:
void SetName( const wxString& newName );
// Changes what sort of parent this property is for its children.
// flag - Use one of the following values: wxPG_PROP_MISC_PARENT (for
// generic parents), wxPG_PROP_CATEGORY (for categories), or
// wxPG_PROP_AGGREGATE (for derived property classes with private
// flag - Use one of the following values: wxPGPropertyFlags::MiscParent (for
// generic parents), wxPGPropertyFlags::Category (for categories), or
// wxPGPropertyFlags::Aggregate (for derived property classes with private
// children).
// You generally do not need to call this function.
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use SetParentalType() with 'flag' argument as wxPGPropertyFlags")
void SetParentalType(int flag)
{
m_flags &= ~(wxPG_PROP_PROPERTY|wxPG_PROP_PARENTAL_FLAGS);
SetParentalType(static_cast<wxPGPropertyFlags>(flag));
}
#endif // WXWIN_COMPATIBILITY_3_2
void SetParentalType(wxPGPropertyFlags flag)
{
m_flags &= ~(wxPGPropertyFlags::Property | wxPGPropertyFlags::ParentalFlags);
m_flags |= flag;
}
@ -1781,7 +1910,7 @@ public:
// (i.e. cancel 'true' returned by StringToValue() or IntToValue()).
void SetWasModified( bool set = true )
{
ChangeFlag(wxPG_PROP_WAS_MODIFIED, set);
ChangeFlag(wxPGPropertyFlags::WasModified, set);
}
// Returns property's help or description text.
@ -1801,7 +1930,7 @@ public:
// Adds a private child property. If you use this instead of
// wxPropertyGridInterface::Insert() or
// wxPropertyGridInterface::AppendIn(), then property's parental
// type will automatically be set up to wxPG_PROP_AGGREGATE. In other
// type will automatically be set up to wxPGPropertyFlags::Aggregate. In other
// words, all properties of this property will become private.
void AddPrivateChild( wxPGProperty* prop );
@ -1910,17 +2039,38 @@ protected:
// preparedCell.
// ignoreWithFlags - Properties with any one of these flags are skipped.
// recursively - If true, apply this operation recursively in child properties.
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use AdaptiveSetCell() with 'ignoreWithFlags' argument as wxPGPropertyFlags")
void AdaptiveSetCell( unsigned int firstCol,
unsigned int lastCol,
const wxPGCell& preparedCell,
const wxPGCell& srcData,
wxPGCellData* unmodCellData,
FlagType ignoreWithFlags,
int ignoreWithFlags,
bool recursively )
{
AdaptiveSetCell(firstCol, lastCol, preparedCell, srcData, unmodCellData,
static_cast<wxPGPropertyFlags>(ignoreWithFlags), recursively);
}
#endif // WXWIN_COMPATIBILITY_3_2
void AdaptiveSetCell(unsigned int firstCol,
unsigned int lastCol,
const wxPGCell& preparedCell,
const wxPGCell& srcData,
wxPGCellData* unmodCellData,
wxPGPropertyFlags ignoreWithFlags,
bool recursively);
// Clear cells associated with property.
// recursively - If true, apply this operation recursively in child properties.
void ClearCells(FlagType ignoreWithFlags, bool recursively);
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use ClearCells() with 'ignoreWithFlags' argument as wxPGPropertyFlags")
void ClearCells(int ignoreWithFlags, bool recursively)
{
ClearCells(static_cast<wxPGPropertyFlags>(ignoreWithFlags), recursively);
}
#endif // WXWIN_COMPATIBILITY_3_2
void ClearCells(wxPGPropertyFlags ignoreWithFlags, bool recursively);
// Makes sure m_cells has size of column+1 (or more).
void EnsureCells( unsigned int column );
@ -1989,7 +2139,17 @@ protected:
m_flags |= flag;
}
void ClearFlag( FlagType flag ) { m_flags &= ~(flag); }
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use ClearFlag() with 'flag' argument as wxPGPropertyFlags")
void ClearFlag( int flag )
{
ClearFlag(static_cast<wxPGPropertyFlags>(flag));
}
#endif // WXWIN_COMPATIBILITY_3_2
void ClearFlag(wxPGPropertyFlags flag)
{
m_flags &= ~(flag);
}
// Called when the property is being removed from the grid and/or
// page state (but *not* when it is also deleted).
@ -2041,7 +2201,7 @@ protected:
// If not -1, then overrides m_value
int m_commonValue;
FlagType m_flags;
wxPGPropertyFlags m_flags;
// Maximum length (for string properties). Could be in some sort of
// wxBaseStringProperty, but currently, for maximum flexibility and

View file

@ -250,7 +250,7 @@ wxPG_EX_HELP_AS_TOOLTIPS = 0x00010000,
wxPG_EX_NATIVE_DOUBLE_BUFFERING = 0x00080000,
// Set this style to let user have ability to set values of properties to
// unspecified state. Same as setting wxPG_PROP_AUTO_UNSPECIFIED for
// unspecified state. Same as setting wxPGPropertyFlags::AutoUnspecified for
// all properties.
wxPG_EX_AUTO_UNSPECIFIED_VALUES = 0x00200000,
@ -1300,10 +1300,10 @@ public:
// Called to indicate property and editor has valid value now.
void OnValidationFailureReset( wxPGProperty* property )
{
if ( property && property->HasFlag(wxPG_PROP_INVALID_VALUE) )
if ( property && property->HasFlag(wxPGPropertyFlags::InvalidValue) )
{
DoOnValidationFailureReset(property);
property->ClearFlag(wxPG_PROP_INVALID_VALUE);
property->ClearFlag(wxPGPropertyFlags::InvalidValue);
}
m_validationInfo.ClearFailureMessage();
}
@ -1337,7 +1337,7 @@ public:
wxVariant& invalidValue );
// Override to customize resetting of property validation failure status.
// Property is guaranteed to have flag wxPG_PROP_INVALID_VALUE set.
// Property is guaranteed to have flag wxPGPropertyFlags::InvalidValue set.
virtual void DoOnValidationFailureReset( wxPGProperty* property );
int GetSpacingY() const { return m_spacingy; }

View file

@ -331,7 +331,7 @@ public:
{
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullProperty)
if ( !p->HasAnyChild() || p->HasFlag(wxPG_PROP_AGGREGATE) )
if ( !p->HasAnyChild() || p->HasFlag(wxPGPropertyFlags::Aggregate) )
return wxNullProperty;
return p->Item(0);
@ -410,8 +410,20 @@ public:
// only properties without given flags are stored.
// flags - Property flags to use.
// iterFlags - Iterator flags to use. Default is everything expect private children.
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use GetPropertiesWithFlag() with 'flags' argument as wxPGPropertyFlags")
void GetPropertiesWithFlag( wxArrayPGProperty* targetArr,
wxPGProperty::FlagType flags,
int flags,
bool inverse = false,
int iterFlags = wxPG_ITERATE_PROPERTIES |
wxPG_ITERATE_HIDDEN |
wxPG_ITERATE_CATEGORIES) const
{
GetPropertiesWithFlag(targetArr, static_cast<wxPGPropertyFlags>(flags), inverse, iterFlags);
}
#endif // WXWIN_COMPATIBILITY_3_2
void GetPropertiesWithFlag(wxArrayPGProperty* targetArr,
wxPGPropertyFlags flags,
bool inverse = false,
int iterFlags = wxPG_ITERATE_PROPERTIES |
wxPG_ITERATE_HIDDEN |
@ -652,7 +664,7 @@ public:
bool IsPropertyEnabled( wxPGPropArg id ) const
{
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
return !p->HasFlag(wxPG_PROP_DISABLED);
return !p->HasFlag(wxPGPropertyFlags::Disabled);
}
// Returns true if given property is expanded.
@ -664,11 +676,7 @@ public:
bool IsPropertyModified( wxPGPropArg id ) const
{
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
#if WXWIN_COMPATIBILITY_3_0
return p->HasFlag(wxPG_PROP_MODIFIED)?true:false;
#else
return p->HasFlag(wxPG_PROP_MODIFIED);
#endif
return p->HasFlag(wxPGPropertyFlags::Modified);
}
// Returns true if property is selected.
@ -683,7 +691,7 @@ public:
bool IsPropertyShown( wxPGPropArg id ) const
{
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
return !p->HasFlag(wxPG_PROP_HIDDEN);
return !p->HasFlag(wxPGPropertyFlags::Hidden);
}
// Returns true if property value is set to unspecified.

View file

@ -213,54 +213,54 @@ enum wxPG_ITERATOR_FLAGS
// Iterate through 'normal' property items (does not include children of
// aggregate or hidden items by default).
wxPG_ITERATE_PROPERTIES = wxPG_PROP_PROPERTY |
wxPG_PROP_MISC_PARENT |
wxPG_PROP_AGGREGATE |
wxPG_PROP_COLLAPSED |
wxPG_IT_CHILDREN(wxPG_PROP_MISC_PARENT) |
wxPG_IT_CHILDREN(wxPG_PROP_CATEGORY),
wxPG_ITERATE_PROPERTIES = wxPGPropertyFlags::Property |
wxPGPropertyFlags::MiscParent |
wxPGPropertyFlags::Aggregate |
wxPGPropertyFlags::Collapsed |
wxPG_IT_CHILDREN(wxPGPropertyFlags::MiscParent) |
wxPG_IT_CHILDREN(wxPGPropertyFlags::Category),
// Iterate children of collapsed parents, and individual items that are hidden.
wxPG_ITERATE_HIDDEN = wxPG_PROP_HIDDEN |
wxPG_IT_CHILDREN(wxPG_PROP_COLLAPSED),
wxPG_ITERATE_HIDDEN = wxPGPropertyFlags::Hidden |
wxPG_IT_CHILDREN(wxPGPropertyFlags::Collapsed),
// Iterate children of parent that is an aggregate property (ie has fixed
// children).
wxPG_ITERATE_FIXED_CHILDREN = wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE) |
wxPG_ITERATE_FIXED_CHILDREN = wxPG_IT_CHILDREN(wxPGPropertyFlags::Aggregate) |
wxPG_ITERATE_PROPERTIES,
// Iterate categories.
// Note that even without this flag, children of categories are still iterated
// through.
wxPG_ITERATE_CATEGORIES = wxPG_PROP_CATEGORY |
wxPG_IT_CHILDREN(wxPG_PROP_CATEGORY) |
wxPG_PROP_COLLAPSED,
wxPG_ITERATE_CATEGORIES = wxPGPropertyFlags::Category |
wxPG_IT_CHILDREN(wxPGPropertyFlags::Category) |
wxPGPropertyFlags::Collapsed,
wxPG_ITERATE_ALL_PARENTS = wxPG_PROP_MISC_PARENT |
wxPG_PROP_AGGREGATE |
wxPG_PROP_CATEGORY,
wxPG_ITERATE_ALL_PARENTS = static_cast<int>(wxPGPropertyFlags::MiscParent |
wxPGPropertyFlags::Aggregate |
wxPGPropertyFlags::Category),
wxPG_ITERATE_ALL_PARENTS_RECURSIVELY = wxPG_ITERATE_ALL_PARENTS |
wxPG_IT_CHILDREN(
wxPG_ITERATE_ALL_PARENTS),
wxPG_ITERATOR_FLAGS_ALL = wxPG_PROP_PROPERTY |
wxPG_PROP_MISC_PARENT |
wxPG_PROP_AGGREGATE |
wxPG_PROP_HIDDEN |
wxPG_PROP_CATEGORY |
wxPG_PROP_COLLAPSED,
wxPG_ITERATOR_FLAGS_ALL = static_cast<int>(wxPGPropertyFlags::Property |
wxPGPropertyFlags::MiscParent |
wxPGPropertyFlags::Aggregate |
wxPGPropertyFlags::Hidden |
wxPGPropertyFlags::Category |
wxPGPropertyFlags::Collapsed),
wxPG_ITERATOR_MASK_OP_ITEM = wxPG_ITERATOR_FLAGS_ALL,
// (wxPG_PROP_MISC_PARENT|wxPG_PROP_AGGREGATE|wxPG_PROP_CATEGORY)
// (wxPGPropertyFlags::MiscParent|wxPGPropertyFlags::Aggregate|wxPGPropertyFlags::Category)
wxPG_ITERATOR_MASK_OP_PARENT = wxPG_ITERATOR_FLAGS_ALL,
// Combines all flags needed to iterate through visible properties
// (ie. hidden properties and children of collapsed parents are skipped).
wxPG_ITERATE_VISIBLE = static_cast<int>(wxPG_ITERATE_PROPERTIES) |
wxPG_PROP_CATEGORY |
wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE),
wxPG_ITERATE_VISIBLE = wxPG_ITERATE_PROPERTIES |
wxPGPropertyFlags::Category |
wxPG_IT_CHILDREN(wxPGPropertyFlags::Aggregate),
// Iterate all items.
wxPG_ITERATE_ALL = wxPG_ITERATE_VISIBLE |
@ -278,10 +278,10 @@ wxPG_ITERATE_DEFAULT = wxPG_ITERATE_NORMAL
#define wxPG_ITERATOR_CREATE_MASKS(FLAGS, A, B) \
A = (FLAGS ^ wxPG_ITERATOR_MASK_OP_ITEM) & \
wxPG_ITERATOR_MASK_OP_ITEM & 0xFFFF; \
B = ((FLAGS>>16) ^ wxPG_ITERATOR_MASK_OP_PARENT) & \
wxPG_ITERATOR_MASK_OP_PARENT & 0xFFFF;
A = static_cast<wxPGPropertyFlags>((FLAGS ^ wxPG_ITERATOR_MASK_OP_ITEM) & \
wxPG_ITERATOR_MASK_OP_ITEM & 0xFFFF); \
B = static_cast<wxPGPropertyFlags>(((FLAGS>>16) ^ wxPG_ITERATOR_MASK_OP_PARENT) & \
wxPG_ITERATOR_MASK_OP_PARENT & 0xFFFF);
// Macro to test if children of PWC should be iterated through
@ -337,8 +337,8 @@ private:
wxPGProperty* m_baseParent;
// Masks are used to quickly exclude items
wxPGProperty::FlagType m_itemExMask;
wxPGProperty::FlagType m_parentExMask;
wxPGPropertyFlags m_itemExMask;
wxPGPropertyFlags m_parentExMask;
};
template <typename PROPERTY, typename STATE>
@ -640,7 +640,7 @@ protected:
void DoLimitPropertyEditing(wxPGProperty* p, bool limit = true)
{
p->SetFlagRecursively(wxPG_PROP_NOEDITOR, limit);
p->SetFlagRecursively(wxPGPropertyFlags::NoEditor, limit);
}
bool DoSelectProperty(wxPGProperty* p, wxPGSelectPropertyFlags flags = wxPGSelectPropertyFlags::Null);

View file

@ -335,8 +335,8 @@ public:
#if WXWIN_COMPATIBILITY_3_2
// If set, then selection of choices is static and should not be
// changed (i.e. returns nullptr in GetPropertyChoices).
wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_STATIC_CHOICES is intended for internal use.")
constexpr wxPGPropertyFlags wxPG_PROP_STATIC_CHOICES = wxPG_PROP_RESERVED_1;
wxDEPRECATED_MSG("wxPG_PROP_STATIC_CHOICES is intended for internal use.")
constexpr wxPGPropertyFlags wxPG_PROP_STATIC_CHOICES = wxPGPropertyFlags::Reserved_1;
#endif // WXWIN_COMPATIBILITY_3_2
// Represents a single selection from a list of choices
@ -581,8 +581,8 @@ protected:
#if WXWIN_COMPATIBILITY_3_2
// Indicates first bit usable by derived properties.
wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_SHOW_FULL_FILENAME is intended for internal use.")
constexpr wxPGPropertyFlags wxPG_PROP_SHOW_FULL_FILENAME = wxPG_PROP_RESERVED_1;
wxDEPRECATED_MSG("wxPG_PROP_SHOW_FULL_FILENAME is intended for internal use.")
constexpr wxPGPropertyFlags wxPG_PROP_SHOW_FULL_FILENAME = wxPGPropertyFlags::Reserved_1;
#endif // WXWIN_COMPATIBILITY_3_2
// Like wxLongStringProperty, but the button triggers file selector instead.
@ -623,8 +623,8 @@ protected:
#if WXWIN_COMPATIBILITY_3_2
// Flag used in wxLongStringProperty to mark that edit button
// should be enabled even in the read-only mode.
wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_ACTIVE_BTN is intended for internal use.")
constexpr wxPGPropertyFlags wxPG_PROP_ACTIVE_BTN = wxPG_PROP_RESERVED_3;
wxDEPRECATED_MSG("wxPG_PROP_ACTIVE_BTN is intended for internal use.")
constexpr wxPGPropertyFlags wxPG_PROP_ACTIVE_BTN = wxPGPropertyFlags::Reserved_3;
#endif // WXWIN_COMPATIBILITY_3_2
// Like wxStringProperty, but has a button that triggers a small text

View file

@ -235,44 +235,47 @@ struct wxPGPaintData
@{
*/
enum wxPGPropertyFlags
enum class wxPGPropertyFlags : int
{
/** No flags.
@hideinitializer
*/
Null = 0,
/** Indicates bold font.
@hideinitializer
*/
wxPG_PROP_MODIFIED = 0x0001,
Modified = 0x0001,
/** Disables ('greyed' text and editor does not activate) property.
@hideinitializer
*/
wxPG_PROP_DISABLED = 0x0002,
Disabled = 0x0002,
/** Hider button will hide this property.
@hideinitializer
*/
wxPG_PROP_HIDDEN = 0x0004,
Hidden = 0x0004,
/** This property has custom paint image just in front of its value.
If property only draws custom images into a popup list, then this
flag should not be set.
@hideinitializer
*/
wxPG_PROP_CUSTOMIMAGE = 0x0008,
CustomImage = 0x0008,
/** Do not create text based editor for this property (but button-triggered
dialog and choice are ok).
@hideinitializer
*/
wxPG_PROP_NOEDITOR = 0x0010,
NoEditor = 0x0010,
/** Property is collapsed, ie. it's children are hidden.
@hideinitializer
*/
wxPG_PROP_COLLAPSED = 0x0020,
Collapsed = 0x0020,
/**
If property is selected, then indicates that validation failed for pending
/** If property is selected, then indicates that validation failed for pending
value.
If property is not selected, then indicates that the actual property
@ -280,55 +283,52 @@ wxPG_PROP_COLLAPSED = 0x0020,
but may be used in the future).
@hideinitializer
*/
wxPG_PROP_INVALID_VALUE = 0x0040,
InvalidValue = 0x0040,
/** Switched via SetWasModified(). Temporary flag - only used when
setting/changing property value.
@hideinitializer
*/
wxPG_PROP_WAS_MODIFIED = 0x0200,
WasModified = 0x0200,
/**
If set, then child properties (if any) are private, and should be
/** If set, then child properties (if any) are private, and should be
"invisible" to the application.
@hideinitializer
*/
wxPG_PROP_AGGREGATE = 0x0400,
Aggregate = 0x0400,
/** If set, then child properties (if any) are copies and should not
be deleted in dtor.
@hideinitializer
*/
wxPG_PROP_CHILDREN_ARE_COPIES = 0x0800,
/**
Classifies this item as a non-category.
ChildrenAreCopies = 0x0800,
/** Classifies this item as a non-category.
Used for faster item type identification.
@hideinitializer
*/
wxPG_PROP_PROPERTY = 0x1000,
Property = 0x1000,
/**
Classifies this item as a category.
/** Classifies this item as a category.
Used for faster item type identification.
@hideinitializer
*/
wxPG_PROP_CATEGORY = 0x2000,
Category = 0x2000,
/** Classifies this item as a property that has children, but is not aggregate
(i.e. children are not private).
@hideinitializer
*/
wxPG_PROP_MISC_PARENT = 0x4000,
MiscParent = 0x4000,
/** Property is read-only. Editor is still created for wxTextCtrl-based
property editors. For others, editor is not usually created because
they do implement wxTE_READONLY style or equivalent.
@hideinitializer
*/
wxPG_PROP_READONLY = 0x8000,
ReadOnly = 0x8000,
//
// NB: FLAGS ABOVE 0x8000 CANNOT BE USED WITH PROPERTY ITERATORS
@ -339,14 +339,14 @@ wxPG_PROP_READONLY = 0x8000,
This flag cannot be used with property iterators.
@hideinitializer
*/
wxPG_PROP_COMPOSED_VALUE = 0x00010000,
ComposedValue = 0x00010000,
/** Common value of property is selectable in editor.
@remarks
This flag cannot be used with property iterators.
@hideinitializer
*/
wxPG_PROP_USES_COMMON_VALUE = 0x00020000,
UsesCommonValue = 0x00020000,
/** Property can be set to unspecified value via editor.
Currently, this applies to following properties:
@ -359,32 +359,38 @@ wxPG_PROP_USES_COMMON_VALUE = 0x00020000,
@see wxPGProperty::SetAutoUnspecified()
@hideinitializer
*/
wxPG_PROP_AUTO_UNSPECIFIED = 0x00040000,
/** Indicates that the property is being deleted and should be ignored.
@remarks
This flag cannot be used with property iterators.
@hideinitializer
*/
wxPG_PROP_BEING_DELETED = 0x00200000
};
BeingDeleted = 0x00080000,
/** If set, full path is shown in wxFileProperty.
@remarks
This flag cannot be used with property iterators.
@hideinitializer
*/
ShowFullFileName = 0x00100000,
/** Topmost flag.
@hideinitializer
*/
constexpr wxPGPropertyFlags wxPG_PROP_MAX = wxPG_PROP_AUTO_UNSPECIFIED;
Max = ShowFullFileName,
/** Property with children must have one of these set, otherwise iterators
will not work correctly.
Code should automatically take care of this, however.
@hideinitializer
*/
#define wxPG_PROP_PARENTAL_FLAGS \
((wxPGPropertyFlags)(wxPG_PROP_AGGREGATE | \
wxPG_PROP_CATEGORY | \
wxPG_PROP_MISC_PARENT))
ParentalFlags = Aggregate | Category | MiscParent,
/** Combination of flags that can be stored by GetFlagsAsString().
@hideinitializer
*/
#define wxPG_STRING_STORED_FLAGS \
(wxPG_PROP_DISABLED|wxPG_PROP_HIDDEN|wxPG_PROP_NOEDITOR|wxPG_PROP_COLLAPSED)
StringStoredFlags = Disabled | Hidden | NoEditor | Collapsed
};
/** @}
*/
@ -591,13 +597,6 @@ constexpr wxPGPropertyFlags wxPG_PROP_MAX = wxPG_PROP_AUTO_UNSPECIFIED;
}
@endcode
Also, if you wish not to have line breaks and tabs translated to
escape sequences, then do following in constructor of your subclass:
@code
m_flags |= wxPG_PROP_NO_ESCAPE;
@endcode
Supported special attributes:
- ::wxPG_DIALOG_TITLE: Sets a specific title for the text editor dialog.
@ -867,8 +866,6 @@ constexpr wxPGPropertyFlags wxPG_PROP_MAX = wxPG_PROP_AUTO_UNSPECIFIED;
class wxPGProperty : public wxObject
{
public:
typedef wxUint32 FlagType;
/**
Virtual destructor. It is customary for derived properties to implement this.
*/
@ -1285,8 +1282,8 @@ public:
Adds a private child property. If you use this instead of
wxPropertyGridInterface::Insert() or
wxPropertyGridInterface::AppendIn(), then property's parental
type will automatically be set up to ::wxPG_PROP_AGGREGATE. In other
words, all properties of this property will become private.
type will automatically be set up to wxPGPropertyFlags::Aggregate.
In other words, all properties of this property will become private.
*/
void AddPrivateChild( wxPGProperty* prop );
@ -1331,7 +1328,7 @@ public:
intended almost exclusively for internal use. So, for
example, if you want to disable a property, call
@code Enable(false) @endcode instead of setting
::wxPG_PROP_DISABLED flag.
wxPGPropertyFlags::Disabled flag.
@see HasFlag(), GetFlags()
*/
@ -1549,12 +1546,12 @@ public:
const wxString& GetHelpString() const;
/** Gets flags as a'|' delimited string. Note that flag names are not
prepended with 'wxPG_PROP_'.
prepended with 'wxPGPropertyFlags'.
@param flagsMask
String will only be made to include flags combined by this parameter.
*/
wxString GetFlagsAsString( FlagType flagsMask ) const;
wxString GetFlagsAsString(wxPGPropertyFlags flagsMask) const;
/**
Returns position in parent's array.
@ -1667,15 +1664,10 @@ public:
*/
bool HasFlag(wxPGPropertyFlags flag) const;
/**
Returns @true if property has given flag set.
*/
bool HasFlag(FlagType flag) const;
/**
Returns @true if property has all given flags set.
*/
bool HasFlagsExact(FlagType flags) const;
bool HasFlagsExact(wxPGPropertyFlags flags) const;
/**
Returns @true if property has even one visible child.
@ -1912,7 +1904,7 @@ public:
void SetExpanded( bool expanded );
/** Sets flags from a '|' delimited string. Note that flag names are not
prepended with 'wxPG_PROP_'.
prepended with 'wxPGPropertyFlags'.
*/
void SetFlagsFromString( const wxString& str );
@ -1971,14 +1963,14 @@ public:
Changes what sort of parent this property is for its children.
@param flag
Use one of the following values: ::wxPG_PROP_MISC_PARENT (for generic
parents), ::wxPG_PROP_CATEGORY (for categories), or
::wxPG_PROP_AGGREGATE (for derived property classes with private
children).
Use one of the following values: wxPGPropertyFlags::MiscParent (for
generic parents), wxPGPropertyFlags::Category (for categories), or
wxPGPropertyFlags::Aggregate (for derived property classes with
private children).
@remarks You generally do not need to call this function.
*/
void SetParentalType( int flag );
void SetParentalType(wxPGPropertyFlags flag);
/**
Sets property's text colour.
@ -2157,7 +2149,7 @@ protected:
const wxPGCell& preparedCell,
const wxPGCell& srcData,
wxPGCellData* unmodCellData,
FlagType ignoreWithFlags,
wxPGPropertyFlags ignoreWithFlags,
bool recursively );
/**
@ -2171,7 +2163,7 @@ protected:
@since 3.1.0
*/
void ClearCells(FlagType ignoreWithFlags, bool recursively);
void ClearCells(wxPGPropertyFlags ignoreWithFlags, bool recursively);
/**
Makes sure m_cells has size of column+1 (or more).

View file

@ -166,8 +166,8 @@ wxPG_EX_NATIVE_DOUBLE_BUFFERING = 0x00080000,
/**
Set this style to let user have ability to set values of properties to
unspecified state. Same as setting wxPG_PROP_AUTO_UNSPECIFIED for
all properties.
unspecified state. Same as setting wxPGPropertyFlags::AutoUnspecified
for all properties.
@hideinitializer
*/
wxPG_EX_AUTO_UNSPECIFIED_VALUES = 0x00200000,
@ -897,7 +897,8 @@ public:
Note that @a column must not be equal to 1, as the second column is
always editable and can be made read-only only on cell-by-cell basis
using @code wxPGProperty::ChangeFlag(wxPG_PROP_READONLY, true) @endcode
using
@code wxPGProperty::ChangeFlag(wxPGPropertyFlags::ReadOnly, true) @endcode
@see BeginLabelEdit(), EndLabelEdit()
*/
@ -1200,7 +1201,7 @@ public:
/** Override to customize resetting of property validation failure status.
@remarks
Property is guaranteed to have flag ::wxPG_PROP_INVALID_VALUE set.
Property is guaranteed to have flag wxPGPropertyFlags::InvalidValue set.
*/
virtual void DoOnValidationFailureReset( wxPGProperty* property );

View file

@ -368,7 +368,7 @@ public:
See @ref propgrid_iterator_flags.
*/
void GetPropertiesWithFlag( wxArrayPGProperty* targetArr,
wxPGProperty::FlagType flags,
wxPGPropertyFlags flags,
bool inverse = false,
int iterFlags = (wxPG_ITERATE_PROPERTIES|wxPG_ITERATE_HIDDEN|wxPG_ITERATE_CATEGORIES) ) const;

View file

@ -120,26 +120,26 @@ enum wxPG_ITERATOR_FLAGS
aggregate or hidden items by default).
@hideinitializer
*/
wxPG_ITERATE_PROPERTIES = wxPG_PROP_PROPERTY |
wxPG_PROP_MISC_PARENT |
wxPG_PROP_AGGREGATE |
wxPG_PROP_COLLAPSED |
wxPG_IT_CHILDREN(wxPG_PROP_MISC_PARENT) |
wxPG_IT_CHILDREN(wxPG_PROP_CATEGORY),
wxPG_ITERATE_PROPERTIES = wxPGPropertyFlags::Property |
wxPGPropertyFlags::MiscParent |
wxPGPropertyFlags::Aggregate |
wxPGPropertyFlags::Collapsed |
wxPG_IT_CHILDREN(wxPGPropertyFlags::MiscParent) |
wxPG_IT_CHILDREN(wxPGPropertyFlags::Category),
/**
Iterate children of collapsed parents, and individual items that are hidden.
@hideinitializer
*/
wxPG_ITERATE_HIDDEN = wxPG_PROP_HIDDEN |
wxPG_IT_CHILDREN(wxPG_PROP_COLLAPSED),
wxPG_ITERATE_HIDDEN = wxPGPropertyFlags::Hidden |
wxPG_IT_CHILDREN(wxPGPropertyFlags::Collapsed),
/**
Iterate children of parent that is an aggregate property (ie has fixed
children).
@hideinitializer
*/
wxPG_ITERATE_FIXED_CHILDREN = wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE) |
wxPG_ITERATE_FIXED_CHILDREN = wxPG_IT_CHILDREN(wxPGPropertyFlags::Aggregate) |
wxPG_ITERATE_PROPERTIES,
/** Iterate categories.
@ -147,16 +147,16 @@ wxPG_ITERATE_FIXED_CHILDREN = wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE) |
through.
@hideinitializer
*/
wxPG_ITERATE_CATEGORIES = wxPG_PROP_CATEGORY |
wxPG_IT_CHILDREN(wxPG_PROP_CATEGORY) |
wxPG_PROP_COLLAPSED,
wxPG_ITERATE_CATEGORIES = wxPGPropertyFlags::Category |
wxPG_IT_CHILDREN(wxPGPropertyFlags::Category) |
wxPGPropertyFlags::Collapsed,
/**
@hideinitializer
*/
wxPG_ITERATE_ALL_PARENTS = wxPG_PROP_MISC_PARENT |
wxPG_PROP_AGGREGATE |
wxPG_PROP_CATEGORY,
wxPG_ITERATE_ALL_PARENTS = wxPGPropertyFlags::MiscParent |
wxPGPropertyFlags::Aggregate |
wxPGPropertyFlags::Category,
/**
@hideinitializer
@ -168,19 +168,18 @@ wxPG_ITERATE_ALL_PARENTS_RECURSIVELY = wxPG_ITERATE_ALL_PARENTS |
/**
@hideinitializer
*/
wxPG_ITERATOR_FLAGS_ALL = wxPG_PROP_PROPERTY |
wxPG_PROP_MISC_PARENT |
wxPG_PROP_AGGREGATE |
wxPG_PROP_HIDDEN |
wxPG_PROP_CATEGORY |
wxPG_PROP_COLLAPSED,
wxPG_ITERATOR_FLAGS_ALL = wxPGPropertyFlags::Property |
wxPGPropertyFlags::MiscParent |
wxPGPropertyFlags::Aggregate |
wxPGPropertyFlags::Hidden |
wxPGPropertyFlags::Category |
wxPGPropertyFlags::Collapsed,
/**
@hideinitializer
*/
wxPG_ITERATOR_MASK_OP_ITEM = wxPG_ITERATOR_FLAGS_ALL,
// (wxPG_PROP_MISC_PARENT|wxPG_PROP_AGGREGATE|wxPG_PROP_CATEGORY)
/**
@hideinitializer
*/
@ -192,8 +191,8 @@ wxPG_ITERATOR_MASK_OP_PARENT = wxPG_ITERATOR_FLAGS_ALL,
@hideinitializer
*/
wxPG_ITERATE_VISIBLE = wxPG_ITERATE_PROPERTIES |
wxPG_PROP_CATEGORY |
wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE),
wxPGPropertyFlags::Category |
wxPG_IT_CHILDREN(wxPGPropertyFlags::Aggregate),
/**
Iterate all items.

View file

@ -758,14 +758,6 @@ void wxFontProperty::OnCustomPaint(wxDC& dc,
// wxSystemColourProperty
// -----------------------------------------------------------------------
#if WXWIN_COMPATIBILITY_3_2
// wxEnumProperty based classes cannot use wxPG_PROP_RESERVED_1
wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_HIDE_CUSTOM_COLOUR is intended for internal use.")
constexpr wxPGPropertyFlags wxPG_PROP_HIDE_CUSTOM_COLOUR = wxPG_PROP_RESERVED_2;
wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_COLOUR_HAS_ALPHA is intended for internal use.")
constexpr wxPGPropertyFlags wxPG_PROP_COLOUR_HAS_ALPHA = wxPG_PROP_RESERVED_3;
#endif // if WXWIN_COMPATIBILITY_3_2
#include "wx/colordlg.h"
static const char* const gs_cp_es_syscolour_labels[] = {
@ -846,7 +838,7 @@ void wxSystemColourProperty::Init( int type, const wxColour& colour )
cpv.Init(type, colour.IsOk() ? colour : *wxWHITE);
m_flags |= wxPG_PROP_STATIC_CHOICES; // Colour selection cannot be changed.
m_flags |= wxPGPropertyFlags_StaticChoices; // Colour selection cannot be changed.
m_value = WXVARIANT(cpv);
@ -1024,7 +1016,7 @@ void wxSystemColourProperty::OnSetValue()
}
if ( cpv.m_type < wxPG_COLOUR_WEB_BASE ||
(m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) )
!!(m_flags & wxPGPropertyFlags_HideCustomColour) )
{
ind = GetIndexForValue(cpv.m_type);
}
@ -1049,7 +1041,7 @@ void wxSystemColourProperty::OnSetValue()
ind = ColToInd(col);
if ( ind == wxNOT_FOUND &&
!(m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) )
!(m_flags & wxPGPropertyFlags_HideCustomColour) )
ind = GetCustomColourIndex();
}
@ -1070,7 +1062,7 @@ wxString wxSystemColourProperty::ColourToString( const wxColour& col,
if ( index == wxNOT_FOUND )
{
if ( (argFlags & wxPG_FULL_VALUE) || (m_flags & wxPG_PROP_COLOUR_HAS_ALPHA) )
if ( (argFlags & wxPG_FULL_VALUE) || !!(m_flags & wxPGPropertyFlags_ColourHasAlpha) )
{
return wxString::Format(wxS("(%i,%i,%i,%i)"),
(int)col.Red(),
@ -1108,7 +1100,7 @@ wxString wxSystemColourProperty::ValueToString( wxVariant& value,
// If custom colour was selected, use invalid index, so that
// ColourToString() will return properly formatted colour text.
if ( index == GetCustomColourIndex() &&
!(m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) )
!(m_flags & wxPGPropertyFlags_HideCustomColour) )
index = wxNOT_FOUND;
}
else
@ -1150,7 +1142,7 @@ bool wxSystemColourProperty::QueryColourFromUser( wxVariant& variant ) const
wxColourData data;
data.SetChooseFull(true);
data.SetChooseAlpha((m_flags & wxPG_PROP_COLOUR_HAS_ALPHA) != 0);
data.SetChooseAlpha(!!(m_flags & wxPGPropertyFlags_ColourHasAlpha));
data.SetColour(val.m_colour);
for ( int i = 0; i < wxColourData::NUM_CUSTOM; i++ )
{
@ -1223,7 +1215,7 @@ bool wxSystemColourProperty::OnEvent( wxPropertyGrid* propgrid,
int index = cb->GetSelection();
if ( index == GetCustomColourIndex() &&
!(m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) )
!(m_flags & wxPGPropertyFlags_HideCustomColour) )
askColour = true;
}
}
@ -1249,7 +1241,7 @@ public:
dc.SetPen(*wxBLACK_PEN);
if ( item >= 0 &&
( item < (int)(GetCustomColourIndex) || (prop->HasFlag(wxPG_PROP_HIDE_CUSTOM_COLOUR)))
( item < (int)(GetCustomColourIndex) || (prop->HasFlag(wxPGPropertyFlags_HideCustomColour)))
)
{
int colInd;
@ -1297,7 +1289,7 @@ void wxSystemColourProperty::OnCustomPaint( wxDC& dc, const wxRect& rect,
if ( paintdata.m_choiceItem >= 0 &&
paintdata.m_choiceItem < (int)m_choices.GetCount() &&
(paintdata.m_choiceItem != GetCustomColourIndex() ||
m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) )
!!(m_flags & wxPGPropertyFlags_HideCustomColour)) )
{
int colInd = m_choices[paintdata.m_choiceItem].GetValue();
col = GetColour( colInd );
@ -1396,7 +1388,7 @@ bool wxSystemColourProperty::StringToValue( wxVariant& value, const wxString& te
}
if ( !conversionSuccess && m_choices.GetCount() &&
!(m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) &&
!(m_flags & wxPGPropertyFlags_HideCustomColour) &&
isCustomColour )
{
if ( !(argFlags & wxPG_EDITABLE_VALUE ))
@ -1463,24 +1455,24 @@ bool wxSystemColourProperty::DoSetAttribute( const wxString& name, wxVariant& va
{
bool allow = value.GetBool();
if ( allow && (m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) )
if ( allow && !!(m_flags & wxPGPropertyFlags_HideCustomColour) )
{
// Show custom choice
/* TRANSLATORS: Custom colour choice entry */
m_choices.Add(_("Custom"), wxPG_COLOUR_CUSTOM);
m_flags &= ~(wxPG_PROP_HIDE_CUSTOM_COLOUR);
m_flags &= ~(wxPGPropertyFlags_HideCustomColour);
}
else if ( !allow && !(m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) )
else if ( !allow && !(m_flags & wxPGPropertyFlags_HideCustomColour) )
{
// Hide custom choice
m_choices.RemoveAt(GetCustomColourIndex());
m_flags |= wxPG_PROP_HIDE_CUSTOM_COLOUR;
m_flags |= wxPGPropertyFlags_HideCustomColour;
}
return true;
}
else if ( name == wxPG_COLOUR_HAS_ALPHA )
{
ChangeFlag(wxPG_PROP_COLOUR_HAS_ALPHA, value.GetBool());
ChangeFlag(wxPGPropertyFlags_ColourHasAlpha, value.GetBool());
return true;
}
return wxEnumProperty::DoSetAttribute(name, value);
@ -1594,7 +1586,7 @@ wxColourProperty::wxColourProperty( const wxString& label,
Init( value );
m_flags |= wxPG_PROP_TRANSLATE_CUSTOM;
m_flags |= wxPGPropertyFlags_TranslateCustom;
}
void wxColourProperty::Init( wxColour colour )
@ -1716,7 +1708,7 @@ wxCursorProperty::wxCursorProperty( const wxString& label, const wxString& name,
&gs_wxCursorProperty_choicesCache,
value )
{
m_flags |= wxPG_PROP_STATIC_CHOICES; // Cursor selection cannot be changed.
m_flags |= wxPGPropertyFlags_StaticChoices; // Cursor selection cannot be changed.
}
wxString wxCursorProperty::ValueToString(wxVariant& value, int argFlags) const

View file

@ -192,7 +192,7 @@ void wxPGEditor::SetControlAppearance( wxPropertyGrid* pg,
else if ( oCell.HasText() )
{
tcText = property->GetValueAsString(
property->HasFlag(wxPG_PROP_READONLY)?0:wxPG_EDITABLE_VALUE);
property->HasFlag(wxPGPropertyFlags::ReadOnly)?0:wxPG_EDITABLE_VALUE);
changeText = true;
}
@ -280,18 +280,18 @@ wxPGWindowList wxPGTextCtrlEditor::CreateControls( wxPropertyGrid* propGrid,
//
// If has children, and limited editing is specified, then don't create.
if ( property->HasFlag(wxPG_PROP_NOEDITOR) &&
if ( property->HasFlag(wxPGPropertyFlags::NoEditor) &&
property->HasAnyChild() )
return nullptr;
int argFlags = 0;
if ( !property->HasFlag(wxPG_PROP_READONLY) &&
if ( !property->HasFlag(wxPGPropertyFlags::ReadOnly) &&
!property->IsValueUnspecified() )
argFlags |= wxPG_EDITABLE_VALUE;
text = property->GetValueAsString(argFlags);
int flags = 0;
if ( property->HasFlag(wxPG_PROP_PASSWORD) &&
if ( property->HasFlag(wxPGPropertyFlags_Password) &&
wxDynamicCast(property, wxStringProperty) )
flags |= wxTE_PASSWORD;
@ -310,7 +310,7 @@ void wxPGTextCtrlEditor::DrawValue( wxDC& dc, wxPGProperty* property, const wxRe
// Code below should no longer be needed, as the obfuscation
// is now done in GetValueAsString.
/*if ( property->HasFlag(wxPG_PROP_PASSWORD) &&
/*if ( property->HasFlag(wxPGPropertyFlags_Password) &&
wxDynamicCast(property, wxStringProperty) )
{
size_t a = drawStr.length();
@ -435,7 +435,7 @@ void wxPGTextCtrlEditor_OnFocus( wxPGProperty* property,
{
// Make sure there is correct text (instead of unspecified value
// indicator or hint text)
int flags = property->HasFlag(wxPG_PROP_READONLY) ?
int flags = property->HasFlag(wxPGPropertyFlags::ReadOnly) ?
0 : wxPG_EDITABLE_VALUE;
wxString correctText = property->GetValueAsString(flags);
@ -494,7 +494,7 @@ protected:
wxMilliClock_t t = ::wxGetLocalTimeMillis();
wxEventType evtType = event.GetEventType();
if ( m_property->HasFlag(wxPG_PROP_USE_DCC) &&
if ( m_property->HasFlag(wxPGPropertyFlags_UseDCC) &&
!m_combo->IsPopupShown() )
{
// Just check that it is in the text area
@ -799,11 +799,11 @@ void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb,
{
renderFlags |= wxPGCellRenderer::Control;
// If wxPG_PROP_CUSTOMIMAGE was set, then that means any custom
// If wxPGPropertyFlags::CustomImage was set, then that means any custom
// image will not appear on the control row (it may be too
// large to fit, for instance). Also do not draw custom image
// if no choice was selected.
if ( !p->HasFlag(wxPG_PROP_CUSTOMIMAGE) )
if ( !p->HasFlag(wxPGPropertyFlags::CustomImage) )
useCustomPaintProcedure = false;
}
else
@ -941,7 +941,7 @@ wxWindow* wxPGChoiceEditor::CreateControlsBase( wxPropertyGrid* propGrid,
// Since it is not possible (yet) to create a read-only combo box in
// the same sense that wxTextCtrl is read-only, simply do not create
// the control in this case.
if ( property->HasFlag(wxPG_PROP_READONLY) )
if ( property->HasFlag(wxPGPropertyFlags::ReadOnly) )
return nullptr;
const wxPGChoices& choices = property->GetChoices();
@ -949,7 +949,7 @@ wxWindow* wxPGChoiceEditor::CreateControlsBase( wxPropertyGrid* propGrid,
int index = property->GetChoiceSelection();
int argFlags = 0;
if ( !property->HasFlag(wxPG_PROP_READONLY) &&
if ( !property->HasFlag(wxPGPropertyFlags::ReadOnly) &&
!property->IsValueUnspecified() )
argFlags |= wxPG_EDITABLE_VALUE;
defString = property->GetValueAsString(argFlags);
@ -967,7 +967,7 @@ wxWindow* wxPGChoiceEditor::CreateControlsBase( wxPropertyGrid* propGrid,
int odcbFlags = extraStyle | wxBORDER_NONE | wxTE_PROCESS_ENTER;
if ( property->HasFlag(wxPG_PROP_USE_DCC) &&
if ( property->HasFlag(wxPGPropertyFlags_UseDCC) &&
wxDynamicCast(property, wxBoolProperty) )
odcbFlags |= wxODCB_DCLICK_CYCLES;
@ -1343,7 +1343,7 @@ wxPGWindowList wxPGTextCtrlAndButtonEditor::CreateControls( wxPropertyGrid* prop
{
wxWindow* wnd2;
wxWindow* wnd = propGrid->GenerateEditorTextCtrlAndButton( pos, sz, &wnd2,
property->HasFlag(wxPG_PROP_NOEDITOR), property);
property->HasFlag(wxPGPropertyFlags::NoEditor), property);
return wxPGWindowList(wnd, wnd2);
}
@ -1627,7 +1627,7 @@ wxPGWindowList wxPGCheckBoxEditor::CreateControls( wxPropertyGrid* propGrid,
const wxPoint& pos,
const wxSize& size ) const
{
if ( property->HasFlag(wxPG_PROP_READONLY) )
if ( property->HasFlag(wxPGPropertyFlags::ReadOnly) )
return nullptr;
wxPoint pt = pos;
@ -1899,7 +1899,7 @@ wxWindow* wxPropertyGrid::GenerateEditorTextCtrl( const wxPoint& pos,
int tcFlags = wxTE_PROCESS_ENTER | extraStyle;
if ( prop->HasFlag(wxPG_PROP_READONLY) && forColumn == 1 )
if ( prop->HasFlag(wxPGPropertyFlags::ReadOnly) && forColumn == 1 )
tcFlags |= wxTE_READONLY;
wxPoint p(pos);
@ -1952,7 +1952,7 @@ wxWindow* wxPropertyGrid::GenerateEditorTextCtrl( const wxPoint& pos,
// This code is repeated from DoSelectProperty(). However, font boldness
// must be set before margin is set up below in FixPosForTextCtrl().
if ( forColumn == 1 &&
prop->HasFlag(wxPG_PROP_MODIFIED) &&
prop->HasFlag(wxPGPropertyFlags::Modified) &&
HasFlag(wxPG_BOLD_MODIFIED) )
tc->SetFont( m_captionFont );
@ -2019,7 +2019,7 @@ wxWindow* wxPropertyGrid::GenerateEditorButton( const wxPoint& pos, const wxSize
p.x = pos.x + sz.x - s.x;
but->Move(p);
if ( selected->HasFlag(wxPG_PROP_READONLY) && !selected->HasFlag(wxPG_PROP_ACTIVE_BTN) )
if ( selected->HasFlag(wxPGPropertyFlags::ReadOnly) && !selected->HasFlag(wxPGPropertyFlags_ActiveButton) )
but->Disable();
return but;
@ -2048,7 +2048,7 @@ wxWindow* wxPropertyGrid::GenerateEditorTextCtrlAndButton( const wxPoint& pos,
wxString text;
if ( !property->IsValueUnspecified() )
text = property->GetValueAsString(property->HasFlag(wxPG_PROP_READONLY)?0:wxPG_EDITABLE_VALUE);
text = property->GetValueAsString(property->HasFlag(wxPGPropertyFlags::ReadOnly)?0:wxPG_EDITABLE_VALUE);
return GenerateEditorTextCtrl(pos, sz, text, but, 0, property->GetMaxLength());
}

View file

@ -582,7 +582,7 @@ void wxPGProperty::Init()
m_maxLen = 0; // infinite maximum length
m_flags = wxPG_PROP_PROPERTY;
m_flags = wxPGPropertyFlags::Property;
m_depth = 1;
@ -634,24 +634,24 @@ void wxPGProperty::InitAfterAdded( wxPropertyGridPageState* pageState,
// If in hideable adding mode, or if assigned parent is hideable, then
// make this one hideable.
if (
( !parentIsRoot && parent->HasFlag(wxPG_PROP_HIDDEN) ) ||
( !parentIsRoot && parent->HasFlag(wxPGPropertyFlags::Hidden) ) ||
( propgrid && (propgrid->HasInternalFlag(wxPropertyGrid::wxPG_FL_ADDING_HIDEABLES)) )
)
SetFlag( wxPG_PROP_HIDDEN );
SetFlag(wxPGPropertyFlags::Hidden);
// Set custom image flag.
int custImgHeight = OnMeasureImage().y;
if ( custImgHeight == wxDefaultCoord )
{
SetFlag(wxPG_PROP_CUSTOMIMAGE);
SetFlag(wxPGPropertyFlags::CustomImage);
}
if ( propgrid && (propgrid->HasFlag(wxPG_LIMITED_EDITING)) )
SetFlag(wxPG_PROP_NOEDITOR);
SetFlag(wxPGPropertyFlags::NoEditor);
// Make sure parent has some parental flags
if ( !parent->HasFlag(wxPG_PROP_PARENTAL_FLAGS) )
parent->SetParentalType(wxPG_PROP_MISC_PARENT);
if ( !parent->HasFlag(wxPGPropertyFlags::ParentalFlags) )
parent->SetParentalType(wxPGPropertyFlags::MiscParent);
if ( !IsCategory() )
{
@ -707,14 +707,14 @@ void wxPGProperty::InitAfterAdded( wxPropertyGridPageState* pageState,
if ( HasAnyChild() )
{
// Check parental flags
wxASSERT_MSG( ((m_flags & wxPG_PROP_PARENTAL_FLAGS) ==
wxPG_PROP_AGGREGATE) ||
((m_flags & wxPG_PROP_PARENTAL_FLAGS) ==
wxPG_PROP_MISC_PARENT),
wxASSERT_MSG( ((m_flags & wxPGPropertyFlags::ParentalFlags) ==
wxPGPropertyFlags::Aggregate) ||
((m_flags & wxPGPropertyFlags::ParentalFlags) ==
wxPGPropertyFlags::MiscParent),
wxS("wxPGProperty parental flags set incorrectly at ")
wxS("this time") );
if ( HasFlag(wxPG_PROP_AGGREGATE) )
if ( HasFlag(wxPGPropertyFlags::Aggregate) )
{
// Properties with private children are not expanded by default.
SetExpanded(false);
@ -734,7 +734,7 @@ void wxPGProperty::InitAfterAdded( wxPropertyGridPageState* pageState,
}
if ( propgrid && propgrid->HasExtraStyle(wxPG_EX_AUTO_UNSPECIFIED_VALUES) )
SetFlagRecursively(wxPG_PROP_AUTO_UNSPECIFIED, true);
SetFlagRecursively(wxPGPropertyFlags::AutoUnspecified, true);
}
}
@ -1042,7 +1042,7 @@ void wxPGProperty::DoGenerateComposedValue( wxString& text,
if ( !childValue.IsNull() )
{
if ( overridesLeft &&
curChild->HasFlag(wxPG_PROP_COMPOSED_VALUE) &&
curChild->HasFlag(wxPGPropertyFlags::ComposedValue) &&
childValue.IsType(wxPG_VARIANT_TYPE_LIST) )
{
wxVariantList& childList = childValue.GetList();
@ -1217,8 +1217,8 @@ bool wxPGProperty::StringToValue( wxVariant& v, const wxString& text, int argFla
// Add only if editable or setting programmatically
if ( (argFlags & wxPG_PROGRAMMATIC_VALUE) ||
(!child->HasFlag(wxPG_PROP_DISABLED) &&
!child->HasFlag(wxPG_PROP_READONLY)) )
(!child->HasFlag(wxPGPropertyFlags::Disabled) &&
!child->HasFlag(wxPGPropertyFlags::ReadOnly)) )
{
if ( len > 0 )
{
@ -1296,8 +1296,8 @@ bool wxPGProperty::StringToValue( wxVariant& v, const wxString& text, int argFla
wxVariant variant(oldChildValue);
if ( (argFlags & wxPG_PROGRAMMATIC_VALUE) ||
(!child->HasFlag(wxPG_PROP_DISABLED) &&
!child->HasFlag(wxPG_PROP_READONLY)) )
(!child->HasFlag(wxPGPropertyFlags::Disabled) &&
!child->HasFlag(wxPGPropertyFlags::ReadOnly)) )
{
wxString childName = child->GetBaseName();
@ -1474,7 +1474,7 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, wxPGSetValueFlag
{
//
// However, situation is different for composed string properties
if ( HasFlag(wxPG_PROP_COMPOSED_VALUE) )
if ( HasFlag(wxPGPropertyFlags::ComposedValue) )
{
tempListVariant = value;
pList = &tempListVariant;
@ -1486,7 +1486,7 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, wxPGSetValueFlag
//wxLogDebug(wxS(">> %s.SetValue() adapted list value to type '%s'"),GetName(),value.GetType());
}
if ( HasFlag( wxPG_PROP_AGGREGATE) )
if ( HasFlag(wxPGPropertyFlags::Aggregate) )
flags |= wxPGSetValueFlags::Aggregated;
if ( pList && !pList->IsNull() )
@ -1511,7 +1511,7 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, wxPGSetValueFlag
//wxLogDebug(wxS("%i: child = %s, childValue.GetType()=%s"),i,child->GetBaseName(),childValue.GetType());
if ( childValue.IsType(wxPG_VARIANT_TYPE_LIST) )
{
if ( child->HasFlag(wxPG_PROP_AGGREGATE) && !(flags & wxPGSetValueFlags::Aggregated) )
if ( child->HasFlag(wxPGPropertyFlags::Aggregate) && !(flags & wxPGSetValueFlags::Aggregated) )
{
wxVariant listRefCopy = childValue;
child->SetValue(childValue, &listRefCopy, flags| wxPGSetValueFlags::FromParent);
@ -1526,10 +1526,10 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, wxPGSetValueFlag
{
// For aggregate properties, we will trust RefreshChildren()
// to update child values.
if ( !HasFlag(wxPG_PROP_AGGREGATE) )
if ( !HasFlag(wxPGPropertyFlags::Aggregate) )
child->SetValue(childValue, nullptr, flags| wxPGSetValueFlags::FromParent);
if ( !!(flags & wxPGSetValueFlags::ByUser) )
child->SetFlag(wxPG_PROP_MODIFIED);
child->SetFlag(wxPGPropertyFlags::Modified);
}
}
i++;
@ -1549,9 +1549,9 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, wxPGSetValueFlag
}
if ( !!(flags & wxPGSetValueFlags::ByUser) )
SetFlag(wxPG_PROP_MODIFIED);
SetFlag(wxPGPropertyFlags::Modified);
if ( HasFlag(wxPG_PROP_AGGREGATE) )
if ( HasFlag(wxPGPropertyFlags::Aggregate) )
RefreshChildren();
}
else
@ -1683,7 +1683,7 @@ void wxPGProperty::Enable( bool enable )
void wxPGProperty::DoEnable( bool enable )
{
ChangeFlag(wxPG_PROP_DISABLED, !enable);
ChangeFlag(wxPGPropertyFlags::Disabled, !enable);
// Apply same to sub-properties as well
for ( wxPGProperty* child : m_children )
@ -1722,7 +1722,7 @@ void wxPGProperty::AdaptiveSetCell( unsigned int firstCol,
const wxPGCell& cell,
const wxPGCell& srcData,
wxPGCellData* unmodCellData,
FlagType ignoreWithFlags,
wxPGPropertyFlags ignoreWithFlags,
bool recursively )
{
//
@ -1764,7 +1764,7 @@ void wxPGProperty::AdaptiveSetCell( unsigned int firstCol,
}
}
void wxPGProperty::ClearCells(FlagType ignoreWithFlags, bool recursively)
void wxPGProperty::ClearCells(wxPGPropertyFlags ignoreWithFlags, bool recursively)
{
if ( !(m_flags & ignoreWithFlags) && !IsRoot() )
{
@ -1835,7 +1835,7 @@ void wxPGProperty::SetBackgroundColour(const wxColour& colour, wxPGPropertyValue
newCell,
srcCell,
firstCellData,
recursively ? wxPG_PROP_CATEGORY : 0,
recursively ? wxPGPropertyFlags::Category : wxPGPropertyFlags::Null,
recursively );
}
@ -1870,7 +1870,7 @@ void wxPGProperty::SetTextColour(const wxColour& colour, wxPGPropertyValuesFlags
newCell,
srcCell,
firstCellData,
recursively ? wxPG_PROP_CATEGORY : 0,
recursively ? wxPGPropertyFlags::Category : wxPGPropertyFlags::Null,
recursively );
}
@ -1891,7 +1891,7 @@ void wxPGProperty::SetDefaultColours(wxPGPropertyValuesFlags flags)
}
}
ClearCells(recursively ? wxPG_PROP_CATEGORY : 0,
ClearCells(recursively ? wxPGPropertyFlags::Category : wxPGPropertyFlags::Null,
recursively);
}
@ -1980,22 +1980,22 @@ wxVariant wxPGProperty::GetAttributesAsList() const
// Utility flags are excluded.
// Store the literals in the internal representation for better performance.
static const std::array<std::pair<wxPGProperty::FlagType, const wxStringCharType*>, 4> gs_propFlagToString
static const std::array<std::pair<wxPGPropertyFlags, const wxStringCharType*>, 4> gs_propFlagToString
{ {
{ wxPG_PROP_DISABLED, wxS("DISABLED") },
{ wxPG_PROP_HIDDEN, wxS("HIDDEN") },
{ wxPG_PROP_NOEDITOR, wxS("NOEDITOR") },
{ wxPG_PROP_COLLAPSED, wxS("COLLAPSED") }
{ wxPGPropertyFlags::Disabled, wxS("DISABLED") },
{ wxPGPropertyFlags::Hidden, wxS("HIDDEN") },
{ wxPGPropertyFlags::NoEditor, wxS("NOEDITOR") },
{ wxPGPropertyFlags::Collapsed, wxS("COLLAPSED") }
} };
wxString wxPGProperty::GetFlagsAsString( FlagType flagsMask ) const
wxString wxPGProperty::GetFlagsAsString(wxPGPropertyFlags flagsMask) const
{
wxString s;
const FlagType relevantFlags = m_flags & flagsMask & wxPG_STRING_STORED_FLAGS;
const wxPGPropertyFlags relevantFlags = m_flags & flagsMask & wxPGPropertyFlags::StringStoredFlags;
for ( auto& item : gs_propFlagToString )
{
if ( relevantFlags & item.first )
if ( !!(relevantFlags & item.first) )
{
if ( !s.empty() )
{
@ -2010,7 +2010,7 @@ wxString wxPGProperty::GetFlagsAsString( FlagType flagsMask ) const
void wxPGProperty::SetFlagsFromString( const wxString& str )
{
FlagType flags = 0;
wxPGPropertyFlags flags = wxPGPropertyFlags::Null;
WX_PG_TOKENIZER1_BEGIN(str, wxS('|'))
for ( auto& item : gs_propFlagToString )
@ -2023,7 +2023,7 @@ void wxPGProperty::SetFlagsFromString( const wxString& str )
}
WX_PG_TOKENIZER1_END()
m_flags = (m_flags & ~wxPG_STRING_STORED_FLAGS) | flags;
m_flags = (m_flags & ~wxPGPropertyFlags::StringStoredFlags) | flags;
}
wxValidator* wxPGProperty::DoGetValidator() const
@ -2195,7 +2195,7 @@ bool wxPGProperty::Hide( bool hide, wxPGPropertyValuesFlags flags )
bool wxPGProperty::DoHide( bool hide, wxPGPropertyValuesFlags flags )
{
ChangeFlag(wxPG_PROP_HIDDEN, hide);
ChangeFlag(wxPGPropertyFlags::Hidden, hide);
if ( !!(flags & wxPGPropertyValuesFlags::Recurse) )
{
@ -2210,7 +2210,7 @@ bool wxPGProperty::HasVisibleChildren() const
{
for ( wxPGProperty* child : m_children )
{
if ( !child->HasFlag(wxPG_PROP_HIDDEN) )
if ( !child->HasFlag(wxPGPropertyFlags::Hidden) )
return true;
}
@ -2240,12 +2240,12 @@ void wxPGProperty::SetValueImage( const wxBitmapBundle& bmp )
if ( bmp.IsOk() )
{
m_valueBitmapBundle = bmp;
m_flags |= wxPG_PROP_CUSTOMIMAGE;
m_flags |= wxPGPropertyFlags::CustomImage;
}
else
{
m_valueBitmapBundle = wxBitmapBundle();
m_flags &= ~(wxPG_PROP_CUSTOMIMAGE);
m_flags &= ~(wxPGPropertyFlags::CustomImage);
}
}
@ -2278,12 +2278,12 @@ const wxPGProperty* wxPGProperty::GetLastVisibleSubItem() const
bool wxPGProperty::IsVisible() const
{
if ( HasFlag(wxPG_PROP_HIDDEN) )
if ( HasFlag(wxPGPropertyFlags::Hidden) )
return false;
for (const wxPGProperty* parent = GetParent(); parent != nullptr; parent = parent->GetParent() )
{
if ( !parent->IsExpanded() || parent->HasFlag(wxPG_PROP_HIDDEN) )
if ( !parent->IsExpanded() || parent->HasFlag(wxPGPropertyFlags::Hidden) )
return false;
}
@ -2359,18 +2359,17 @@ void wxPGProperty::DoPreAddChild( int index, wxPGProperty* prop )
int custImgHeight = prop->OnMeasureImage().y;
if ( custImgHeight == wxDefaultCoord /*|| custImgHeight > 1*/ )
prop->m_flags |= wxPG_PROP_CUSTOMIMAGE;
prop->m_flags |= wxPGPropertyFlags::CustomImage;
prop->m_parent = this;
}
void wxPGProperty::AddPrivateChild( wxPGProperty* prop )
{
if ( !(m_flags & wxPG_PROP_PARENTAL_FLAGS) )
SetParentalType(wxPG_PROP_AGGREGATE);
if ( !(m_flags & wxPGPropertyFlags::ParentalFlags) )
SetParentalType(wxPGPropertyFlags::Aggregate);
wxASSERT_MSG( (m_flags & wxPG_PROP_PARENTAL_FLAGS) ==
wxPG_PROP_AGGREGATE,
wxASSERT_MSG( (m_flags & wxPGPropertyFlags::ParentalFlags) == wxPGPropertyFlags::Aggregate,
wxS("Do not mix up AddPrivateChild() calls with other ")
wxS("property adders.") );
@ -2389,11 +2388,10 @@ wxPGProperty* wxPGProperty::InsertChild( int index,
}
else
{
if ( !(m_flags & wxPG_PROP_PARENTAL_FLAGS) )
SetParentalType(wxPG_PROP_MISC_PARENT);
if ( !(m_flags & wxPGPropertyFlags::ParentalFlags) )
SetParentalType(wxPGPropertyFlags::MiscParent);
wxASSERT_MSG( (m_flags & wxPG_PROP_PARENTAL_FLAGS) ==
wxPG_PROP_MISC_PARENT,
wxASSERT_MSG( (m_flags & wxPGPropertyFlags::ParentalFlags) == wxPGPropertyFlags::MiscParent,
wxS("Do not mix up AddPrivateChild() calls with other ")
wxS("property adders.") );
@ -2446,7 +2444,7 @@ void wxPGProperty::AdaptListToValue( wxVariant& list, wxVariant* value ) const
// Don't fully update aggregate properties unless all children have
// specified value
if ( HasFlag(wxPG_PROP_AGGREGATE) )
if ( HasFlag(wxPGPropertyFlags::Aggregate) )
allChildrenSpecified = AreAllChildrenSpecified(&list);
else
allChildrenSpecified = true;
@ -2557,7 +2555,7 @@ int wxPGProperty::GetChildrenHeight( int lh, int iMax ) const
{
wxPGProperty* pwc = Item(i);
if ( !pwc->HasFlag(wxPG_PROP_HIDDEN) )
if ( !pwc->HasFlag(wxPGPropertyFlags::Hidden) )
{
if ( !pwc->IsExpanded() ||
!pwc->HasAnyChild() )
@ -2585,7 +2583,7 @@ wxPGProperty* wxPGProperty::GetItemAtY( unsigned int y,
for ( wxPGProperty* pwc : m_children )
{
if ( !pwc->HasFlag(wxPG_PROP_HIDDEN) )
if ( !pwc->HasFlag(wxPGPropertyFlags::Hidden) )
{
// Found?
if ( y < iy )
@ -2630,7 +2628,7 @@ wxPGProperty* wxPGProperty::GetItemAtY( unsigned int y,
void wxPGProperty::Empty()
{
if ( !HasFlag(wxPG_PROP_CHILDREN_ARE_COPIES) )
if ( !HasFlag(wxPGPropertyFlags::ChildrenAreCopies) )
{
for ( wxPGProperty* child : m_children )
{
@ -2748,7 +2746,7 @@ bool wxPGProperty::AreAllChildrenSpecified( const wxVariant* pendingList ) const
wxPGProperty* wxPGProperty::UpdateParentValues()
{
wxPGProperty* parent = m_parent;
if ( parent && parent->HasFlag(wxPG_PROP_COMPOSED_VALUE) &&
if ( parent && parent->HasFlag(wxPGPropertyFlags::ComposedValue) &&
!parent->IsCategory() && !parent->IsRoot() )
{
wxString s;
@ -2761,10 +2759,10 @@ wxPGProperty* wxPGProperty::UpdateParentValues()
bool wxPGProperty::IsTextEditable() const
{
if ( HasFlag(wxPG_PROP_READONLY) )
if ( HasFlag(wxPGPropertyFlags::ReadOnly) )
return false;
if ( HasFlag(wxPG_PROP_NOEDITOR) &&
if ( HasFlag(wxPGPropertyFlags::NoEditor) &&
(HasAnyChild() ||
wxString(GetEditorClass()->GetClassInfo()->GetClassName()).EndsWith(wxS("Button")))
)
@ -2816,7 +2814,7 @@ wxString wxPGProperty::GetHintText() const
int wxPGProperty::GetDisplayedCommonValueCount() const
{
if ( HasFlag(wxPG_PROP_USES_COMMON_VALUE) )
if ( HasFlag(wxPGPropertyFlags::UsesCommonValue) )
{
wxPropertyGrid* pg = GetGrid();
if ( pg )
@ -2871,7 +2869,7 @@ wxPGRootProperty::wxPGRootProperty( const wxString& name )
{
m_name = name;
m_label = m_name;
SetParentalType(0);
SetParentalType(wxPGPropertyFlags::Null);
m_depth = 0;
}
@ -2884,7 +2882,7 @@ wxPG_IMPLEMENT_PROPERTY_CLASS(wxPropertyCategory, wxPGProperty, TextCtrl)
void wxPropertyCategory::Init()
{
// don't set colour - prepareadditem method should do this
SetParentalType(wxPG_PROP_CATEGORY);
SetParentalType(wxPGPropertyFlags::Category);
m_capFgColIndex = 1;
m_textExtent = -1;
}

View file

@ -943,11 +943,11 @@ void wxPropertyGrid::MakeColumnEditable( unsigned int column,
bool editable )
{
// The second column is always editable. To make it read-only is a property
// by property decision by setting its wxPG_PROP_READONLY flag.
// by property decision by setting its wxPGPropertyFlags::ReadOnly flag.
wxASSERT_MSG
(
column != 1,
wxS("Set wxPG_PROP_READONLY property flag instead")
wxS("Set wxPGPropertyFlags::ReadOnly property flag instead")
);
if ( editable )
@ -2158,7 +2158,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
{
const wxPGProperty* p = *it;
if ( !p->HasFlag(wxPG_PROP_HIDDEN) )
if ( !p->HasFlag(wxPGPropertyFlags::Hidden) )
{
visPropArray.push_back(const_cast<wxPGProperty*>(p));
@ -2365,7 +2365,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
if ( butRect.x > 0 )
butRect.x += IN_CELL_EXPANDER_BUTTON_X_ADJUST;
if ( p->HasFlag(wxPG_PROP_MODIFIED) &&
if ( p->HasFlag(wxPGPropertyFlags::Modified) &&
(windowStyle & wxPG_BOLD_MODIFIED) )
{
dc.SetFont(m_captionFont);
@ -3000,7 +3000,7 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue
wxVariant* pPendingValue = &pendingValue;
wxVariant* pList = nullptr;
// If parent has wxPG_PROP_AGGREGATE flag, or uses composite
// If parent has wxPGPropertyFlags::Aggregate flag, or uses composite
// string value, then we need treat as it was changed instead
// (or, in addition, as is the case with composite string parent).
// This includes creating list variant for child values.
@ -3014,7 +3014,7 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue
listValue.SetName(p->GetBaseName());
while ( pwc &&
(pwc->HasFlag(wxPG_PROP_AGGREGATE) || pwc->HasFlag(wxPG_PROP_COMPOSED_VALUE)) )
(pwc->HasFlag(wxPGPropertyFlags::Aggregate) || pwc->HasFlag(wxPGPropertyFlags::ComposedValue)) )
{
wxVariantList tempList;
wxVariant lv(tempList, pwc->GetBaseName());
@ -3022,7 +3022,7 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue
listValue = lv;
pPendingValue = &listValue;
if ( pwc->HasFlag(wxPG_PROP_AGGREGATE) )
if ( pwc->HasFlag(wxPGPropertyFlags::Aggregate) )
{
baseChangedProperty = pwc;
bcpPendingList = lv;
@ -3052,9 +3052,9 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue
{
// FIXME: After proper ValueToString()s added, remove
// this. It is just a temporary fix, as evt_changing
// will simply not work for wxPG_PROP_COMPOSED_VALUE
// will simply not work for wxPGPropertyFlags::ComposedValue
// (unless it is selected, and textctrl editor is open).
if ( changedProperty->HasFlag(wxPG_PROP_COMPOSED_VALUE) )
if ( changedProperty->HasFlag(wxPGPropertyFlags::ComposedValue) )
{
evtChangingProperty = baseChangedProperty;
if ( evtChangingProperty != p )
@ -3067,7 +3067,7 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue
}
}
if ( evtChangingProperty->HasFlag(wxPG_PROP_COMPOSED_VALUE) )
if ( evtChangingProperty->HasFlag(wxPGPropertyFlags::ComposedValue) )
{
if ( changedProperty == GetSelection() )
{
@ -3194,7 +3194,7 @@ bool wxPropertyGrid::OnValidationFailure( wxPGProperty* property,
{
// When property selection is being changed, do not display any
// messages, if some were already shown for this property.
if ( property->HasFlag(wxPG_PROP_INVALID_VALUE) )
if ( property->HasFlag(wxPGPropertyFlags::InvalidValue) )
{
m_validationInfo.SetFailureBehavior(
vfb & (~(wxPGVFBFlags::ShowMessage |
@ -3216,7 +3216,7 @@ bool wxPropertyGrid::OnValidationFailure( wxPGProperty* property,
property->GetEditorClass()->UpdateControl(property, editor);
}
property->SetFlag(wxPG_PROP_INVALID_VALUE);
property->SetFlag(wxPGPropertyFlags::InvalidValue);
return res;
}
@ -3229,7 +3229,7 @@ bool wxPropertyGrid::DoOnValidationFailure( wxPGProperty* property, wxVariant& W
::wxBell();
if ( !!(vfb & wxPGVFBFlags::MarkCell) &&
!property->HasFlag(wxPG_PROP_INVALID_VALUE) )
!property->HasFlag(wxPGPropertyFlags::InvalidValue) )
{
unsigned int colCount = m_pState->GetColumnCount();
@ -3381,9 +3381,9 @@ bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, wxPGSelectPropertyFlags
wxWindow* editor = GetEditorControl();
// Set as Modified (not if dragging just began)
if ( !p->HasFlag(wxPG_PROP_MODIFIED) )
if ( !p->HasFlag(wxPGPropertyFlags::Modified) )
{
p->SetFlag(wxPG_PROP_MODIFIED);
p->SetFlag(wxPGPropertyFlags::Modified);
if ( p == selected && (m_windowStyle & wxPG_BOLD_MODIFIED) )
{
if ( editor )
@ -3398,7 +3398,7 @@ bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, wxPGSelectPropertyFlags
while ( prevPwc != topPaintedProperty )
{
pwc->SetFlag(wxPG_PROP_MODIFIED);
pwc->SetFlag(wxPGPropertyFlags::Modified);
if ( pwc == selected && (m_windowStyle & wxPG_BOLD_MODIFIED) )
{
@ -3429,11 +3429,11 @@ bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, wxPGSelectPropertyFlags
}
// Sanity check
wxASSERT( !changedProperty->GetParent()->HasFlag(wxPG_PROP_AGGREGATE) );
wxASSERT( !changedProperty->GetParent()->HasFlag(wxPGPropertyFlags::Aggregate) );
// If top parent has composite string value, then send to child parents,
// starting from baseChangedProperty.
if ( changedProperty->HasFlag(wxPG_PROP_COMPOSED_VALUE) )
if ( changedProperty->HasFlag(wxPGPropertyFlags::ComposedValue) )
{
pwc = m_chgInfo_baseChangedProperty;
@ -3556,7 +3556,7 @@ bool wxPropertyGrid::HandleCustomEditorEvent( wxEvent &event )
// Somehow, event is handled after property has been deselected.
// Possibly, but very rare.
if ( !selected ||
selected->HasFlag(wxPG_PROP_BEING_DELETED) ||
selected->HasFlag(wxPGPropertyFlags::BeingDeleted) ||
m_inOnValidationFailure ||
// Also don't handle editor event if wxEVT_PG_CHANGED or
// similar is currently doing something (showing a
@ -4036,7 +4036,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, wxPGSelectPropertyFlags
prevFirstSel = prevSelection.empty()? nullptr: prevSelection[0];
if ( prevFirstSel && prevFirstSel->HasFlag(wxPG_PROP_BEING_DELETED) )
if ( prevFirstSel && prevFirstSel->HasFlag(wxPGPropertyFlags::BeingDeleted) )
prevFirstSel = nullptr;
// Always send event, as this is indirect call
@ -4150,7 +4150,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, wxPGSelectPropertyFlags
//
// Only create editor for non-disabled non-caption
if ( !p->IsCategory() && !p->HasFlag(wxPG_PROP_DISABLED) )
if ( !p->IsCategory() && !p->HasFlag(wxPGPropertyFlags::Disabled) )
{
// do this for non-caption items
@ -4158,7 +4158,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, wxPGSelectPropertyFlags
// Do we need to paint the custom image, if any?
m_iFlags &= ~(wxPG_FL_CUR_USES_CUSTOM_IMAGE);
if ( p->HasFlag(wxPG_PROP_CUSTOMIMAGE) &&
if ( p->HasFlag(wxPGPropertyFlags::CustomImage) &&
!p->GetEditorClass()->CanContainCustomImage()
)
m_iFlags |= wxPG_FL_CUR_USES_CUSTOM_IMAGE;
@ -4224,7 +4224,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, wxPGSelectPropertyFlags
// If it has modified status, use bold font
// (must be done before capturing m_ctrlXAdjust)
if ( p->HasFlag(wxPG_PROP_MODIFIED) &&
if ( p->HasFlag(wxPGPropertyFlags::Modified) &&
(m_windowStyle & wxPG_BOLD_MODIFIED) )
SetCurControlBoldFont();
// Store x relative to splitter (we'll need it).
@ -4415,7 +4415,7 @@ void wxPropertyGrid::RefreshEditor()
// calling UpdateControl().
if ( HasFlag(wxPG_BOLD_MODIFIED) )
{
if ( p->HasFlag(wxPG_PROP_MODIFIED) )
if ( p->HasFlag(wxPGPropertyFlags::Modified) )
wnd->SetFont(GetCaptionFont());
else
wnd->SetFont(GetFont());
@ -5111,7 +5111,7 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y,
space -= (wxPG_XBEFORETEXT + 1);
int tw, th;
const wxFont* font = nullptr;
if ( (m_windowStyle & wxPG_BOLD_MODIFIED) && m_propHover->HasFlag(wxPG_PROP_MODIFIED) )
if ( (m_windowStyle & wxPG_BOLD_MODIFIED) && m_propHover->HasFlag(wxPGPropertyFlags::Modified) )
font = &m_captionFont;
if ( cell.GetFont().IsOk() )
font = &cell.GetFont();
@ -5183,7 +5183,7 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y,
// Since categories cannot be selected along with 'other'
// properties, exclude them from iterator flags.
int iterFlags = wxPG_ITERATE_VISIBLE & (~wxPG_PROP_CATEGORY);
int iterFlags = wxPG_ITERATE_VISIBLE & (~wxPGPropertyFlags::Category);
for ( int i=(selection.size()-1); i>=0; i-- )
{
@ -5730,7 +5730,7 @@ void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild )
if ( action == wxPGKeyboardActions::Edit && !editorFocused )
{
// Mark as handled only for editable property
if ( !p->IsCategory() && p->IsEnabled() && !p->HasFlag(wxPG_PROP_READONLY) )
if ( !p->IsCategory() && p->IsEnabled() && !p->HasFlag(wxPGPropertyFlags::ReadOnly) )
{
DoSelectProperty( p, wxPGSelectPropertyFlags::Focus );
wasHandled = true;
@ -6373,7 +6373,7 @@ wxPGProperty* wxPropertyGridPopulator::Add( const wxString& propClass,
wxClassInfo* classInfo = wxClassInfo::FindClass(propClass);
wxPGProperty* parent = GetCurParent();
if ( parent->HasFlag(wxPG_PROP_AGGREGATE) )
if ( parent->HasFlag(wxPGPropertyFlags::Aggregate) )
{
ProcessError(wxString::Format(wxS("new children cannot be added to '%s'"),parent->GetName()));
return nullptr;

View file

@ -125,7 +125,7 @@ wxPGProperty* wxPropertyGridInterface::RemoveProperty( wxPGPropArg id )
{
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullProperty)
wxCHECK( !p->HasAnyChild() || p->HasFlag(wxPG_PROP_AGGREGATE),
wxCHECK( !p->HasAnyChild() || p->HasFlag(wxPGPropertyFlags::Aggregate),
wxNullProperty);
wxPropertyGridPageState* state = p->GetParentState();
@ -228,7 +228,7 @@ bool wxPropertyGridInterface::EnableProperty( wxPGPropArg id, bool enable )
if ( enable )
{
if ( !p->HasFlag(wxPG_PROP_DISABLED) )
if ( !p->HasFlag(wxPGPropertyFlags::Disabled) )
return false;
// If active, Set active Editor.
@ -237,7 +237,7 @@ bool wxPropertyGridInterface::EnableProperty( wxPGPropArg id, bool enable )
}
else
{
if ( p->HasFlag(wxPG_PROP_DISABLED) )
if ( p->HasFlag(wxPGPropertyFlags::Disabled) )
return false;
// If active, Disable as active Editor.
@ -258,17 +258,17 @@ void wxPropertyGridInterface::SetPropertyReadOnly( wxPGPropArg id, bool set, wxP
if ( !!(flags & wxPGPropertyValuesFlags::Recurse) )
{
p->SetFlagRecursively(wxPG_PROP_READONLY, set);
p->SetFlagRecursively(wxPGPropertyFlags::ReadOnly, set);
}
else
{
// Do nothing if flag is already set as required.
if ( set && p->HasFlag(wxPG_PROP_READONLY) )
if ( set && p->HasFlag(wxPGPropertyFlags::ReadOnly) )
return;
if ( !set && !p->HasFlag(wxPG_PROP_READONLY) )
if ( !set && !p->HasFlag(wxPGPropertyFlags::ReadOnly) )
return;
p->ChangeFlag(wxPG_PROP_READONLY, set);
p->ChangeFlag(wxPGPropertyFlags::ReadOnly, set);
}
wxPropertyGridPageState* state = p->GetParentState();
@ -337,7 +337,7 @@ void wxPropertyGridInterface::ClearModifiedStatus()
wxPropertyGridPageState* page;
while ( (page = GetPageState(pageIndex)) != nullptr )
{
page->DoGetRoot()->SetFlagRecursively(wxPG_PROP_MODIFIED, false);
page->DoGetRoot()->SetFlagRecursively(wxPGPropertyFlags::Modified, false);
page->m_anyModified = false;
pageIndex++;
@ -456,7 +456,7 @@ void wxPropertyGridInterface::SetPropertyAttributeAll( const wxString& attrName,
// -----------------------------------------------------------------------
void wxPropertyGridInterface::GetPropertiesWithFlag( wxArrayPGProperty* targetArr,
wxPGProperty::FlagType flags,
wxPGPropertyFlags flags,
bool inverse,
int iterFlags ) const
{
@ -538,9 +538,9 @@ bool wxPropertyGridInterface::HideProperty(wxPGPropArg id, bool hide, wxPGProper
// Do nothing if single property is already hidden/visible as requested.
if ( !(flags & wxPGPropertyValuesFlags::Recurse) )
{
if ( hide && p->HasFlag(wxPG_PROP_HIDDEN) )
if ( hide && p->HasFlag(wxPGPropertyFlags::Hidden) )
return false;
if ( !hide && !p->HasFlag(wxPG_PROP_HIDDEN) )
if ( !hide && !p->HasFlag(wxPGPropertyFlags::Hidden) )
return false;
}
@ -844,9 +844,9 @@ bool wxPropertyGridInterface::ChangePropertyValue( wxPGPropArg id, wxVariant new
void wxPropertyGridInterface::BeginAddChildren( wxPGPropArg id )
{
wxPG_PROP_ARG_CALL_PROLOG()
wxCHECK_RET( p->HasFlag(wxPG_PROP_AGGREGATE), wxS("only call on properties with fixed children") );
p->ClearFlag(wxPG_PROP_AGGREGATE);
p->SetFlag(wxPG_PROP_MISC_PARENT);
wxCHECK_RET( p->HasFlag(wxPGPropertyFlags::Aggregate), wxS("only call on properties with fixed children") );
p->ClearFlag(wxPGPropertyFlags::Aggregate);
p->SetFlag(wxPGPropertyFlags::MiscParent);
}
// -----------------------------------------------------------------------
@ -861,9 +861,9 @@ bool wxPropertyGridInterface::EditorValidate()
void wxPropertyGridInterface::EndAddChildren( wxPGPropArg id )
{
wxPG_PROP_ARG_CALL_PROLOG()
wxCHECK_RET( p->HasFlag(wxPG_PROP_MISC_PARENT), wxS("only call on properties for which BeginAddChildren was called prior") );
p->ClearFlag(wxPG_PROP_MISC_PARENT);
p->SetFlag(wxPG_PROP_AGGREGATE);
wxCHECK_RET( p->HasFlag(wxPGPropertyFlags::MiscParent), wxS("only call on properties for which BeginAddChildren was called prior") );
p->ClearFlag(wxPGPropertyFlags::MiscParent);
p->SetFlag(wxPGPropertyFlags::Aggregate);
}
// -----------------------------------------------------------------------
@ -952,7 +952,7 @@ wxString wxPropertyGridInterface::SaveEditableState( int includedStates ) const
{
const wxPGProperty* p = it.GetProperty();
if ( !p->HasFlag(wxPG_PROP_COLLAPSED) )
if ( !p->HasFlag(wxPGPropertyFlags::Collapsed) )
result += EscapeDelimiters(p->GetName());
result += wxS(",");

View file

@ -226,7 +226,7 @@ void wxPropertyGridPageState::InitNonCatMode()
m_abcArray = new wxPGRootProperty(wxS("<Root_NonCat>"));
m_abcArray->SetParentState(this);
m_abcArray->SetFlag(wxPG_PROP_CHILDREN_ARE_COPIES);
m_abcArray->SetFlag(wxPGPropertyFlags::ChildrenAreCopies);
// Must be called when state::m_properties still points to regularArray.
wxPGProperty* oldProperties = m_properties;
@ -402,7 +402,7 @@ wxPGProperty* wxPropertyGridPageState::GetLastItem( int flags )
if ( !m_properties->HasAnyChild() )
return nullptr;
wxPG_ITERATOR_CREATE_MASKS(flags, wxPGProperty::FlagType itemExMask, wxPGProperty::FlagType parentExMask)
wxPG_ITERATOR_CREATE_MASKS(flags, wxPGPropertyFlags itemExMask, wxPGPropertyFlags parentExMask)
// First, get last child of last parent
wxPGProperty* pwc = m_properties->Last();
@ -609,7 +609,7 @@ void wxPropertyGridPageState::DoSortChildren(wxPGProperty* p, wxPGPropertyValues
return;
// Never sort children of aggregate properties
if ( p->HasFlag(wxPG_PROP_AGGREGATE) )
if ( p->HasFlag(wxPGPropertyFlags::Aggregate) )
return;
if ( !!(flags & wxPGPropertyValuesFlags::SortTopLevelOnly)
@ -1385,12 +1385,12 @@ wxVariant wxPropertyGridPageState::DoGetPropertyValues(const wxString& listname,
{
if ( !!(flags & wxPGPropertyValuesFlags::KeepStructure) )
{
wxASSERT( !pwc->HasFlag(wxPG_PROP_AGGREGATE) );
wxASSERT( !pwc->HasFlag(wxPGPropertyFlags::Aggregate) );
for ( unsigned int i = 0; i < pwc->GetChildCount(); i++ )
{
wxPGProperty* p = pwc->Item(i);
if ( !p->HasAnyChild() || p->HasFlag(wxPG_PROP_AGGREGATE) )
if ( !p->HasAnyChild() || p->HasFlag(wxPGPropertyFlags::Aggregate) )
{
wxVariant variant = p->GetValue();
variant.SetName( p->GetBaseName() );
@ -1414,7 +1414,7 @@ wxVariant wxPropertyGridPageState::DoGetPropertyValues(const wxString& listname,
const wxPGProperty* p = it.GetProperty();
// Use a trick to ignore wxParentProperty itself, but not its sub-properties.
if ( !p->HasAnyChild() || p->HasFlag(wxPG_PROP_AGGREGATE) )
if ( !p->HasAnyChild() || p->HasFlag(wxPGPropertyFlags::Aggregate) )
{
wxVariant variant = p->GetValue();
variant.SetName( p->GetName() );
@ -1669,7 +1669,7 @@ wxPGProperty* wxPropertyGridPageState::DoInsert( wxPGProperty* parent, int index
if ( !parent )
parent = m_properties;
wxCHECK_MSG( !parent->HasFlag(wxPG_PROP_AGGREGATE),
wxCHECK_MSG( !parent->HasFlag(wxPGPropertyFlags::Aggregate),
wxNullProperty,
wxS("when adding properties to fixed parents, use BeginAddChildren and EndAddChildren.") );
@ -1739,7 +1739,7 @@ wxPGProperty* wxPropertyGridPageState::DoInsert( wxPGProperty* parent, int index
// Update editor controls of all parents if they are containers of composed values.
for( wxPGProperty *p = property->GetParent();
p && !p->IsRoot() && !p->IsCategory() && p->HasFlag(wxPG_PROP_COMPOSED_VALUE);
p && !p->IsRoot() && !p->IsCategory() && p->HasFlag(wxPGPropertyFlags::ComposedValue);
p = p->GetParent() )
{
p->RefreshEditor();
@ -1787,7 +1787,7 @@ void wxPropertyGridPageState::DoMarkChildrenAsDeleted(wxPGProperty* p,
{
wxPGProperty* child = p->Item(i);
child->SetFlag(wxPG_PROP_BEING_DELETED);
child->SetFlag(wxPGPropertyFlags::BeingDeleted);
if ( recursive )
{
@ -1890,7 +1890,7 @@ void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete )
wxPGProperty* parent = item->GetParent();
wxCHECK_RET( !parent->HasFlag(wxPG_PROP_AGGREGATE),
wxCHECK_RET( !parent->HasFlag(wxPGPropertyFlags::Aggregate),
wxS("wxPropertyGrid: Do not attempt to remove sub-properties.") );
wxASSERT( item->GetParentState() == this );
@ -1957,13 +1957,13 @@ void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete )
wxS("Current category cannot be deleted") );
// Prevent property and its children from being re-selected
item->SetFlag(wxPG_PROP_BEING_DELETED);
item->SetFlag(wxPGPropertyFlags::BeingDeleted);
DoMarkChildrenAsDeleted(item, true);
unsigned int indinparent = item->GetIndexInParent();
// Delete children
if ( item->HasAnyChild() && !item->HasFlag(wxPG_PROP_AGGREGATE) )
if ( item->HasAnyChild() && !item->HasFlag(wxPGPropertyFlags::Aggregate) )
{
// deleting a category
item->DeleteChildren();

View file

@ -59,9 +59,9 @@ wxStringProperty::wxStringProperty( const wxString& label,
void wxStringProperty::OnSetValue()
{
if ( !m_value.IsNull() && m_value.GetString() == wxS("<composed>") )
SetFlag(wxPG_PROP_COMPOSED_VALUE);
SetFlag(wxPGPropertyFlags::ComposedValue);
if ( HasFlag(wxPG_PROP_COMPOSED_VALUE) )
if ( HasFlag(wxPGPropertyFlags::ComposedValue) )
{
wxString s;
DoGenerateComposedValue(s);
@ -74,7 +74,7 @@ wxString wxStringProperty::ValueToString( wxVariant& value,
{
wxString s = value.GetString();
if ( HasAnyChild() && HasFlag(wxPG_PROP_COMPOSED_VALUE) )
if ( HasAnyChild() && HasFlag(wxPGPropertyFlags::ComposedValue) )
{
// Value stored in m_value is non-editable, non-full value
if ( (argFlags & wxPG_FULL_VALUE) ||
@ -94,7 +94,7 @@ wxString wxStringProperty::ValueToString( wxVariant& value,
// If string is password and value is for visual purposes,
// then return asterisks instead the actual string.
if ( (m_flags & wxPG_PROP_PASSWORD) && !(argFlags & (wxPG_FULL_VALUE|wxPG_EDITABLE_VALUE)) )
if ( !!(m_flags & wxPGPropertyFlags_Password) && !(argFlags & (wxPG_FULL_VALUE|wxPG_EDITABLE_VALUE)) )
return wxString(wxS('*'), s.length());
return s;
@ -102,7 +102,7 @@ wxString wxStringProperty::ValueToString( wxVariant& value,
bool wxStringProperty::StringToValue( wxVariant& variant, const wxString& text, int argFlags ) const
{
if ( HasAnyChild() && HasFlag(wxPG_PROP_COMPOSED_VALUE) )
if ( HasAnyChild() && HasFlag(wxPGPropertyFlags::ComposedValue) )
return wxPGProperty::StringToValue(variant, text, argFlags);
if ( variant != text )
@ -118,7 +118,7 @@ bool wxStringProperty::DoSetAttribute( const wxString& name, wxVariant& value )
{
if ( name == wxPG_STRING_PASSWORD )
{
ChangeFlag(wxPG_PROP_PASSWORD, value.GetBool());
ChangeFlag(wxPGPropertyFlags_Password, value.GetBool());
RecreateEditor();
return true;
}
@ -1031,7 +1031,7 @@ const wxPGEditor* wxBoolProperty::DoGetEditorClass() const
{
// Select correct editor control.
#if wxPG_INCLUDE_CHECKBOX
if ( !(m_flags & wxPG_PROP_USE_CHECKBOX) )
if ( !(m_flags & wxPGPropertyFlags_UseCheckBox) )
return wxPGEditor_Choice;
return wxPGEditor_CheckBox;
#else
@ -1046,7 +1046,7 @@ wxBoolProperty::wxBoolProperty( const wxString& label, const wxString& name, boo
SetValue(wxVariant(value));
m_flags |= wxPG_PROP_USE_DCC;
m_flags |= wxPGPropertyFlags_UseDCC;
}
wxString wxBoolProperty::ValueToString( wxVariant& value,
@ -1124,13 +1124,13 @@ bool wxBoolProperty::DoSetAttribute( const wxString& name, wxVariant& value )
#if wxPG_INCLUDE_CHECKBOX
if ( name == wxPG_BOOL_USE_CHECKBOX )
{
ChangeFlag(wxPG_PROP_USE_CHECKBOX, value.GetBool());
ChangeFlag(wxPGPropertyFlags_UseCheckBox, value.GetBool());
return true;
}
#endif
if ( name == wxPG_BOOL_USE_DOUBLE_CLICK_CYCLING )
{
ChangeFlag(wxPG_PROP_USE_DCC, value.GetBool());
ChangeFlag(wxPGPropertyFlags_UseDCC, value.GetBool());
return true;
}
return wxPGProperty::DoSetAttribute(name, value);
@ -1467,8 +1467,8 @@ void wxFlagsProperty::Init(long value)
// Relay wxPG_BOOL_USE_CHECKBOX and wxPG_BOOL_USE_DOUBLE_CLICK_CYCLING
// to child bool property controls.
bool attrUseCheckBox = (m_flags & wxPG_PROP_USE_CHECKBOX) != 0;
bool attrUseDCC = (m_flags & wxPG_PROP_USE_DCC) != 0;
bool attrUseCheckBox = !!(m_flags & wxPGPropertyFlags_UseCheckBox);
bool attrUseDCC = !!(m_flags & wxPGPropertyFlags_UseDCC);
for ( unsigned int i = 0; i < GetItemCount(); i++ )
{
bool child_val = (value & m_choices.GetValue(i)) != 0;
@ -1495,7 +1495,7 @@ void wxFlagsProperty::Init(long value)
wxFlagsProperty::wxFlagsProperty( const wxString& label, const wxString& name,
const wxChar* const* labels, const long* values, long value ) : wxPGProperty(label,name)
{
m_flags |= wxPG_PROP_USE_DCC; // same default like wxBoolProperty
m_flags |= wxPGPropertyFlags_UseDCC; // same default like wxBoolProperty
if ( labels )
{
@ -1517,7 +1517,7 @@ wxFlagsProperty::wxFlagsProperty( const wxString& label, const wxString& name,
const wxArrayString& labels, const wxArrayInt& values, int value )
: wxPGProperty(label,name)
{
m_flags |= wxPG_PROP_USE_DCC; // same default like wxBoolProperty
m_flags |= wxPGPropertyFlags_UseDCC; // same default like wxBoolProperty
if ( !labels.empty() )
{
@ -1539,7 +1539,7 @@ wxFlagsProperty::wxFlagsProperty( const wxString& label, const wxString& name,
wxPGChoices& choices, long value )
: wxPGProperty(label,name)
{
m_flags |= wxPG_PROP_USE_DCC; // same default like wxBoolProperty
m_flags |= wxPGPropertyFlags_UseDCC; // same default like wxBoolProperty
if ( choices.IsOk() )
{
@ -1580,7 +1580,7 @@ void wxFlagsProperty::OnSetValue()
long flag = m_choices.GetValue(i);
if ( (newFlags & flag) != (m_oldValue & flag) )
Item(i)->ChangeFlag( wxPG_PROP_MODIFIED, true );
Item(i)->ChangeFlag(wxPGPropertyFlags::Modified, true );
}
m_oldValue = newFlags;
@ -1681,7 +1681,7 @@ void wxFlagsProperty::RefreshChildren()
wxPGProperty* p = Item(i);
if ( subVal != (m_oldValue & flag) )
p->ChangeFlag( wxPG_PROP_MODIFIED, true );
p->ChangeFlag(wxPGPropertyFlags::Modified, true );
p->SetValue( subVal == flag?true:false );
}
@ -1707,7 +1707,7 @@ bool wxFlagsProperty::DoSetAttribute( const wxString& name, wxVariant& value )
{
if ( name == wxPG_BOOL_USE_CHECKBOX )
{
ChangeFlag(wxPG_PROP_USE_CHECKBOX, value.GetBool());
ChangeFlag(wxPGPropertyFlags_UseCheckBox, value.GetBool());
for ( wxPGProperty* child : m_children )
{
@ -1717,7 +1717,7 @@ bool wxFlagsProperty::DoSetAttribute( const wxString& name, wxVariant& value )
}
else if ( name == wxPG_BOOL_USE_DOUBLE_CLICK_CYCLING )
{
ChangeFlag(wxPG_PROP_USE_DCC, value.GetBool());
ChangeFlag(wxPGPropertyFlags_UseDCC, value.GetBool());
for ( wxPGProperty* child : m_children )
{
@ -1737,7 +1737,7 @@ wxPG_IMPLEMENT_PROPERTY_CLASS(wxDirProperty, wxEditorDialogProperty, TextCtrlAnd
wxDirProperty::wxDirProperty( const wxString& label, const wxString& name, const wxString& value )
: wxEditorDialogProperty(label, name)
{
m_flags &= ~wxPG_PROP_ACTIVE_BTN; // Property button enabled only in not read-only mode.
m_flags &= ~wxPGPropertyFlags_ActiveButton; // Property button enabled only in not read-only mode.
SetValue(value);
}
@ -1867,8 +1867,8 @@ wxFileProperty::wxFileProperty( const wxString& label, const wxString& name,
const wxString& value )
: wxEditorDialogProperty(label, name)
{
m_flags |= wxPG_PROP_SHOW_FULL_FILENAME;
m_flags &= ~wxPG_PROP_ACTIVE_BTN; // Property button enabled only in not read-only mode.
m_flags |= wxPGPropertyFlags_ShowFullFileName;
m_flags &= ~wxPGPropertyFlags_ActiveButton; // Property button enabled only in not read-only mode.
m_indFilter = -1;
m_wildcard = wxALL_FILES;
@ -1974,7 +1974,7 @@ wxString wxFileProperty::ValueToString( wxVariant& value,
{
return filename.GetFullPath();
}
else if ( m_flags & wxPG_PROP_SHOW_FULL_FILENAME )
else if ( !!(m_flags & wxPGPropertyFlags::ShowFullFileName) )
{
if ( !m_basePath.empty() )
{
@ -1992,7 +1992,7 @@ bool wxFileProperty::StringToValue( wxVariant& variant, const wxString& text, in
{
wxFileName filename = variant.GetString();
if ( (m_flags & wxPG_PROP_SHOW_FULL_FILENAME) || (argFlags & wxPG_FULL_VALUE) )
if ( !!(m_flags & wxPGPropertyFlags::ShowFullFileName) || (argFlags & wxPG_FULL_VALUE) )
{
if ( filename != text )
{
@ -2018,7 +2018,7 @@ bool wxFileProperty::DoSetAttribute( const wxString& name, wxVariant& value )
{
if ( name == wxPG_FILE_SHOW_FULL_PATH )
{
ChangeFlag(wxPG_PROP_SHOW_FULL_FILENAME, value.GetBool());
ChangeFlag(wxPGPropertyFlags_ShowFullFileName, value.GetBool());
return true;
}
else if ( name == wxPG_FILE_WILDCARD )
@ -2031,7 +2031,7 @@ bool wxFileProperty::DoSetAttribute( const wxString& name, wxVariant& value )
m_basePath = value.GetString();
// Make sure wxPG_FILE_SHOW_FULL_PATH is also set
m_flags |= wxPG_PROP_SHOW_FULL_FILENAME;
m_flags |= wxPGPropertyFlags_ShowFullFileName;
return true;
}
else if ( name == wxPG_FILE_INITIAL_PATH )
@ -2095,7 +2095,7 @@ wxLongStringProperty::wxLongStringProperty( const wxString& label, const wxStrin
const wxString& value )
: wxEditorDialogProperty(label, name)
{
m_flags |= wxPG_PROP_ACTIVE_BTN; // Property button always enabled.
m_flags |= wxPGPropertyFlags_ActiveButton; // Property button always enabled.
m_dlgStyle = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxCLIP_CHILDREN;
SetValue(value);
}
@ -2122,7 +2122,7 @@ bool wxLongStringProperty::DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& va
wxBoxSizer* topsizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* rowsizer = new wxBoxSizer( wxHORIZONTAL );
long edStyle = wxTE_MULTILINE;
if ( HasFlag(wxPG_PROP_READONLY) )
if ( HasFlag(wxPGPropertyFlags::ReadOnly) )
edStyle |= wxTE_READONLY;
wxString strVal;
wxPropertyGrid::ExpandEscapeSequences(strVal, value.GetString());
@ -2135,7 +2135,7 @@ bool wxLongStringProperty::DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& va
topsizer->Add(rowsizer, wxSizerFlags(1).Expand());
long btnSizerFlags = wxCANCEL;
if ( !HasFlag(wxPG_PROP_READONLY) )
if ( !HasFlag(wxPGPropertyFlags::ReadOnly) )
btnSizerFlags |= wxOK;
wxStdDialogButtonSizer* buttonSizer = dlg->CreateStdDialogButtonSizer(btnSizerFlags);
topsizer->Add(buttonSizer, wxSizerFlags(0).Right().Border(wxBOTTOM|wxRIGHT, spacing));

View file

@ -507,7 +507,7 @@ TEST_CASE("PropertyGridTestCase", "[propgrid]")
wxPGProperty* p = it.GetProperty();
if ( p->IsCategory() )
FAIL_CHECK(wxString::Format("'%s' is a category (non-private child property expected)", p->GetLabel()).c_str());
else if ( p->GetParent()->HasFlag(wxPG_PROP_AGGREGATE) )
else if ( p->GetParent()->HasFlag(wxPGPropertyFlags::Aggregate) )
FAIL_CHECK(wxString::Format("'%s' is a private child (non-private child property expected)", p->GetLabel()).c_str());
count++;
}
@ -527,7 +527,7 @@ TEST_CASE("PropertyGridTestCase", "[propgrid]")
for ( auto it = pgManager->GetVIterator(wxPG_ITERATE_PROPERTIES | wxPG_ITERATE_CATEGORIES); !it.AtEnd(); it.Next() )
{
wxPGProperty* p = it.GetProperty();
if ( p->GetParent()->HasFlag(wxPG_PROP_AGGREGATE) )
if ( p->GetParent()->HasFlag(wxPGPropertyFlags::Aggregate) )
FAIL_CHECK(wxString::Format("'%s' is a private child (non-private child property or category expected)", p->GetLabel()).c_str());
count++;
}
@ -539,7 +539,7 @@ TEST_CASE("PropertyGridTestCase", "[propgrid]")
wxPGProperty* p = it.GetProperty();
if ( (p->GetParent() != p->GetGrid()->GetRoot() && !p->GetParent()->IsExpanded()) )
FAIL_CHECK(wxString::Format("'%s' had collapsed parent (only visible properties expected)", p->GetLabel()).c_str());
else if ( p->HasFlag(wxPG_PROP_HIDDEN) )
else if ( p->HasFlag(wxPGPropertyFlags::Hidden) )
FAIL_CHECK(wxString::Format("'%s' was hidden (only visible properties expected)", p->GetLabel()).c_str());
count++;
}
@ -697,7 +697,7 @@ TEST_CASE("PropertyGridTestCase", "[propgrid]")
// Delete everything in reverse order
std::vector<wxPGProperty*> array;
for ( auto it = pgManager->GetVIterator(wxPG_ITERATE_ALL & ~(wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE))); !it.AtEnd(); it.Next() )
for ( auto it = pgManager->GetVIterator(wxPG_ITERATE_ALL & ~(wxPG_IT_CHILDREN(wxPGPropertyFlags::Aggregate))); !it.AtEnd(); it.Next() )
{
array.push_back(it.GetProperty());
}
@ -710,7 +710,7 @@ TEST_CASE("PropertyGridTestCase", "[propgrid]")
}
// Check if grid is empty.
auto it = pgManager->GetVIterator(wxPG_ITERATE_ALL & ~(wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE)));
auto it = pgManager->GetVIterator(wxPG_ITERATE_ALL & ~(wxPG_IT_CHILDREN(wxPGPropertyFlags::Aggregate)));
if ( !it.AtEnd() )
{
FAIL_CHECK("Not all properties are deleted");
@ -1597,22 +1597,22 @@ TEST_CASE("PropertyGridTestCase", "[propgrid]")
wxPGProperty* p = *it;
// Save initial flags
wxPGProperty::FlagType oldFlags = 0;
if ( p->HasFlag(wxPG_PROP_COLLAPSED) )
wxPGPropertyFlags oldFlags = wxPGPropertyFlags::Null;
if ( p->HasFlag(wxPGPropertyFlags::Collapsed) )
{
oldFlags |= wxPG_PROP_COLLAPSED;
oldFlags |= wxPGPropertyFlags::Collapsed;
}
if ( p->HasFlag(wxPG_PROP_DISABLED) )
if ( p->HasFlag(wxPGPropertyFlags::Disabled) )
{
oldFlags |= wxPG_PROP_DISABLED;
oldFlags |= wxPGPropertyFlags::Disabled;
}
if ( p->HasFlag(wxPG_PROP_HIDDEN) )
if ( p->HasFlag(wxPGPropertyFlags::Hidden) )
{
oldFlags |= wxPG_PROP_HIDDEN;
oldFlags |= wxPGPropertyFlags::Hidden;
}
if ( p->HasFlag(wxPG_PROP_NOEDITOR) )
if ( p->HasFlag(wxPGPropertyFlags::NoEditor) )
{
oldFlags |= wxPG_PROP_NOEDITOR;
oldFlags |= wxPGPropertyFlags::NoEditor;
}
wxString flags;
@ -1652,37 +1652,37 @@ TEST_CASE("PropertyGridTestCase", "[propgrid]")
// Verify if flags have been properly set
if ( flags.Find("COLLAPSED") != wxNOT_FOUND &&
!p->HasFlag(wxPG_PROP_COLLAPSED) )
!p->HasFlag(wxPGPropertyFlags::Collapsed) )
{
FAIL_CHECK(wxString::Format("Error setting flag from string 'COLLAPSED' for property '%s'",
p->GetName()).c_str());
}
if ( flags.Find("COLLAPSED") == wxNOT_FOUND &&
p->HasFlag(wxPG_PROP_COLLAPSED) )
p->HasFlag(wxPGPropertyFlags::Collapsed) )
{
FAIL_CHECK(wxString::Format("Error resetting flag from string 'COLLAPSED'for property '%s'",
p->GetName()).c_str());
}
if ( flags.Find("DISABLED") != wxNOT_FOUND &&
!p->HasFlag(wxPG_PROP_DISABLED) )
!p->HasFlag(wxPGPropertyFlags::Disabled) )
{
FAIL_CHECK(wxString::Format("Error setting flag from string 'DISABLED' for property '%s'",
p->GetName()).c_str());
}
if ( flags.Find("DISABLED") == wxNOT_FOUND &&
p->HasFlag(wxPG_PROP_DISABLED) )
p->HasFlag(wxPGPropertyFlags::Disabled) )
{
FAIL_CHECK(wxString::Format("Error resetting flag from string 'DISABLED' for property '%s'",
p->GetName()).c_str());
}
if ( flags.Find("HIDDEN") != wxNOT_FOUND &&
!p->HasFlag(wxPG_PROP_HIDDEN) )
!p->HasFlag(wxPGPropertyFlags::Hidden) )
{
FAIL_CHECK(wxString::Format("Error setting flag from string 'HIDDEN' for property '%s'",
p->GetName()).c_str());
}
if ( flags.Find("HIDDEN") == wxNOT_FOUND &&
p->HasFlag(wxPG_PROP_HIDDEN) )
p->HasFlag(wxPGPropertyFlags::Hidden) )
{
FAIL_CHECK(wxString::Format("Error resetting flag from string 'HIDDEN' for property '%s'",
p->GetName()).c_str());
@ -1691,8 +1691,8 @@ TEST_CASE("PropertyGridTestCase", "[propgrid]")
// Get individual flags
bool ok;
flags = p->GetFlagsAsString(wxPG_PROP_COLLAPSED);
if ( p->HasFlag(wxPG_PROP_COLLAPSED) )
flags = p->GetFlagsAsString(wxPGPropertyFlags::Collapsed);
if ( p->HasFlag(wxPGPropertyFlags::Collapsed) )
{
ok = (flags == "COLLAPSED");
}
@ -1702,12 +1702,12 @@ TEST_CASE("PropertyGridTestCase", "[propgrid]")
}
if ( !ok )
{
FAIL_CHECK(wxString::Format("Invalid string for wxPG_PROP_COLLAPSED flag for property '%s'",
FAIL_CHECK(wxString::Format("Invalid string for wxPGPropertyFlags::Collapsed flag for property '%s'",
p->GetName()).c_str());
}
flags = p->GetFlagsAsString(wxPG_PROP_DISABLED);
if ( p->HasFlag(wxPG_PROP_DISABLED) )
flags = p->GetFlagsAsString(wxPGPropertyFlags::Disabled);
if ( p->HasFlag(wxPGPropertyFlags::Disabled) )
{
ok = (flags == "DISABLED");
}
@ -1717,12 +1717,12 @@ TEST_CASE("PropertyGridTestCase", "[propgrid]")
}
if ( !ok )
{
FAIL_CHECK(wxString::Format("Invalid string for wxPG_PROP_DISABLED flag for property '%s'",
FAIL_CHECK(wxString::Format("Invalid string for wxPGPropertyFlags::Disabled flag for property '%s'",
p->GetName()).c_str());
}
flags = p->GetFlagsAsString(wxPG_PROP_HIDDEN);
if ( p->HasFlag(wxPG_PROP_HIDDEN) )
flags = p->GetFlagsAsString(wxPGPropertyFlags::Hidden);
if ( p->HasFlag(wxPGPropertyFlags::Hidden) )
{
ok = (flags == "HIDDEN");
}
@ -1732,12 +1732,12 @@ TEST_CASE("PropertyGridTestCase", "[propgrid]")
}
if ( !ok )
{
FAIL_CHECK(wxString::Format("Invalid string for wxPG_PROP_HIDDEN flag for property '%s'",
FAIL_CHECK(wxString::Format("Invalid string for wxPGPropertyFlags::Hidden flag for property '%s'",
p->GetName()).c_str());
}
flags = p->GetFlagsAsString(wxPG_PROP_NOEDITOR);
if ( p->HasFlag(wxPG_PROP_NOEDITOR) )
flags = p->GetFlagsAsString(wxPGPropertyFlags::NoEditor);
if ( p->HasFlag(wxPGPropertyFlags::NoEditor) )
{
ok = (flags == "NOEDITOR");
}
@ -1747,13 +1747,13 @@ TEST_CASE("PropertyGridTestCase", "[propgrid]")
}
if ( !ok )
{
FAIL_CHECK(wxString::Format("Invalid string for wxPG_PROP_NOEDITOR flag for property '%s'",
FAIL_CHECK(wxString::Format("Invalid string for wxPGPropertyFlags::NoEditor flag for property '%s'",
p->GetName()).c_str());
}
// Get all flags
flags = p->GetFlagsAsString(wxPG_STRING_STORED_FLAGS);
if ( p->HasFlag(wxPG_PROP_COLLAPSED) )
flags = p->GetFlagsAsString(wxPGPropertyFlags::StringStoredFlags);
if ( p->HasFlag(wxPGPropertyFlags::Collapsed) )
{
ok = (flags.Find("COLLAPSED") != wxNOT_FOUND);
}
@ -1763,11 +1763,11 @@ TEST_CASE("PropertyGridTestCase", "[propgrid]")
}
if ( !ok )
{
FAIL_CHECK(wxString::Format("Invalid string for wxPG_PROP_COLLAPSED flag for property '%s'",
FAIL_CHECK(wxString::Format("Invalid string for wxPGPropertyFlags::Collapsed flag for property '%s'",
p->GetName()).c_str());
}
if ( p->HasFlag(wxPG_PROP_DISABLED) )
if ( p->HasFlag(wxPGPropertyFlags::Disabled) )
{
ok = (flags.Find("DISABLED") != wxNOT_FOUND);
}
@ -1777,11 +1777,11 @@ TEST_CASE("PropertyGridTestCase", "[propgrid]")
}
if ( !ok )
{
FAIL_CHECK(wxString::Format("Invalid string for wxPG_PROP_DISBALED flag for property '%s'",
FAIL_CHECK(wxString::Format("Invalid string for wxPGPropertyFlags::Disabled flag for property '%s'",
p->GetName()).c_str());
}
if ( p->HasFlag(wxPG_PROP_HIDDEN) )
if ( p->HasFlag(wxPGPropertyFlags::Hidden) )
{
ok = (flags.Find("HIDDEN") != wxNOT_FOUND);
}
@ -1791,11 +1791,11 @@ TEST_CASE("PropertyGridTestCase", "[propgrid]")
}
if ( !ok )
{
FAIL_CHECK(wxString::Format("Invalid string for wxPG_PROP_HIDDEN flag for property '%s'",
FAIL_CHECK(wxString::Format("Invalid string for wxPGPropertyFlags::Hidden flag for property '%s'",
p->GetName()).c_str());
}
if ( p->HasFlag(wxPG_PROP_NOEDITOR) )
if ( p->HasFlag(wxPGPropertyFlags::NoEditor) )
{
ok = (flags.Find("NOEDITOR") != wxNOT_FOUND);
}
@ -1805,15 +1805,15 @@ TEST_CASE("PropertyGridTestCase", "[propgrid]")
}
if ( !ok )
{
FAIL_CHECK(wxString::Format("Invalid string for wxPG_PROP_NOEDITOR flag for property '%s'",
FAIL_CHECK(wxString::Format("Invalid string for wxPGPropertyFlags::NoEditor flag for property '%s'",
p->GetName()).c_str());
}
// Restore original flags
p->ChangeFlag(wxPG_PROP_COLLAPSED, (oldFlags & wxPG_PROP_COLLAPSED) != 0);
p->ChangeFlag(wxPG_PROP_DISABLED, (oldFlags & wxPG_PROP_DISABLED) != 0);
p->ChangeFlag(wxPG_PROP_HIDDEN, (oldFlags & wxPG_PROP_HIDDEN) != 0);
p->ChangeFlag(wxPG_PROP_NOEDITOR, (oldFlags & wxPG_PROP_NOEDITOR) != 0);
p->ChangeFlag(wxPGPropertyFlags::Collapsed, !!(oldFlags & wxPGPropertyFlags::Collapsed));
p->ChangeFlag(wxPGPropertyFlags::Disabled, !!(oldFlags & wxPGPropertyFlags::Disabled));
p->ChangeFlag(wxPGPropertyFlags::Hidden, !!(oldFlags & wxPGPropertyFlags::Hidden));
p->ChangeFlag(wxPGPropertyFlags::NoEditor, !!(oldFlags & wxPGPropertyFlags::NoEditor));
}
}
}