Use class enums to implement bitmask types

To improve type safety of flags.
This commit is contained in:
Artur Wieczorek 2023-02-19 22:12:09 +02:00
parent 0c321cd039
commit f1273ce152
19 changed files with 913 additions and 547 deletions

View file

@ -128,10 +128,17 @@ public:
protected:
// Propagate to other pages.
virtual void DoSetSplitterPosition( int pos,
int splitterColumn = 0,
int flags = wxPG_SPLITTER_REFRESH ) override;
// Propagate to other pages
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use DoSetSplitterPosition with flags argument as wxPGSplitterPositionFlags")
virtual void DoSetSplitterPosition(int pos, int splitterColumn, int flags) override
{
DoSetSplitterPosition(pos, splitterColumn, static_cast<wxPGSplitterPositionFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual void DoSetSplitterPosition(int pos,
int splitterColumn = 0,
wxPGSplitterPositionFlags flags = wxPGSplitterPositionFlags::Refresh) override;
// Page label (may be referred as name in some parts of documentation).
// Can be set in constructor, or passed in
@ -216,7 +223,14 @@ public:
// Forces updating the value of property from the editor control.
// Returns true if DoPropertyChanged was actually called.
bool CommitChangesFromEditor( wxUint32 flags = 0 )
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use CommitChangesFromEditor with wxPGSelectPropertyFlags argument")
bool CommitChangesFromEditor(wxUint32 flags)
{
return CommitChangesFromEditor(static_cast<wxPGSelectPropertyFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
bool CommitChangesFromEditor(wxPGSelectPropertyFlags flags = wxPGSelectPropertyFlags::Null)
{
return m_pPropGrid->CommitChangesFromEditor(flags);
}
@ -426,9 +440,9 @@ public:
bool SelectProperty( wxPGPropArg id, bool focus = false )
{
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
unsigned int flags = wxPG_SEL_DONT_SEND_EVENT;
wxPGSelectPropertyFlags flags = wxPGSelectPropertyFlags::DontSendEvent;
if ( focus )
flags |= wxPG_SEL_FOCUS;
flags |= wxPGSelectPropertyFlags::Focus;
return p->GetParentState()->DoSelectProperty(p, flags);
}

View file

@ -1504,8 +1504,15 @@ public:
// Hides or reveals the property.
// hide - true for hide, false for reveal.
// flags - By default changes are applied recursively. Set this
// parameter to wxPG_DONT_RECURSE to prevent this.
bool Hide( bool hide, int flags = wxPG_RECURSE );
// parameter to wxPGPropertyValuesFlags::DontRecurse to prevent this.
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use Hide with flags argument as wxPGPropertyValuesFlags")
bool Hide(bool hide, int flags)
{
return Hide(hide, static_cast<wxPGPropertyValuesFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
bool Hide(bool hide, wxPGPropertyValuesFlags = wxPGPropertyValuesFlags::Recurse);
// Returns true if property has visible children.
bool IsExpanded() const
@ -1546,25 +1553,47 @@ public:
// Sets property's background colour.
// colour - Background colour to use.
// flags - Default is wxPG_RECURSE which causes colour to be set recursively.
// flags - Default is wxPGPropertyValuesFlags::Recurse which causes colour to be set recursively.
// Omit this flag to only set colour for the property in question
// and not any of its children.
void SetBackgroundColour( const wxColour& colour,
int flags = wxPG_RECURSE );
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use SetBackgroundColour with flags argument as wxPGPropertyValuesFlags")
void SetBackgroundColour(const wxColour& colour, int flags)
{
SetBackgroundColour(colour, static_cast<wxPGPropertyValuesFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
void SetBackgroundColour(const wxColour& colour,
wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::Recurse);
// Sets property's text colour.
// colour - Text colour to use.
// flags - Default is wxPG_RECURSE which causes colour to be set recursively.
// flags - Default is wxPGPropertyValuesFlags::Recurse which causes colour to be set recursively.
// Omit this flag to only set colour for the property in question
// and not any of its children.
void SetTextColour( const wxColour& colour,
int flags = wxPG_RECURSE );
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use SetTextColour with flags argument as wxPGPropertyValuesFlags")
void SetTextColour(const wxColour& colour, int flags)
{
SetTextColour(colour, static_cast<wxPGPropertyValuesFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
void SetTextColour(const wxColour& colour,
wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::Recurse);
// Sets property's default text and background colours.
// flags - Default is wxPG_RECURSE which causes colours to be set recursively.
// flags - Default is wxPGPropertyValuesFlags::Recurse
// which causes colours to be set recursively.
// Omit this flag to only set colours for the property in question
// and not any of its children.
void SetDefaultColours(int flags = wxPG_RECURSE);
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use SetDefaultColours with wxPGPropertyValuesFlags argument")
void SetDefaultColours(int flags)
{
SetDefaultColours(static_cast<wxPGPropertyValuesFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
void SetDefaultColours(wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::Recurse);
// Set default value of a property. Synonymous to
// SetAttribute("DefaultValue", value);
@ -1618,10 +1647,17 @@ public:
// SetValueInEvent() instead.
// pList - Pointer to list variant that contains child values. Used to
// indicate which children should be marked as modified.
// flags - Various flags (for instance, wxPG_SETVAL_REFRESH_EDITOR, which
// is enabled by default).
void SetValue( wxVariant value, wxVariant* pList = nullptr,
int flags = wxPG_SETVAL_REFRESH_EDITOR );
// flags - Various flags (for instance, wxPGSetValueFlags::RefreshEditor,
// which is enabled by default).
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use SetValue with flags argument as wxPGSetValueFlags")
void SetValue(wxVariant value, wxVariant* pList, int flags)
{
SetValue(value, pList, static_cast<wxPGSetValueFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
void SetValue(wxVariant value, wxVariant* pList = nullptr,
wxPGSetValueFlags flags = wxPGSetValueFlags::RefreshEditor);
// Set wxBitmap in front of the value. This bitmap may be ignored
// by custom cell renderers.
@ -1685,7 +1721,7 @@ public:
void SetValueToUnspecified()
{
wxVariant val; // Create null variant
SetValue(val, nullptr, wxPG_SETVAL_REFRESH_EDITOR);
SetValue(val, nullptr, wxPGSetValueFlags::RefreshEditor);
}
// Helper function (for wxPython bindings and such) for settings protected
@ -1905,7 +1941,7 @@ protected:
const wxVariantList* valueOverrides = nullptr,
wxPGHashMapS2S* childResults = nullptr ) const;
bool DoHide( bool hide, int flags );
bool DoHide( bool hide, wxPGPropertyValuesFlags flags );
void DoSetName(const wxString& str) { m_name = str; }

View file

@ -344,52 +344,6 @@ protected:
// -----------------------------------------------------------------------
// wxPropertyGrid Validation Failure behaviour Flags
enum wxPG_VALIDATION_FAILURE_BEHAVIOR_FLAGS
{
// Prevents user from leaving property unless value is valid. If this
// behaviour flag is not used, then value change is instead cancelled.
wxPG_VFB_STAY_IN_PROPERTY = 0x01,
// Calls wxBell() on validation failure.
wxPG_VFB_BEEP = 0x02,
// Cell with invalid value will be marked (with red colour).
wxPG_VFB_MARK_CELL = 0x04,
// Display a text message explaining the situation.
// To customize the way the message is displayed, you need to
// reimplement wxPropertyGrid::DoShowPropertyError() in a
// derived class. Default behaviour is to display the text on
// the top-level frame's status bar, if present, and otherwise
// using wxMessageBox.
wxPG_VFB_SHOW_MESSAGE = 0x08,
// Similar to wxPG_VFB_SHOW_MESSAGE, except always displays the
// message using wxMessageBox.
wxPG_VFB_SHOW_MESSAGEBOX = 0x10,
// Similar to wxPG_VFB_SHOW_MESSAGE, except always displays the
// message on the status bar (when present - you can reimplement
// wxPropertyGrid::GetStatusBar() in a derived class to specify
// this yourself).
wxPG_VFB_SHOW_MESSAGE_ON_STATUSBAR = 0x20,
// Defaults.
wxPG_VFB_DEFAULT = wxPG_VFB_MARK_CELL |
wxPG_VFB_SHOW_MESSAGEBOX,
// Only used internally.
wxPG_VFB_UNDEFINED = 0x80
};
// Having this as define instead of wxByte typedef makes things easier for
// wxPython bindings (ignoring and redefining it in SWIG interface file
// seemed rather tricky)
#define wxPGVFBFlags unsigned char
// Used to convey validation information to and from functions that
// actually perform validation. Mostly used in custom property
// classes.
@ -398,7 +352,7 @@ class WXDLLIMPEXP_PROPGRID wxPGValidationInfo
friend class wxPropertyGrid;
public:
wxPGValidationInfo()
: m_failureBehavior(0)
: m_failureBehavior(wxPGVFBFlags::Null)
, m_isFailing(false)
{
}
@ -406,7 +360,7 @@ public:
~wxPGValidationInfo() = default;
// Returns failure behaviour which is a combination of
// wxPG_VFB_XXX flags.
// wxPGVFBFlags::XXX flags.
wxPGVFBFlags GetFailureBehavior() const
{
return m_failureBehavior;
@ -425,7 +379,14 @@ public:
}
// Set validation failure behaviour
// failureBehavior - Mixture of wxPG_VFB_XXX flags.
// failureBehavior - Mixture of wxPGVFBFlags::XXX flags.
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use SetFailureBehavior with wxPGVFBFlags argument")
void SetFailureBehavior(int failureBehavior)
{
SetFailureBehavior(static_cast<wxPGVFBFlags>(failureBehavior));
}
#endif // WXWIN_COMPATIBILITY_3_2
void SetFailureBehavior(wxPGVFBFlags failureBehavior)
{
m_failureBehavior = failureBehavior;
@ -464,7 +425,7 @@ private:
// Message displayed on validation failure.
wxString m_failureMessage;
// Validation failure behaviour. Use wxPG_VFB_XXX flags.
// Validation failure behaviour. Use wxPGVFBFlags::XXX flags.
wxPGVFBFlags m_failureBehavior;
// True when validation is currently failing.
@ -505,44 +466,6 @@ enum wxPG_KEYBOARD_ACTIONS
wxPG_ACTION_MAX
};
// -----------------------------------------------------------------------
// wxPropertyGrid::DoSelectProperty flags (selFlags)
enum wxPG_SELECT_PROPERTY_FLAGS
{
// Focuses to created editor
wxPG_SEL_FOCUS = 0x0001,
// Forces deletion and recreation of editor
wxPG_SEL_FORCE = 0x0002,
// For example, doesn't cause EnsureVisible
wxPG_SEL_NONVISIBLE = 0x0004,
// Do not validate editor's value before selecting
wxPG_SEL_NOVALIDATE = 0x0008,
// Property being deselected is about to be deleted
wxPG_SEL_DELETING = 0x0010,
// Property's values was set to unspecified by the user
wxPG_SEL_SETUNSPEC = 0x0020,
// Property's event handler changed the value
wxPG_SEL_DIALOGVAL = 0x0040,
// Set to disable sending of wxEVT_PG_SELECTED event
wxPG_SEL_DONT_SEND_EVENT = 0x0080,
// Don't make any graphics updates
wxPG_SEL_NO_REFRESH = 0x0100
};
// -----------------------------------------------------------------------
// DoSetSplitterPosition() flags
enum wxPG_SET_SPLITTER_POSITION_SPLITTER_FLAGS
{
wxPG_SPLITTER_REFRESH = 0x0001,
wxPG_SPLITTER_ALL_PAGES = 0x0002,
wxPG_SPLITTER_FROM_EVENT = 0x0004,
wxPG_SPLITTER_FROM_AUTO_CENTER = 0x0008
};
// -----------------------------------------------------------------------
#if !defined(__wxPG_SOURCE_FILE__)
@ -690,7 +613,14 @@ public:
// Note that wxEVT_PG_CHANGING and wxEVT_PG_CHANGED are dispatched using
// ProcessEvent, meaning your event handlers will be called immediately.
// Returns true if anything was changed.
virtual bool CommitChangesFromEditor( wxUint32 flags = 0 );
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use CommitChangesFromEditor with wxPGSelectPropertyFlags argument")
virtual bool CommitChangesFromEditor(wxUint32 flags)
{
return CommitChangesFromEditor(static_cast<wxPGSelectPropertyFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool CommitChangesFromEditor(wxPGSelectPropertyFlags flags = wxPGSelectPropertyFlags::Null);
// Two step creation.
// Whenever the control is created without any parameters, use Create to
@ -913,7 +843,7 @@ public:
// Set entire new selection from given list of properties.
void SetSelection( const wxArrayPGProperty& newSelection )
{
DoSetSelection( newSelection, wxPG_SEL_DONT_SEND_EVENT );
DoSetSelection( newSelection, wxPGSelectPropertyFlags::DontSendEvent );
}
// Adds given property into selection. If wxPG_EX_MULTIPLE_SELECTION
@ -928,7 +858,7 @@ public:
bool AddToSelection( wxPGPropArg id )
{
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
return DoAddToSelection(p, wxPG_SEL_DONT_SEND_EVENT);
return DoAddToSelection(p, wxPGSelectPropertyFlags::DontSendEvent);
}
// Removes given property from selection. If property is not selected,
@ -936,7 +866,7 @@ public:
bool RemoveFromSelection( wxPGPropArg id )
{
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
return DoRemoveFromSelection(p, wxPG_SEL_DONT_SEND_EVENT);
return DoRemoveFromSelection(p, wxPGSelectPropertyFlags::DontSendEvent);
}
// Makes given column editable by user.
@ -952,7 +882,7 @@ public:
// column.
void BeginLabelEdit( unsigned int column = 0 )
{
DoBeginLabelEdit(column, wxPG_SEL_DONT_SEND_EVENT);
DoBeginLabelEdit(column, wxPGSelectPropertyFlags::DontSendEvent);
}
// Destroys label editor wxTextCtrl, if any.
@ -960,7 +890,7 @@ public:
// property cell data.
void EndLabelEdit( bool commit = true )
{
DoEndLabelEdit(commit, wxPG_SEL_DONT_SEND_EVENT);
DoEndLabelEdit(commit, wxPGSelectPropertyFlags::DontSendEvent);
}
// Returns currently active label editor, nullptr if none.
@ -1026,7 +956,7 @@ public:
// than desired splitter position, especially when sizers are being used.
void SetSplitterPosition( int newXPos, int col = 0 )
{
DoSetSplitterPosition(newXPos, col, wxPG_SPLITTER_REFRESH);
DoSetSplitterPosition(newXPos, col, wxPGSplitterPositionFlags::Refresh);
}
// Sets the property sorting function.
@ -1325,7 +1255,7 @@ public:
// Pending value is expected to be passed in PerformValidation().
virtual bool DoPropertyChanged( wxPGProperty* p,
unsigned int selFlags = 0 );
wxPGSelectPropertyFlags selFlags = wxPGSelectPropertyFlags::Null );
// Called when validation for given property fails.
// invalidValue - Value which failed in validation.
@ -1441,7 +1371,7 @@ public:
}
// Public methods for semi-public use
bool DoSelectProperty( wxPGProperty* p, unsigned int flags = 0 );
bool DoSelectProperty( wxPGProperty* p, wxPGSelectPropertyFlags flags = wxPGSelectPropertyFlags::Null );
// Overridden functions.
virtual bool Destroy() override;
@ -1764,7 +1694,7 @@ protected:
bool AddToSelectionFromInputEvent( wxPGProperty* prop,
unsigned int colIndex,
wxMouseEvent* event = nullptr,
int selFlags = 0 );
wxPGSelectPropertyFlags selFlags = wxPGSelectPropertyFlags::Null );
// Adjust the centering of the bitmap icons (collapse / expand) when the
// caption font changes.
@ -1839,23 +1769,23 @@ protected:
// editable.
bool DoSelectAndEdit( wxPGProperty* prop,
unsigned int colIndex,
unsigned int selFlags );
wxPGSelectPropertyFlags selFlags );
void DoSetSelection( const wxArrayPGProperty& newSelection,
int selFlags = 0 );
wxPGSelectPropertyFlags selFlags = wxPGSelectPropertyFlags::Null );
void DoSetSplitterPosition( int newxpos,
int splitterIndex = 0,
int flags = wxPG_SPLITTER_REFRESH );
wxPGSplitterPositionFlags flags = wxPGSplitterPositionFlags::Refresh );
bool DoAddToSelection( wxPGProperty* prop,
int selFlags = 0 );
wxPGSelectPropertyFlags selFlags = wxPGSelectPropertyFlags::Null );
bool DoRemoveFromSelection( wxPGProperty* prop,
int selFlags = 0 );
wxPGSelectPropertyFlags selFlags = wxPGSelectPropertyFlags::Null );
void DoBeginLabelEdit( unsigned int colIndex, int selFlags = 0 );
void DoEndLabelEdit( bool commit, int selFlags = 0 );
void DoBeginLabelEdit( unsigned int colIndex, wxPGSelectPropertyFlags selFlags = wxPGSelectPropertyFlags::Null );
void DoEndLabelEdit( bool commit, wxPGSelectPropertyFlags selFlags = wxPGSelectPropertyFlags::Null);
void OnLabelEditorEnterPress( wxCommandEvent& event );
void OnLabelEditorKeyPress( wxKeyEvent& event );
@ -1897,10 +1827,10 @@ protected:
void PrepareAfterItemsAdded();
// Send event from the property grid.
// Omit the wxPG_SEL_NOVALIDATE flag to allow vetoing the event
// Omit the wxPGSelectPropertyFlags::NoValidate flag to allow vetoing the event
bool SendEvent( wxEventType eventType, wxPGProperty* p,
wxVariant* pValue = nullptr,
unsigned int selFlags = wxPG_SEL_NOVALIDATE,
wxPGSelectPropertyFlags selFlags = wxPGSelectPropertyFlags::NoValidate,
unsigned int column = 1 );
void SendEvent(wxEventType eventType, int intVal);
@ -1909,7 +1839,7 @@ protected:
// was on one of its child controls.
void SetFocusOnCanvas();
bool DoHideProperty( wxPGProperty* p, bool hide, int flags );
bool DoHideProperty( wxPGProperty* p, bool hide, wxPGPropertyValuesFlags flags );
void DeletePendingObjects();
@ -2082,14 +2012,21 @@ public:
// Set override validation failure behaviour.
// Only effective if Veto was also called, and only allowed if event type
// is wxEVT_PG_CHANGING.
void SetValidationFailureBehavior( wxPGVFBFlags flags )
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use SetValidationFailureBehavior with wxPGVFBFlags argument")
void SetValidationFailureBehavior(int flags)
{
SetValidationFailureBehavior(static_cast<wxPGVFBFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
void SetValidationFailureBehavior(wxPGVFBFlags flags)
{
wxASSERT( GetEventType() == wxEVT_PG_CHANGING );
m_validationInfo->SetFailureBehavior( flags );
}
// Sets custom failure message for this time only. Only applies if
// wxPG_VFB_SHOW_MESSAGE is set in validation failure flags.
// wxPGVFBFlags::SHOW_MESSAGE is set in validation failure flags.
void SetValidationFailureMessage( const wxString& message )
{
wxASSERT( GetEventType() == wxEVT_PG_CHANGING );

View file

@ -289,38 +289,72 @@ WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(wxObject*, wxArrayPGObject,
// -----------------------------------------------------------------------
enum wxPG_PROPERTYVALUES_FLAGS
enum class wxPGPropertyValuesFlags : int
{
// Flag for wxPropertyGridInterface::SetProperty* functions,
// wxPropertyGridInterface::HideProperty(), etc.
// Apply changes only for the property in question.
wxPG_DONT_RECURSE = 0x00000000,
// Flag for wxPropertyGridInterface::SetProperty* functions,
// wxPropertyGridInterface::HideProperty(), etc.
// Apply changes only for the property in question.
DontRecurse = 0x00000000,
// Flag for wxPropertyGridInterface::GetPropertyValues().
// Use this flag to retain category structure; each sub-category
// will be its own wxVariantList of wxVariant.
wxPG_KEEP_STRUCTURE = 0x00000010,
// Flag for wxPropertyGridInterface::GetPropertyValues().
// Use this flag to retain category structure; each sub-category
// will be its own wxVariantList of wxVariant.
KeepStructure = 0x00000010,
// Flag for wxPropertyGridInterface::SetProperty* functions,
// wxPropertyGridInterface::HideProperty(), etc.
// Apply changes recursively for the property and all its children.
wxPG_RECURSE = 0x00000020,
// Flag for wxPropertyGridInterface::SetProperty* functions,
// wxPropertyGridInterface::HideProperty(), etc.
// Apply changes recursively for the property and all its children.
Recurse = 0x00000020,
// Flag for wxPropertyGridInterface::GetPropertyValues().
// Use this flag to include property attributes as well.
wxPG_INC_ATTRIBUTES = 0x00000040,
// Flag for wxPropertyGridInterface::GetPropertyValues().
// Use this flag to include property attributes as well.
IncAttributes = 0x00000040,
// Used when first starting recursion.
wxPG_RECURSE_STARTS = 0x00000080,
// Used when first starting recursion.
RecurseStarts = 0x00000080,
// Force value change.
wxPG_FORCE = 0x00000100,
// Force value change.
Force = 0x00000100,
// Only sort categories and their immediate children.
// Sorting done by wxPG_AUTO_SORT option uses this.
wxPG_SORT_TOP_LEVEL_ONLY = 0x00000200
// Only sort categories and their immediate children.
// Sorting done by wxPG_AUTO_SORT option uses this.
SortTopLevelOnly = 0x00000200
};
constexpr wxPGPropertyValuesFlags operator|(wxPGPropertyValuesFlags a, wxPGPropertyValuesFlags b)
{
return static_cast<wxPGPropertyValuesFlags>(static_cast<std::underlying_type_t<wxPGPropertyValuesFlags>>(a)
| static_cast<std::underlying_type_t<wxPGPropertyValuesFlags>>(b));
}
constexpr wxPGPropertyValuesFlags operator&(wxPGPropertyValuesFlags a, wxPGPropertyValuesFlags b)
{
return static_cast<wxPGPropertyValuesFlags>(static_cast<std::underlying_type_t<wxPGPropertyValuesFlags>>(a)
& static_cast<std::underlying_type_t<wxPGPropertyValuesFlags>>(b));
}
constexpr bool operator!(wxPGPropertyValuesFlags a)
{
return static_cast<std::underlying_type_t<wxPGPropertyValuesFlags>>(a) == 0;
}
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use wxPGPropertyValuesFlags::DontRecurse instead")
constexpr wxPGPropertyValuesFlags wxPG_DONT_RECURSE { wxPGPropertyValuesFlags::DontRecurse };
wxDEPRECATED_MSG("use wxPGPropertyValuesFlags::KeepStructure instead")
constexpr wxPGPropertyValuesFlags wxPG_KEEP_STRUCTURE { wxPGPropertyValuesFlags::KeepStructure };
wxDEPRECATED_MSG("use wxPGPropertyValuesFlags::Recurse instead")
constexpr wxPGPropertyValuesFlags wxPG_RECURSE { wxPGPropertyValuesFlags::Recurse };
wxDEPRECATED_MSG("use wxPGPropertyValuesFlags::IncAttributes instead")
constexpr wxPGPropertyValuesFlags wxPG_INC_ATTRIBUTES { wxPGPropertyValuesFlags::IncAttributes };
wxDEPRECATED_MSG("use wxPGPropertyValuesFlags::RecurseStarts instead")
constexpr wxPGPropertyValuesFlags wxPG_RECURSE_STARTS { wxPGPropertyValuesFlags::RecurseStarts };
wxDEPRECATED_MSG("use wxPGPropertyValuesFlags::Force instead")
constexpr wxPGPropertyValuesFlags wxPG_FORCE { wxPGPropertyValuesFlags::Force };
wxDEPRECATED_MSG("use wxPGPropertyValuesFlags::SortTopLevelOnly instead")
constexpr wxPGPropertyValuesFlags wxPG_SORT_TOP_LEVEL_ONLY { wxPGPropertyValuesFlags::SortTopLevelOnly };
#endif // WXWIN_COMPATIBILITY_3_2
// -----------------------------------------------------------------------
// Misc. argument flags.
@ -356,14 +390,47 @@ enum wxPG_MISC_ARG_FLAGS
// -----------------------------------------------------------------------
// wxPGProperty::SetValue() flags
enum wxPG_SETVALUE_FLAGS
enum class wxPGSetValueFlags : int
{
wxPG_SETVAL_REFRESH_EDITOR = 0x0001,
wxPG_SETVAL_AGGREGATED = 0x0002,
wxPG_SETVAL_FROM_PARENT = 0x0004,
wxPG_SETVAL_BY_USER = 0x0008 // Set if value changed by user
RefreshEditor = 0x0001,
Aggregated = 0x0002,
FromParent = 0x0004,
ByUser = 0x0008 // Set if value changed by user
};
constexpr wxPGSetValueFlags operator|(wxPGSetValueFlags a, wxPGSetValueFlags b)
{
return static_cast<wxPGSetValueFlags>(static_cast<std::underlying_type_t<wxPGSetValueFlags>>(a)
| static_cast<std::underlying_type_t<wxPGSetValueFlags>>(b));
}
constexpr wxPGSetValueFlags operator|=(wxPGSetValueFlags& a, wxPGSetValueFlags b)
{
return a = a | b;
}
constexpr wxPGSetValueFlags operator&(wxPGSetValueFlags a, wxPGSetValueFlags b)
{
return static_cast<wxPGSetValueFlags>(static_cast<std::underlying_type_t<wxPGSetValueFlags>>(a)
& static_cast<std::underlying_type_t<wxPGSetValueFlags>>(b));
}
constexpr bool operator!(wxPGSetValueFlags a)
{
return static_cast<std::underlying_type_t<wxPGSetValueFlags>>(a) == 0;
}
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use wxPGSetValueFlags::RefreshEditor instead")
constexpr wxPGSetValueFlags wxPG_SETVAL_REFRESH_EDITOR { wxPGSetValueFlags::RefreshEditor };
wxDEPRECATED_MSG("use wxPGSetValueFlags::Aggregated instead")
constexpr wxPGSetValueFlags wxPG_SETVAL_AGGREGATED { wxPGSetValueFlags::Aggregated };
wxDEPRECATED_MSG("use wxPGSetValueFlags::FromParent instead")
constexpr wxPGSetValueFlags wxPG_SETVAL_FROM_PARENT { wxPGSetValueFlags::FromParent };
wxDEPRECATED_MSG("use wxPGSetValueFlags::ByUser instead")
constexpr wxPGSetValueFlags wxPG_SETVAL_BY_USER { wxPGSetValueFlags::ByUser };
#endif // WXWIN_COMPATIBILITY_3_2
// -----------------------------------------------------------------------
//

View file

@ -18,6 +18,83 @@
#include "wx/propgrid/property.h"
#include "wx/propgrid/propgridpagestate.h"
// -----------------------------------------------------------------------
// wxPropertyGrid Validation Failure behaviour Flags
enum class wxPGVFBFlags : int
{
// No flags
Null = 0,
// Prevents user from leaving property unless value is valid. If this
// behaviour flag is not used, then value change is instead cancelled.
StayInProperty = 0x0001,
// Calls wxBell() on validation failure.
Beep = 0x0002,
// Cell with invalid value will be marked (with red colour).
MarkCell = 0x0004,
// Display a text message explaining the situation.
// To customize the way the message is displayed, you need to
// reimplement wxPropertyGrid::DoShowPropertyError() in a
// derived class. Default behaviour is to display the text on
// the top-level frame's status bar, if present, and otherwise
// using wxMessageBox.
ShowMessage = 0x0008,
// Similar to SHOW_MESSAGE, except always displays the
// message using wxMessageBox.
ShowMessageBox = 0x0010,
// Similar to SHOW_MESSAGE, except always displays the
// message on the status bar (when present - you can reimplement
// wxPropertyGrid::GetStatusBar() in a derived class to specify
// this yourself).
ShowMessageOnStatusBar = 0x0020,
// Defaults.
Default = MarkCell | ShowMessageBox,
// Only used internally.
Undefined = 0x0040
};
constexpr wxPGVFBFlags operator|(wxPGVFBFlags a, wxPGVFBFlags b)
{
return static_cast<wxPGVFBFlags>(static_cast<std::underlying_type_t<wxPGVFBFlags>>(a)
| static_cast<std::underlying_type_t<wxPGVFBFlags>>(b));
}
constexpr wxPGVFBFlags operator&(wxPGVFBFlags a, wxPGVFBFlags b)
{
return static_cast<wxPGVFBFlags>(static_cast<std::underlying_type_t<wxPGVFBFlags>>(a)
& static_cast<std::underlying_type_t<wxPGVFBFlags>>(b));
}
constexpr wxPGVFBFlags operator~(wxPGVFBFlags a)
{
return static_cast<wxPGVFBFlags>(~static_cast<std::underlying_type_t<wxPGVFBFlags>>(a));
}
constexpr bool operator!(wxPGVFBFlags a)
{
return static_cast<std::underlying_type_t<wxPGVFBFlags>>(a) == 0;
}
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use wxPGVFBFlags::Null instead")
constexpr wxPGVFBFlags wxPG_VFB_NULL{ wxPGVFBFlags::Null };
wxDEPRECATED_MSG("use wxPGVFBFlags::StayInProperty instead")
constexpr wxPGVFBFlags wxPG_VFB_STAY_IN_PROPERTY{ wxPGVFBFlags::StayInProperty };
wxDEPRECATED_MSG("use wxPGVFBFlags::Beep instead")
constexpr wxPGVFBFlags wxPG_VFB_BEEP{ wxPGVFBFlags::Beep };
wxDEPRECATED_MSG("use wxPGVFBFlags::MarkCell instead")
constexpr wxPGVFBFlags wxPG_VFB_MARK_CELL{ wxPGVFBFlags::MarkCell };
wxDEPRECATED_MSG("use wxPGVFBFlags::ShowMessage instead")
constexpr wxPGVFBFlags wxPG_VFB_SHOW_MESSAGE{ wxPGVFBFlags::ShowMessage };
wxDEPRECATED_MSG("use wxPGVFBFlags::ShowMessageBox instead")
constexpr wxPGVFBFlags wxPG_VFB_SHOW_MESSAGEBOX{ wxPGVFBFlags::ShowMessageBox };
wxDEPRECATED_MSG("use wxPGVFBFlags::ShowMessageOnStatusBar instead")
constexpr wxPGVFBFlags wxPG_VFB_SHOW_MESSAGE_ON_STATUSBAR{ wxPGVFBFlags::ShowMessageOnStatusBar };
wxDEPRECATED_MSG("use wxPGVFBFlags::Default instead")
constexpr wxPGVFBFlags wxPG_VFB_DEFAULT{ wxPGVFBFlags::Default };
wxDEPRECATED_MSG("use wxPGVFBFlags::Undefined instead")
constexpr wxPGVFBFlags wxPG_VFB_UNDEFINED{ wxPGVFBFlags::Undefined };
#endif // WXWIN_COMPATIBILITY_3_2
// -----------------------------------------------------------------------
// Most property grid functions have this type as their argument, as it can
@ -155,7 +232,7 @@ public:
// Refresh when calling this function after control has been shown for
// the first time.
// This functions deselects selected property, if any. Validation
// failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, ie.
// failure option wxPGVFBFlags::StayInProperty is not respected, ie.
// selection is cleared even if editor had invalid value.
wxPGProperty* Append( wxPGProperty* property );
@ -201,7 +278,7 @@ public:
// handler, the actual deletion is postponed until the next
// idle event.
// This functions deselects selected property, if any.
// Validation failure option wxPG_VFB_STAY_IN_PROPERTY is not
// Validation failure option wxPGVFBFlags::StayInProperty is not
// respected, ie. selection is cleared even if editor had
// invalid value.
void DeleteProperty( wxPGPropArg id );
@ -451,13 +528,21 @@ public:
// Returns a wxVariant list containing wxVariant versions of all
// property values. Order is not guaranteed.
// flags - Use wxPG_KEEP_STRUCTURE to retain category structure; each sub
// flags - Use wxPGPropertyValuesFlags::KeepStructure to retain category structure; each sub
// category will be its own wxVariantList of wxVariant.
// Use wxPG_INC_ATTRIBUTES to include property attributes as well.
// Use wxPGPropertyValuesFlags::IncAttributes to include property attributes as well.
// Each attribute will be stored as list variant named
// "@<propname>@attr."
wxVariant GetPropertyValues( const wxString& listname = wxString(),
wxPGProperty* baseparent = nullptr, long flags = 0 ) const
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use GetPropertyValues with flags argument as wxPGPropertyValuesFlags")
wxVariant GetPropertyValues(const wxString& listname, wxPGProperty* baseparent, long flags) const
{
return m_pState->DoGetPropertyValues(listname, baseparent, static_cast<wxPGPropertyValuesFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
wxVariant GetPropertyValues(const wxString& listname = wxString(),
wxPGProperty* baseparent = nullptr,
wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::DontRecurse) const
{
return m_pState->DoGetPropertyValues(listname, baseparent, flags);
}
@ -486,10 +571,16 @@ public:
// Hides or reveals a property.
// hide - If true, hides property, otherwise reveals it.
// flags - By default changes are applied recursively. Set this parameter
// wxPG_DONT_RECURSE to prevent this.
bool HideProperty( wxPGPropArg id,
bool hide = true,
int flags = wxPG_RECURSE );
// wxPGPropertyValuesFlags::DontRecurse to prevent this.
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use HideProperty with flags argument as wxPGPropertyValuesFlags")
bool HideProperty(wxPGPropArg id, bool hide, int flags)
{
HideProperty(id, hide, static_cast<wxPGPropertyValuesFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
bool HideProperty(wxPGPropArg id, bool hide = true,
wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::Recurse);
#if wxPG_INCLUDE_ADVPROPS
// Initializes *all* property types. Causes references to most object
@ -689,18 +780,23 @@ public:
// Sets an attribute for this property.
// name - Text identifier of attribute. See @ref propgrid_property_attributes.
// value - Value of attribute.
// argFlags - Optional. Use wxPG_RECURSE to set the attribute to child
// argFlags - Optional. Use wxPGPropertyValuesFlags::Recurse to set the attribute to child
// properties recursively.
// Setting attribute's value to null wxVariant will simply remove it
// from property's set of attributes.
void SetPropertyAttribute( wxPGPropArg id,
const wxString& attrName,
wxVariant value,
long argFlags = 0 )
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use SetPropertyAttribute with argFlags argument as wxPGPropertyValuesFlags")
void SetPropertyAttribute(wxPGPropArg id, const wxString& attrName,
wxVariant value, long argFlags)
{
DoSetPropertyAttribute(id,attrName,value,argFlags);
DoSetPropertyAttribute(id, attrName, value, static_cast<wxPGPropertyValuesFlags>(argFlags));
}
#endif // WXWIN_COMPATIBILITY_3_2
void SetPropertyAttribute(wxPGPropArg id, const wxString& attrName, wxVariant value,
wxPGPropertyValuesFlags argFlags = wxPGPropertyValuesFlags::DontRecurse)
{
DoSetPropertyAttribute(id, attrName, value, argFlags);
}
// Sets property attribute for all applicable properties.
// Be sure to use this method only after all properties have been
// added to the grid.
@ -709,33 +805,52 @@ public:
// Sets background colour of a property.
// id - Property name or pointer.
// colour - New background colour.
// flags - Default is wxPG_RECURSE which causes colour to be set recursively.
// flags - Default is wxPGPropertyValuesFlags::Recurse which causes colour to be set recursively.
// Omit this flag to only set colour for the property in question
// and not any of its children.
void SetPropertyBackgroundColour( wxPGPropArg id,
const wxColour& colour,
int flags = wxPG_RECURSE );
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use SetPropertyBackgroundColour with flags argument as wxPGPropertyValuesFlags")
void SetPropertyBackgroundColour(wxPGPropArg id, const wxColour& colour, int flags)
{
SetPropertyBackgroundColour(id, colour, static_cast<wxPGPropertyValuesFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
void SetPropertyBackgroundColour(wxPGPropArg id, const wxColour& colour,
wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::Recurse);
// Resets text and background colours of given property.
// id - Property name or pointer.
// flags - Default is wxPG_DONT_RECURSE which causes colour to be reset
// flags - Default is wxPGPropertyValuesFlags::DontRecurse which causes colour to be reset
// only for the property in question (for backward compatibility).
#if WXWIN_COMPATIBILITY_3_0
void SetPropertyColoursToDefault(wxPGPropArg id);
void SetPropertyColoursToDefault(wxPGPropArg id, int flags);
#else
void SetPropertyColoursToDefault(wxPGPropArg id, int flags = wxPG_DONT_RECURSE);
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use SetPropertyColoursToDefault with flags argument as wxPGPropertyValuesFlags")
void SetPropertyColoursToDefault(wxPGPropArg id, int flags)
{
SetPropertyColoursToDefault(id, static_cast<wxPGPropertyValuesFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
void SetPropertyColoursToDefault(wxPGPropArg id, wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::DontRecurse);
#endif // WXWIN_COMPATIBILITY_3_0
// Sets text colour of a property.
// id - Property name or pointer.
// colour - New background colour.
// flags - Default is wxPG_RECURSE which causes colour to be set recursively.
// flags - Default is wxPGPropertyValuesFlags::Recurse which causes colour to be set recursively.
// Omit this flag to only set colour for the property in question
// and not any of its children.
void SetPropertyTextColour( wxPGPropArg id,
const wxColour& col,
int flags = wxPG_RECURSE );
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use SetPropertyTextColour with flags argument as wxPGPropertyValuesFlags")
void SetPropertyTextColour(wxPGPropArg id, const wxColour& col, int flags)
{
SetPropertyTextColour(id, col, static_cast<wxPGPropertyValuesFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
void SetPropertyTextColour(wxPGPropArg id, const wxColour& col,
wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::Recurse);
// Returns background colour of first cell of a property.
wxColour GetPropertyBackgroundColour( wxPGPropArg id ) const
@ -810,10 +925,16 @@ public:
// This is mainly for use with textctrl editor. Not all other editors fully
// support it.
// By default changes are applied recursively. Set parameter "flags"
// to wxPG_DONT_RECURSE to prevent this.
void SetPropertyReadOnly( wxPGPropArg id,
bool set = true,
int flags = wxPG_RECURSE );
// to wxPGPropertyValuesFlags::DontRecurse to prevent this.
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use SetPropertyReadOnly with flags argument as wxPGPropertyValuesFlags")
void SetPropertyReadOnly(wxPGPropArg id, bool set, int flags)
{
SetPropertyReadOnly(id, set, static_cast<wxPGPropertyValuesFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
void SetPropertyReadOnly(wxPGPropArg id, bool set = true,
wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::Recurse);
// Sets property's value to unspecified.
// If it has children (it may be category), then the same thing is done to
@ -1010,22 +1131,44 @@ public:
// Adjusts how wxPropertyGrid behaves when invalid value is entered
// in a property.
// vfbFlags - See wxPG_VALIDATION_FAILURE_BEHAVIOR_FLAGS for possible values.
void SetValidationFailureBehavior( int vfbFlags );
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use SetValidationFailureBehavior with wxPGVFBFlags argument")
void SetValidationFailureBehavior(int vfbFlags)
{
SetValidationFailureBehavior(static_cast<wxPGVFBFlags>(vfbFlags));
}
#endif // WXWIN_COMPATIBILITY_3_2
void SetValidationFailureBehavior(wxPGVFBFlags vfbFlags);
// Sorts all properties recursively.
// flags - This can contain any of the following options:
// wxPG_SORT_TOP_LEVEL_ONLY: Only sort categories and their
// wxPGPropertyValuesFlags::SortTopLevelOnly: Only sort categories and their
// immediate children. Sorting done by wxPG_AUTO_SORT option
// uses this.
// See SortChildren, wxPropertyGrid::SetSortFunction
void Sort( int flags = 0 );
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use Sort with wxPGPropertyValuesFlags argument")
void Sort(int flags)
{
Sort(static_cast<wxPGPropertyValuesFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
void Sort(wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::DontRecurse);
// Sorts children of a property.
// id - Name or pointer to a property.
// flags - This can contain any of the following options:
// wxPG_RECURSE: Sorts recursively.
// wxPGPropertyValuesFlags::Recurse: Sorts recursively.
// See Sort, wxPropertyGrid::SetSortFunction
void SortChildren( wxPGPropArg id, int flags = 0 )
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use SortChildren with wxPGPropertyValuesFlags argument")
void SortChildren(wxPGPropArg id, int flags)
{
wxPG_PROP_ARG_CALL_PROLOG()
m_pState->DoSortChildren(p, static_cast<wxPGPropertyValuesFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
void SortChildren(wxPGPropArg id, wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::DontRecurse)
{
wxPG_PROP_ARG_CALL_PROLOG()
m_pState->DoSortChildren(p, flags);
@ -1045,7 +1188,7 @@ public:
protected:
bool DoClearSelection( bool validation = false,
int selFlags = 0 );
wxPGSelectPropertyFlags selFlags = wxPGSelectPropertyFlags::Null );
// In derived class, implement to set editable state component with
// given name to given value.
@ -1081,7 +1224,7 @@ protected:
// Intermediate version needed due to wxVariant copying inefficiency
void DoSetPropertyAttribute( wxPGPropArg id,
const wxString& name,
wxVariant& value, long argFlags );
wxVariant& value, wxPGPropertyValuesFlags argFlags );
// Empty string object to return from member functions returning const
// wxString&.

View file

@ -23,6 +23,118 @@
// -----------------------------------------------------------------------
enum class wxPGSelectPropertyFlags : int
{
// No flags
Null = 0,
// Focuses to created editor
Focus = 0x0001,
// Forces deletion and recreation of editor
Force = 0x0002,
// For example, doesn't cause EnsureVisible
Nonvisible = 0x0004,
// Do not validate editor's value before selecting
NoValidate = 0x0008,
// Property being deselected is about to be deleted
Deleting = 0x0010,
// Property's values was set to unspecified by the user
SetUnspec = 0x0020,
// Property's event handler changed the value
DialogVal = 0x0040,
// Set to disable sending of wxEVT_PG_SELECTED event
DontSendEvent = 0x0080,
// Don't make any graphics updates
NoRefresh = 0x0100
};
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use wxPGSelectPropertyFlags::Null instead")
constexpr wxPGSelectPropertyFlags wxPG_SEL_NONE{ wxPGSelectPropertyFlags::Null };
wxDEPRECATED_MSG("use wxPGSelectPropertyFlags::Focus instead")
constexpr wxPGSelectPropertyFlags wxPG_SEL_FOCUS{wxPGSelectPropertyFlags::Focus };
wxDEPRECATED_MSG("use wxPGSelectPropertyFlags::Force instead")
constexpr wxPGSelectPropertyFlags wxPG_SEL_FORCE{ wxPGSelectPropertyFlags::Force };
wxDEPRECATED_MSG("use wxPGSelectPropertyFlags::Nonvisible instead")
constexpr wxPGSelectPropertyFlags wxPG_SEL_NONVISIBLE{ wxPGSelectPropertyFlags::Nonvisible };
wxDEPRECATED_MSG("use wxPGSelectPropertyFlags::NoValidate instead")
constexpr wxPGSelectPropertyFlags wxPG_SEL_NOVALIDATE{ wxPGSelectPropertyFlags::NoValidate };
wxDEPRECATED_MSG("use wxPGSelectPropertyFlags::Deleting instead")
constexpr wxPGSelectPropertyFlags wxPG_SEL_DELETING{wxPGSelectPropertyFlags::Deleting };
wxDEPRECATED_MSG("use wxPGSelectPropertyFlags::SetUnspec instead")
constexpr wxPGSelectPropertyFlags wxPG_SEL_SETUNSPEC{ wxPGSelectPropertyFlags::SetUnspec };
wxDEPRECATED_MSG("use wxPGSelectPropertyFlags::DialogVal instead")
constexpr wxPGSelectPropertyFlags wxPG_SEL_DIALOGVAL{ wxPGSelectPropertyFlags::DialogVal };
wxDEPRECATED_MSG("use wxPGSelectPropertyFlags::DontSendEvent instead")
constexpr wxPGSelectPropertyFlags wxPG_SEL_DONT_SEND_EVENT{ wxPGSelectPropertyFlags::DontSendEvent };
wxDEPRECATED_MSG("use wxPGSelectPropertyFlags::NoRefresh instead")
constexpr wxPGSelectPropertyFlags wxPG_SEL_NO_REFRESH{ wxPGSelectPropertyFlags::NoRefresh };
#endif // WXWIN_COMPATIBILITY_3_2
constexpr wxPGSelectPropertyFlags operator|(wxPGSelectPropertyFlags a, wxPGSelectPropertyFlags b)
{
return static_cast<wxPGSelectPropertyFlags>(static_cast<std::underlying_type_t<wxPGSelectPropertyFlags>>(a)
| static_cast<std::underlying_type_t<wxPGSelectPropertyFlags>>(b));
}
constexpr wxPGSelectPropertyFlags operator|=(wxPGSelectPropertyFlags& a, wxPGSelectPropertyFlags b)
{
return a = a | b;
}
constexpr wxPGSelectPropertyFlags operator&(wxPGSelectPropertyFlags a, wxPGSelectPropertyFlags b)
{
return static_cast<wxPGSelectPropertyFlags>(static_cast<std::underlying_type_t<wxPGSelectPropertyFlags>>(a)
& static_cast<std::underlying_type_t<wxPGSelectPropertyFlags>>(b));
}
constexpr bool operator!(wxPGSelectPropertyFlags a)
{
return static_cast<std::underlying_type_t<wxPGSelectPropertyFlags>>(a) == 0;
}
// -----------------------------------------------------------------------
// DoSetSplitterPosition() flags
enum class wxPGSplitterPositionFlags : int
{
Null = 0,
Refresh = 0x0001,
AllPages = 0x0002,
FromEvent = 0x0004,
FromAutoCenter = 0x0008
};
constexpr wxPGSplitterPositionFlags operator&(wxPGSplitterPositionFlags a, wxPGSplitterPositionFlags b)
{
return static_cast<wxPGSplitterPositionFlags>(static_cast<std::underlying_type_t<wxPGSplitterPositionFlags>>(a)
& static_cast<std::underlying_type_t<wxPGSplitterPositionFlags>>(b));
}
constexpr wxPGSplitterPositionFlags operator|(wxPGSplitterPositionFlags a, wxPGSplitterPositionFlags b)
{
return static_cast<wxPGSplitterPositionFlags>(static_cast<std::underlying_type_t<wxPGSplitterPositionFlags>>(a)
| static_cast<std::underlying_type_t<wxPGSplitterPositionFlags>>(b));
}
constexpr bool operator!(wxPGSplitterPositionFlags a)
{
return static_cast<std::underlying_type_t<wxPGSplitterPositionFlags>>(a) == 0;
}
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use wxPGSplitterPositionFlags::Refresh instead")
constexpr wxPGSplitterPositionFlags wxPG_SPLITTER_REFRESH { wxPGSplitterPositionFlags::Refresh };
wxDEPRECATED_MSG("use wxPGSplitterPositionFlags::AllPages instead")
constexpr wxPGSplitterPositionFlags wxPG_SPLITTER_ALL_PAGES { wxPGSplitterPositionFlags::AllPages };
wxDEPRECATED_MSG("use wxPGSplitterPositionFlags::FromEvent instead")
constexpr wxPGSplitterPositionFlags wxPG_SPLITTER_FROM_EVENT { wxPGSplitterPositionFlags::FromEvent };
wxDEPRECATED_MSG("use wxPGSplitterPositionFlags::FromAutoCenter instead")
constexpr wxPGSplitterPositionFlags wxPG_SPLITTER_FROM_AUTO_CENTER { wxPGSplitterPositionFlags::FromAutoCenter };
#endif // WXWIN_COMPATIBILITY_3_2
// -----------------------------------------------------------------------
// A return value from wxPropertyGrid::HitTest(),
// contains all you need to know about an arbitrary location on the grid.
class WXDLLIMPEXP_PROPGRID wxPropertyGridHitTestResult
@ -358,9 +470,16 @@ public:
// This needs to be overridden in grid used the manager so that splitter
// changes can be propagated to other pages.
virtual void DoSetSplitterPosition( int pos,
int splitterColumn = 0,
int flags = 0 );
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use DoSetSplitterPosition with flags argument as wxPGSplitterPositionFlags")
virtual void DoSetSplitterPosition(int pos, int splitterColumn, int flags)
{
DoSetSplitterPosition(pos, splitterColumn, static_cast<wxPGSplitterPositionFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual void DoSetSplitterPosition(int pos,
int splitterColumn = 0,
wxPGSplitterPositionFlags flags = wxPGSplitterPositionFlags::Null);
bool EnableCategories( bool enable );
@ -483,9 +602,8 @@ protected:
return m_columnProportions[column];
}
wxVariant DoGetPropertyValues(const wxString& listname,
wxPGProperty* baseparent,
long flags) const;
wxVariant DoGetPropertyValues(const wxString& listname, wxPGProperty* baseparent,
wxPGPropertyValuesFlags flags) const;
wxPGProperty* DoGetRoot() const { return m_properties; }
@ -503,7 +621,7 @@ protected:
p->SetFlagRecursively(wxPG_PROP_NOEDITOR, limit);
}
bool DoSelectProperty(wxPGProperty* p, unsigned int flags = 0);
bool DoSelectProperty(wxPGProperty* p, wxPGSelectPropertyFlags flags = wxPGSelectPropertyFlags::Null);
// Base append.
wxPGProperty* DoAppend(wxPGProperty* property);
@ -531,7 +649,7 @@ protected:
// Unselect sub-properties.
void DoRemoveChildrenFromSelection(wxPGProperty* p, bool recursive,
int selFlags);
wxPGSelectPropertyFlags selFlags);
// Mark sub-properties as being deleted.
void DoMarkChildrenAsDeleted(wxPGProperty* p, bool recursive);
@ -544,7 +662,7 @@ protected:
// so it won't remain in the way of the user code.
void DoInvalidateChildrenNames(wxPGProperty* p, bool recursive);
bool DoHideProperty(wxPGProperty* p, bool hide, int flags = wxPG_RECURSE);
bool DoHideProperty(wxPGProperty* p, bool hide, wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::Recurse);
bool DoSetPropertyValueString(wxPGProperty* p, const wxString& value);
@ -554,8 +672,8 @@ protected:
void DoSetPropertyValues(const wxVariantList& list,
wxPGProperty* default_category);
void DoSortChildren(wxPGProperty* p, int flags = 0);
void DoSort(int flags = 0);
void DoSortChildren(wxPGProperty* p, wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::DontRecurse);
void DoSort(wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::DontRecurse);
// widthChange is non-client.
void OnClientWidthChange(int newWidth, int widthChange, bool fromOnResize = false);
@ -585,7 +703,14 @@ protected:
void SetColumnCount(int colCount);
void ResetColumnSizes(int setSplitterFlags);
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use ResetColumnSizes with wxPGSplitterPositionFlags argument")
void ResetColumnSizes(int setSplitterFlags)
{
ResetColumnSizes(static_cast<wxPGSplitterPositionFlags>(setSplitterFlags));
}
#endif // WXWIN_COMPATIBILITY_3_2
void ResetColumnSizes(wxPGSplitterPositionFlags setSplitterFlags);
bool PrepareAfterItemsAdded();

View file

@ -276,7 +276,7 @@ public:
@return Returns @true if value was actually updated.
*/
bool CommitChangesFromEditor( wxUint32 flags = 0 );
bool CommitChangesFromEditor(wxPGSelectPropertyFlags flags = wxPGSelectPropertyFlags::Null);
/**
Two step creation. Whenever the control is created without any parameters,

View file

@ -1706,9 +1706,9 @@ public:
@param flags
By default changes are applied recursively. Set this parameter to
::wxPG_DONT_RECURSE to prevent this.
wxPGPropertyValuesFlags::DontRecurse to prevent this.
*/
bool Hide( bool hide, int flags = wxPG_RECURSE );
bool Hide(bool hide, wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::Recurse);
/**
Returns index of given child property. wxNOT_FOUND if
@ -1852,7 +1852,8 @@ public:
Background colour to use.
@param flags
Default is ::wxPG_RECURSE which causes colour to be set recursively.
Default is wxPGPropertyValuesFlags::Recurse which causes colour
to be set recursively.
Omit this flag to only set colour for the property in question
and not any of its children.
@ -1860,8 +1861,8 @@ public:
Unlike wxPropertyGridInterface::SetPropertyBackgroundColour(),
this does not automatically update the display.
*/
void SetBackgroundColour( const wxColour& colour,
int flags = wxPG_RECURSE );
void SetBackgroundColour(const wxColour& colour,
wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::Recurse);
/**
Sets editor for a property.
@ -2002,7 +2003,8 @@ public:
Text colour to use.
@param flags
Default is ::wxPG_RECURSE which causes colour to be set recursively.
Default is wxPGPropertyValuesFlags::Recurse which causes colour
to be set recursively.
Omit this flag to only set colour for the property in question
and not any of its children.
@ -2010,14 +2012,15 @@ public:
Unlike wxPropertyGridInterface::SetPropertyTextColour(),
this does not automatically update the display.
*/
void SetTextColour( const wxColour& colour,
int flags = wxPG_RECURSE );
void SetTextColour(const wxColour& colour,
wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::Recurse);
/**
Sets property's default text and background colours.
@param flags
Default is ::wxPG_RECURSE which causes colours to be set recursively.
Default is wxPGPropertyValuesFlags::Recurse which
causes colours to be set recursively.
Omit this flag to only set colours for the property in question
and not any of its children.
@ -2027,7 +2030,7 @@ public:
@since 3.1.0
*/
void SetDefaultColours(int flags = wxPG_RECURSE);
void SetDefaultColours(wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::Recurse);
/** Sets wxValidator for a property */
void SetValidator( const wxValidator& validator );
@ -2049,11 +2052,11 @@ public:
Pointer to list variant that contains child values. Used to indicate
which children should be marked as modified. Usually you just use @NULL.
@param flags
::wxPG_SETVAL_REFRESH_EDITOR is set by default, to refresh editor
wxPGSetValueFlags::RefreshEditor is set by default, to refresh editor
and redraw properties.
*/
void SetValue( wxVariant value, wxVariant* pList = nullptr,
int flags = wxPG_SETVAL_REFRESH_EDITOR );
void SetValue(wxVariant value, wxVariant* pList = nullptr,
wxPGSetValueFlags flags = wxPGSetValueFlags::RefreshEditor );
/**
Set wxBitmap taken from wxBitmapBundle in front of the value.

View file

@ -274,26 +274,34 @@ constexpr long wxPGMAN_DEFAULT_STYLE = 0L;
@{
*/
enum wxPG_VALIDATION_FAILURE_BEHAVIOR_FLAGS
/**
wxPropertyGrid Validation Failure behaviour Flags
*/
enum class wxPGVFBFlags : int
{
/**
@hideinitializer
*/
Null = 0,
/**
Prevents user from leaving property unless value is valid. If this
behaviour flag is not used, then value change is instead cancelled.
@hideinitializer
*/
wxPG_VFB_STAY_IN_PROPERTY = 0x01,
StayInProperty = 0x0001,
/**
Calls wxBell() on validation failure.
@hideinitializer
*/
wxPG_VFB_BEEP = 0x02,
Beep = 0x0002,
/**
Cell with invalid value will be marked (with red colour).
@hideinitializer
*/
wxPG_VFB_MARK_CELL = 0x04,
MarkCell = 0x0004,
/**
Display a text message explaining the situation.
@ -305,42 +313,39 @@ wxPG_VFB_MARK_CELL = 0x04,
using wxMessageBox.
@hideinitializer
*/
wxPG_VFB_SHOW_MESSAGE = 0x08,
ShowMessage = 0x0008,
/**
Similar to wxPG_VFB_SHOW_MESSAGE, except always displays the
Similar to SHOW_MESSAGE, except always displays the
message using wxMessageBox.
@hideinitializer
*/
wxPG_VFB_SHOW_MESSAGEBOX = 0x10,
ShowMessageBox = 0x0010,
/**
Similar to wxPG_VFB_SHOW_MESSAGE, except always displays the
Similar to SHOW_MESSAGE, except always displays the
message on the status bar (when present - you can reimplement
wxPropertyGrid::GetStatusBar() in a derived class to specify
this yourself).
@hideinitializer
*/
wxPG_VFB_SHOW_MESSAGE_ON_STATUSBAR = 0x20,
ShowMessageOnStatusBar = 0x0020,
/**
Defaults.
@hideinitializer
*/
wxPG_VFB_DEFAULT = wxPG_VFB_MARK_CELL |
wxPG_VFB_SHOW_MESSAGEBOX,
Default = MarkCell | ShowMessageBox,
/**
@hideinitializer
*/
Undefined = 0x0040
};
/** @}
*/
/**
Having this as define instead of wxByte typedef makes things easier for
wxPython bindings (ignoring and redefining it in SWIG interface file
seemed rather tricky)
*/
#define wxPGVFBFlags unsigned char
/**
@class wxPGValidationInfo
@ -610,7 +615,7 @@ public:
@return Returns @true if anything was changed.
*/
virtual bool CommitChangesFromEditor( wxUint32 flags = 0 );
virtual bool CommitChangesFromEditor(wxPGSelectPropertyFlags flags = wxPGSelectPropertyFlags::Null);
/**
Two step creation. Whenever the control is created without any
@ -640,7 +645,7 @@ public:
enable.
@remarks This functions deselects selected property, if any. Validation
failure option ::wxPG_VFB_STAY_IN_PROPERTY is not respected, i.e.
failure option wxPGVFBFlags::StayInProperty is not respected, i.e.
selection is cleared even if editor had invalid value.
*/
bool EnableCategories( bool enable );
@ -1430,7 +1435,7 @@ public:
/**
Sets custom failure message for this time only. Only applies if
::wxPG_VFB_SHOW_MESSAGE is set in validation failure flags.
wxPGVFBFlags::ShowMessage is set in validation failure flags.
*/
void SetValidationFailureMessage( const wxString& message );

View file

@ -57,50 +57,50 @@ constexpr int wxPG_INVALID_VALUE = std::numeric_limits<int>::max();
// -----------------------------------------------------------------------
enum wxPG_GETPROPERTYVALUES_FLAGS
enum class wxPGPropertyValuesFlags : int
{
/** Flag for wxPropertyGridInterface::SetProperty* functions,
wxPropertyGridInterface::HideProperty(), etc.
Apply changes only for the property in question.
@hideinitializer
*/
wxPG_DONT_RECURSE = 0x00000000,
/** Flag for wxPropertyGridInterface::SetProperty* functions,
wxPropertyGridInterface::HideProperty(), etc.
Apply changes only for the property in question.
@hideinitializer
*/
DontRecurse = 0x00000000,
/** Flag for wxPropertyGridInterface::GetPropertyValues().
Use this flag to retain category structure; each sub-category
will be its own wxVariantList of wxVariant.
@hideinitializer
*/
wxPG_KEEP_STRUCTURE = 0x00000010,
/** Flag for wxPropertyGridInterface::GetPropertyValues().
Use this flag to retain category structure; each sub-category
will be its own wxVariantList of wxVariant.
@hideinitializer
*/
KeepStructure = 0x00000010,
/** Flag for wxPropertyGridInterface::SetProperty* functions,
wxPropertyGridInterface::HideProperty(), etc.
Apply changes recursively for the property and all its children.
@hideinitializer
*/
wxPG_RECURSE = 0x00000020,
/** Flag for wxPropertyGridInterface::SetProperty* functions,
wxPropertyGridInterface::HideProperty(), etc.
Apply changes recursively for the property and all its children.
@hideinitializer
*/
Recurse = 0x00000020,
/** Flag for wxPropertyGridInterface::GetPropertyValues().
Use this flag to include property attributes as well.
@hideinitializer
*/
wxPG_INC_ATTRIBUTES = 0x00000040,
/** Flag for wxPropertyGridInterface::GetPropertyValues().
Use this flag to include property attributes as well.
@hideinitializer
*/
IncAttributes = 0x00000040,
/** Used when first starting recursion.
@hideinitializer
*/
wxPG_RECURSE_STARTS = 0x00000080,
/** Used when first starting recursion.
@hideinitializer
*/
RecurseStarts = 0x00000080,
/** Force value change.
@hideinitializer
*/
wxPG_FORCE = 0x00000100,
/** Force value change.
@hideinitializer
*/
Force = 0x00000100,
/** Only sort categories and their immediate children.
Sorting done by ::wxPG_AUTO_SORT option uses this.
@hideinitializer
*/
wxPG_SORT_TOP_LEVEL_ONLY = 0x00000200
/** Only sort categories and their immediate children.
Sorting done by ::wxPG_AUTO_SORT option uses this.
@hideinitializer
*/
SortTopLevelOnly = 0x00000200
};
// -----------------------------------------------------------------------
@ -157,24 +157,27 @@ enum wxPG_MISC_ARG_FLAGS
/** wxPGProperty::SetValue() flags
*/
enum wxPG_SETVALUE_FLAGS
enum class wxPGSetValueFlags : int
{
/**
@hideinitializer
*/
wxPG_SETVAL_REFRESH_EDITOR = 0x0001,
RefreshEditor = 0x0001,
/**
@hideinitializer
*/
wxPG_SETVAL_AGGREGATED = 0x0002,
Aggregated = 0x0002,
/**
@hideinitializer
*/
wxPG_SETVAL_FROM_PARENT = 0x0004,
FromParent = 0x0004,
/** Set if value changed by user
@hideinitializer
*/
wxPG_SETVAL_BY_USER = 0x0008
ByUser = 0x0008
};
// -----------------------------------------------------------------------

View file

@ -110,7 +110,7 @@ public:
Refresh() when calling this function after control has been shown for
the first time.
- This functions deselects selected property, if any. Validation
failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, i.e.
failure option wxPGVFBFlags::StayInProperty is not respected, i.e.
selection is cleared even if editor had invalid value.
*/
wxPGProperty* Append( wxPGProperty* property );
@ -139,7 +139,7 @@ public:
Deletes all properties.
@remarks This functions deselects selected property, if any. Validation
failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, i.e.
failure option wxPGVFBFlags::StayInProperty is not respected, i.e.
selection is cleared even if editor had invalid value.
*/
virtual void Clear() = 0;
@ -173,7 +173,7 @@ public:
@return Returns @true if actually collapsed.
@remarks This function may deselect selected property, if any. Validation
failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, i.e.
failure option wxPGVFBFlags::StayInProperty is not respected, i.e.
selection is cleared even if editor had invalid value.
*/
bool Collapse( wxPGPropArg id );
@ -185,7 +185,7 @@ public:
Return @false if failed (may fail if editor value cannot be validated).
@remarks This functions clears selection. Validation failure option
wxPG_VFB_STAY_IN_PROPERTY is not respected, i.e. selection
wxPGVFBFlags::StayInProperty is not respected, i.e. selection
is cleared even if editor had invalid value.
*/
bool CollapseAll();
@ -213,7 +213,7 @@ public:
idle event.
This functions deselects selected property, if any.
Validation failure option wxPG_VFB_STAY_IN_PROPERTY is not
Validation failure option wxPGVFBFlags::StayInProperty is not
respected, i.e. selection is cleared even if editor had
invalid value.
*/
@ -265,7 +265,7 @@ public:
@return Returns @true if actually expanded.
@remarks This function may deselect selected property, if any. Validation
failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, i.e.
failure option wxPGVFBFlags::StayInProperty is not respected, i.e.
selection is cleared even if editor had invalid value.
*/
bool Expand( wxPGPropArg id );
@ -274,7 +274,7 @@ public:
Expands all items that can be expanded.
@remarks This functions clears selection. Validation failure option
wxPG_VFB_STAY_IN_PROPERTY is not respected, i.e. selection
wxPGVFBFlags::StayInProperty is not respected, i.e. selection
is cleared even if editor had invalid value.
*/
bool ExpandAll( bool expand = true );
@ -519,14 +519,16 @@ public:
The base property which children properties will be queried for
values.
@param flags
Use @c wxPG_KEEP_STRUCTURE to retain category structure; each sub
category will be its own wxVariantList of wxVariant.
Use @c wxPG_INC_ATTRIBUTES to include property attributes as well.
Use wxPGPropertyValuesFlags::KeepStructure to retain category structure;
each sub category will be its own wxVariantList of wxVariant.
Use wxPGPropertyValuesFlags::IncAttributes to include property attributes
as well.
Each attribute will be stored as list variant named
@"@@@<propname@>@@attr.@"
*/
wxVariant GetPropertyValues( const wxString& listname = wxString(),
wxPGProperty* baseparent = nullptr, long flags = 0 ) const;
wxVariant GetPropertyValues(const wxString& listname = wxString(),
wxPGProperty* baseparent = nullptr,
wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::DontRecurse) const;
/**
Returns list of currently selected properties.
@ -563,9 +565,10 @@ public:
If @true, hides property, otherwise reveals it.
@param flags
By default changes are applied recursively. Set this parameter
wxPG_DONT_RECURSE to prevent this.
wxPGPropertyValuesFlags::DontRecurse to prevent this.
*/
bool HideProperty( wxPGPropArg id, bool hide = true, int flags = wxPG_RECURSE );
bool HideProperty(wxPGPropArg id, bool hide = true,
wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::Recurse);
/**
Initializes *all* property types. Causes references to most object
@ -598,7 +601,7 @@ public:
especially true if current mode is non-categoric.
- This functions deselects selected property, if any. Validation
failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, i.e.
failure option wxPGVFBFlags::StayInProperty is not respected, i.e.
selection is cleared even if editor had invalid value.
Example of use:
@ -843,15 +846,16 @@ public:
Value of attribute.
@param argFlags
Optional.
Use wxPG_RECURSE to set the attribute to child properties recursively.
Use wxPGPropertyValuesFlags::Recurse to set the attribute to child
properties recursively.
@remarks
- Setting attribute's value to null wxVariant will simply remove it
from property's set of attributes.
- Property is refreshed with new settings.
*/
void SetPropertyAttribute( wxPGPropArg id, const wxString& attrName,
wxVariant value, long argFlags = 0 );
void SetPropertyAttribute(wxPGPropArg id, const wxString& attrName, wxVariant value,
wxPGPropertyValuesFlags argFlags = wxPGPropertyValuesFlags::DontRecurse);
/**
Sets property attribute for all applicable properties.
@ -873,7 +877,8 @@ public:
New background colour.
@param flags
Default is wxPG_RECURSE which causes colour to be set recursively.
Default is wxPGPropertyValuesFlags::Recurse which causes colour
to be set recursively.
Omit this flag to only set colour for the property in question
and not any of its children.
@ -881,9 +886,8 @@ public:
- If category is tried to set recursively, only its children are affected.
- Property is redrawn with new colour.
*/
void SetPropertyBackgroundColour( wxPGPropArg id,
const wxColour& colour,
int flags = wxPG_RECURSE );
void SetPropertyBackgroundColour(wxPGPropArg id, const wxColour& colour,
wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::Recurse);
/**
Sets text, bitmap, and colours for given column's cell.
@ -914,14 +918,16 @@ public:
Property name or pointer.
@param flags
Default is wxPG_DONT_RECURSE which causes colour to be reset
Default is wxPGPropertyValuesFlags::DontRecurse which causes
colour to be reset
only for the property in question (for backward compatibility).
@remarks
- If category is tried to set recursively, only its children are affected.
- Property is redrawn with new colours.
*/
void SetPropertyColoursToDefault(wxPGPropArg id, int flags = wxPG_DONT_RECURSE);
void SetPropertyColoursToDefault(wxPGPropArg id,
wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::DontRecurse);
/**
Sets editor for a property.
@ -976,15 +982,15 @@ public:
@param flags
By default changes are applied recursively. Set this parameter
to wxPG_DONT_RECURSE to prevent this.
to wxPGPropertyValuesFlags::DontRecurse to prevent this.
@remarks
- This is mainly for use with textctrl editor. Only some other
editors fully support it.
- Property is refreshed with new settings.
*/
void SetPropertyReadOnly( wxPGPropArg id, bool set = true,
int flags = wxPG_RECURSE );
void SetPropertyReadOnly(wxPGPropArg id, bool set = true,
wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::Recurse);
/**
Sets property's value to unspecified. If it has children (it may be
@ -1050,7 +1056,8 @@ public:
New text colour.
@param flags
Default is wxPG_RECURSE which causes colour to be set recursively.
Default is wxPGPropertyValuesFlags::Recurse which causes colour
to be set recursively.
Omit this flag to only set colour for the property in question
and not any of its children.
@ -1058,9 +1065,8 @@ public:
- If category is tried to set recursively, only its children are affected.
- Property is redrawn with new colour.
*/
void SetPropertyTextColour( wxPGPropArg id,
const wxColour& colour,
int flags = wxPG_RECURSE );
void SetPropertyTextColour(wxPGPropArg id, const wxColour& colour,
wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::Recurse);
/**
Sets validator of a property.
@ -1146,20 +1152,20 @@ public:
@param vfbFlags
See @ref propgrid_vfbflags for possible values.
*/
void SetValidationFailureBehavior( int vfbFlags );
void SetValidationFailureBehavior( wxPGVFBFlags vfbFlags );
/**
Sorts all properties recursively.
@param flags
This can contain any of the following options:
wxPG_SORT_TOP_LEVEL_ONLY: Only sort categories and their
immediate children. Sorting done by wxPG_AUTO_SORT option
uses this.
wxPGPropertyValuesFlags::SortTopLevelOnly: Only sort categories
and their immediate children. Sorting done by wxPG_AUTO_SORT
option uses this.
@see SortChildren, wxPropertyGrid::SetSortFunction
*/
void Sort( int flags = 0 );
void Sort(wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::DontRecurse);
/**
Sorts children of a property.
@ -1169,11 +1175,12 @@ public:
@param flags
This can contain any of the following options:
wxPG_RECURSE: Sorts recursively.
wxPGPropertyValuesFlags::Recurse: Sorts recursively.
@see Sort, wxPropertyGrid::SetSortFunction
*/
void SortChildren( wxPGPropArg id, int flags = 0 );
void SortChildren(wxPGPropArg id,
wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::DontRecurse);
/**
Returns editor pointer of editor with given name.

View file

@ -653,7 +653,7 @@ void FormMain::OnPropertyGridChanging( wxPropertyGridEvent& event )
// Since we ask a question, it is better if we omit any validation
// failure behaviour.
event.SetValidationFailureBehavior(0);
event.SetValidationFailureBehavior(wxPGVFBFlags::Null);
}
}
}
@ -1730,7 +1730,7 @@ void FormMain::PopulateWithLibraryConfig ()
ADD_WX_LIB_CONF( wxUSE_XML )
// Set them to use check box.
pg->SetPropertyAttribute(pid,wxPG_BOOL_USE_CHECKBOX,true,wxPG_RECURSE);
pg->SetPropertyAttribute(pid,wxPG_BOOL_USE_CHECKBOX,true, wxPGPropertyValuesFlags::Recurse);
}
// -----------------------------------------------------------------------
@ -1905,8 +1905,8 @@ void FormMain::CreateGrid( int style, int extraStyle )
pgman->SetExtraStyle(extraStyle);
// This is the default validation failure behaviour
m_pPropGridManager->SetValidationFailureBehavior( wxPG_VFB_MARK_CELL |
wxPG_VFB_SHOW_MESSAGEBOX );
m_pPropGridManager->SetValidationFailureBehavior( wxPGVFBFlags::MarkCell |
wxPGVFBFlags::ShowMessageBox );
m_pPropGridManager->GetGrid()->SetVerticalSpacing( 2 );
@ -2562,7 +2562,8 @@ FormMain::OnSetBackgroundColour( wxCommandEvent& event )
if ( col.IsOk() )
{
int flags = (event.GetId()==ID_SETBGCOLOURRECUR) ? wxPG_RECURSE : 0;
wxPGPropertyValuesFlags flags = (event.GetId()==ID_SETBGCOLOURRECUR)
? wxPGPropertyValuesFlags::Recurse : wxPGPropertyValuesFlags::DontRecurse;
pg->SetPropertyBackgroundColour(prop, col, flags);
}
}
@ -2637,7 +2638,7 @@ void FormMain::OnTestReplaceClick( wxCommandEvent& WXUNUSED(event) )
m_pPropGridManager->SetPropertyAttribute( newId,
wxPG_BOOL_USE_CHECKBOX,
true,
wxPG_RECURSE );
wxPGPropertyValuesFlags::Recurse );
m_pPropGridManager->SelectProperty(newId);
}
else
@ -2811,13 +2812,13 @@ void FormMain::OnCatColours( wxCommandEvent& event )
if ( event.IsChecked() )
{
// Set custom colours.
pg->SetPropertyTextColour( "Appearance", wxColour(255,0,0), wxPG_DONT_RECURSE );
pg->SetPropertyTextColour( "Appearance", wxColour(255,0,0), wxPGPropertyValuesFlags::DontRecurse );
pg->SetPropertyBackgroundColour( "Appearance", wxColour(255,255,183) );
pg->SetPropertyTextColour( "Appearance", wxColour(255,0,183) );
pg->SetPropertyTextColour( "PositionCategory", wxColour(0,255,0), wxPG_DONT_RECURSE );
pg->SetPropertyTextColour( "PositionCategory", wxColour(0,255,0), wxPGPropertyValuesFlags::DontRecurse );
pg->SetPropertyBackgroundColour( "PositionCategory", wxColour(255,226,190) );
pg->SetPropertyTextColour( "PositionCategory", wxColour(255,0,190) );
pg->SetPropertyTextColour( "Environment", wxColour(0,0,255), wxPG_DONT_RECURSE );
pg->SetPropertyTextColour( "Environment", wxColour(0,0,255), wxPGPropertyValuesFlags::DontRecurse);
pg->SetPropertyBackgroundColour( "Environment", wxColour(208,240,175) );
pg->SetPropertyTextColour( "Environment", wxColour(255,255,255) );
pg->SetPropertyBackgroundColour( "More Examples", wxColour(172,237,255) );
@ -2827,12 +2828,12 @@ void FormMain::OnCatColours( wxCommandEvent& event )
{
// Revert to original.
pg->SetPropertyColoursToDefault( "Appearance" );
pg->SetPropertyColoursToDefault( "Appearance", wxPG_RECURSE );
pg->SetPropertyColoursToDefault( "Appearance", wxPGPropertyValuesFlags::Recurse );
pg->SetPropertyColoursToDefault( "PositionCategory" );
pg->SetPropertyColoursToDefault( "PositionCategory", wxPG_RECURSE );
pg->SetPropertyColoursToDefault( "PositionCategory", wxPGPropertyValuesFlags::Recurse );
pg->SetPropertyColoursToDefault( "Environment" );
pg->SetPropertyColoursToDefault( "Environment", wxPG_RECURSE );
pg->SetPropertyColoursToDefault( "More Examples", wxPG_RECURSE );
pg->SetPropertyColoursToDefault( "Environment", wxPGPropertyValuesFlags::Recurse );
pg->SetPropertyColoursToDefault( "More Examples", wxPGPropertyValuesFlags::Recurse );
}
m_pPropGridManager->Thaw();
m_pPropGridManager->Refresh();
@ -3048,7 +3049,7 @@ void FormMain::OnMisc ( wxCommandEvent& event )
{
m_storedValues = m_pPropGridManager->GetGrid()->GetPropertyValues("Test",
m_pPropGridManager->GetGrid()->GetRoot(),
wxPG_KEEP_STRUCTURE|wxPG_INC_ATTRIBUTES);
wxPGPropertyValuesFlags::KeepStructure|wxPGPropertyValuesFlags::IncAttributes);
}
else if ( id == ID_SETVALUES )
{
@ -3110,7 +3111,7 @@ void FormMain::OnPopulateClick( wxCommandEvent& event )
void FormMain::OnDumpList(wxCommandEvent& WXUNUSED(event))
{
wxVariant values = m_pPropGridManager->GetPropertyValues("list", wxNullProperty, wxPG_INC_ATTRIBUTES);
wxVariant values = m_pPropGridManager->GetPropertyValues("list", wxNullProperty, wxPGPropertyValuesFlags::IncAttributes);
wxString text = "This only tests that wxVariant related routines do not crash.\n";
wxDialog* dlg = new wxDialog(this, wxID_ANY, "wxVariant Test",

View file

@ -1368,31 +1368,64 @@ WX_PG_IMPLEMENT_INTERNAL_EDITOR_CLASS(CheckBox,
// Check box state flags
enum
enum class wxSimpleCheckBoxStates : int
{
wxSCB_STATE_UNCHECKED = 0,
wxSCB_STATE_CHECKED = 1,
wxSCB_STATE_BOLD = 2,
wxSCB_STATE_UNSPECIFIED = 4
Unchecked = 0,
Checked = 1,
Bold = 2,
Unspecified = 4
};
constexpr wxSimpleCheckBoxStates operator&(wxSimpleCheckBoxStates a, wxSimpleCheckBoxStates b)
{
return static_cast<wxSimpleCheckBoxStates>(static_cast<std::underlying_type_t<wxSimpleCheckBoxStates>>(a)
& static_cast<std::underlying_type_t<wxSimpleCheckBoxStates>>(b));
}
constexpr wxSimpleCheckBoxStates operator|(wxSimpleCheckBoxStates a, wxSimpleCheckBoxStates b)
{
return static_cast<wxSimpleCheckBoxStates>(static_cast<std::underlying_type_t<wxSimpleCheckBoxStates>>(a)
| static_cast<std::underlying_type_t<wxSimpleCheckBoxStates>>(b));
}
constexpr wxSimpleCheckBoxStates operator|=(wxSimpleCheckBoxStates& a, wxSimpleCheckBoxStates b)
{
return a = a | b;
}
constexpr wxSimpleCheckBoxStates operator^(wxSimpleCheckBoxStates a, wxSimpleCheckBoxStates b)
{
return static_cast<wxSimpleCheckBoxStates>(static_cast<std::underlying_type_t<wxSimpleCheckBoxStates>>(a)
^ static_cast<std::underlying_type_t<wxSimpleCheckBoxStates>>(b));
}
constexpr wxSimpleCheckBoxStates operator^=(wxSimpleCheckBoxStates& a, wxSimpleCheckBoxStates b)
{
return a = a ^ b;
}
constexpr bool operator!(wxSimpleCheckBoxStates a)
{
return static_cast<std::underlying_type_t<wxSimpleCheckBoxStates>>(a) == 0;
}
const int wxSCB_SETVALUE_CYCLE = 2;
static void DrawSimpleCheckBox(wxWindow* win, wxDC& dc, const wxRect& rect, int state)
static void DrawSimpleCheckBox(wxWindow* win, wxDC& dc, const wxRect& rect, wxSimpleCheckBoxStates state)
{
#if wxPG_USE_RENDERER_NATIVE
int cbFlags = 0;
if ( state & wxSCB_STATE_UNSPECIFIED )
if ( !!(state & wxSimpleCheckBoxStates::Unspecified) )
{
cbFlags |= wxCONTROL_UNDETERMINED;
}
else if ( state & wxSCB_STATE_CHECKED )
else if ( !!(state & wxSimpleCheckBoxStates::Checked) )
{
cbFlags |= wxCONTROL_CHECKED;
}
if ( state & wxSCB_STATE_BOLD )
if ( !!(state & wxSimpleCheckBoxStates::Bold) )
{
// wxCONTROL_CHECKED and wxCONTROL_PRESSED flags
// are equivalent for wxOSX so we have to use
@ -1410,7 +1443,7 @@ static void DrawSimpleCheckBox(wxWindow* win, wxDC& dc, const wxRect& rect, int
wxColour useCol = dc.GetTextForeground();
if ( state & wxSCB_STATE_UNSPECIFIED )
if ( !!(state & wxSimpleCheckBoxStates::Unspecified) )
{
useCol = wxColour(220, 220, 220);
}
@ -1418,7 +1451,7 @@ static void DrawSimpleCheckBox(wxWindow* win, wxDC& dc, const wxRect& rect, int
wxRect r(rect);
// Draw check mark first because it is likely to overdraw the
// surrounding rectangle.
if ( state & wxSCB_STATE_CHECKED )
if ( !!(state & wxSimpleCheckBoxStates::Checked) )
{
wxRect r2(r.x+wxPG_CHECKMARK_XADJ,
r.y+wxPG_CHECKMARK_YADJ,
@ -1434,7 +1467,7 @@ static void DrawSimpleCheckBox(wxWindow* win, wxDC& dc, const wxRect& rect, int
// dc.DrawLine(r.x,r.y+r.height-1,r.x+r.width-1,r.y);
}
if ( !(state & wxSCB_STATE_BOLD) )
if ( !(state & wxSimpleCheckBoxStates::Bold) )
{
// Pen for thin rectangle.
dc.SetPen(useCol);
@ -1472,7 +1505,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize )
: wxControl(parent,id,pos,size,wxBORDER_NONE|wxWANTS_CHARS)
, m_state(0)
, m_state(wxSimpleCheckBoxStates::Unchecked)
{
// Due to SetOwnFont stuff necessary for GTK+ 1.2, we need to have this
wxControl::SetFont( parent->GetFont() );
@ -1498,7 +1531,7 @@ public:
return wxRect(r.x + wxPG_XBEFORETEXT, r.y + ((r.height - box_h) / 2), box_h, box_h);
}
int m_state;
wxSimpleCheckBoxStates m_state;
private:
void OnPaint( wxPaintEvent& event );
@ -1542,10 +1575,10 @@ void wxSimpleCheckBox::OnPaint( wxPaintEvent& WXUNUSED(event) )
dc.SetTextForeground(GetForegroundColour());
int state = m_state;
if ( !(state & wxSCB_STATE_UNSPECIFIED) &&
wxSimpleCheckBoxStates state = m_state;
if ( !(state & wxSimpleCheckBoxStates::Unspecified) &&
GetFont().GetWeight() == wxFONTWEIGHT_BOLD )
state |= wxSCB_STATE_BOLD;
state |= wxSimpleCheckBoxStates::Bold;
DrawSimpleCheckBox(this, dc, m_boxRect, state);
}
@ -1570,11 +1603,11 @@ void wxSimpleCheckBox::SetValue( int value )
{
if ( value == wxSCB_SETVALUE_CYCLE )
{
m_state ^= wxSCB_STATE_CHECKED;
m_state ^= wxSimpleCheckBoxStates::Checked;
}
else
{
m_state = value;
m_state = value == 0 ? wxSimpleCheckBoxStates::Unchecked : wxSimpleCheckBoxStates::Checked;
}
Refresh();
@ -1637,17 +1670,17 @@ void wxPGCheckBoxEditor::DrawValue( wxDC& dc, const wxRect& rect,
wxPGProperty* property,
const wxString& WXUNUSED(text) ) const
{
int state = wxSCB_STATE_UNCHECKED;
wxSimpleCheckBoxStates state = wxSimpleCheckBoxStates::Unchecked;
if ( !property->IsValueUnspecified() )
{
state = property->GetChoiceSelection();
state = property->GetChoiceSelection() == 0 ? wxSimpleCheckBoxStates::Unchecked : wxSimpleCheckBoxStates::Checked;
if ( dc.GetFont().GetWeight() == wxFONTWEIGHT_BOLD )
state |= wxSCB_STATE_BOLD;
state |= wxSimpleCheckBoxStates::Bold;
}
else
{
state |= wxSCB_STATE_UNSPECIFIED;
state |= wxSimpleCheckBoxStates::Unspecified;
}
// Box rectangle
@ -1662,9 +1695,10 @@ void wxPGCheckBoxEditor::UpdateControl( wxPGProperty* property,
wxCHECK_RET(cb, "Only wxSimpleCheckBox editor can be updated");
if ( !property->IsValueUnspecified() )
cb->m_state = property->GetChoiceSelection();
cb->m_state = property->GetChoiceSelection() == 0
? wxSimpleCheckBoxStates::Unchecked : wxSimpleCheckBoxStates::Checked;
else
cb->m_state = wxSCB_STATE_UNSPECIFIED;
cb->m_state = wxSimpleCheckBoxStates::Unspecified;
wxPropertyGrid* propGrid = property->GetGrid();
cb->SetBoxHeight(propGrid->GetFontHeight());
@ -1687,7 +1721,7 @@ bool wxPGCheckBoxEditor::GetValueFromControl( wxVariant& variant, wxPGProperty*
{
wxSimpleCheckBox* cb = (wxSimpleCheckBox*)ctrl;
int index = cb->m_state;
int index = !!(cb->m_state & wxSimpleCheckBoxStates::Checked) ? 1 : 0;
if ( index != property->GetChoiceSelection() ||
// Changing unspecified always causes event (returning
@ -1703,15 +1737,14 @@ bool wxPGCheckBoxEditor::GetValueFromControl( wxVariant& variant, wxPGProperty*
void wxPGCheckBoxEditor::SetControlIntValue( wxPGProperty* WXUNUSED(property), wxWindow* ctrl, int value ) const
{
if ( value != 0 ) value = 1;
((wxSimpleCheckBox*)ctrl)->m_state = value;
((wxSimpleCheckBox*)ctrl)->m_state = value == 0 ? wxSimpleCheckBoxStates::Unchecked : wxSimpleCheckBoxStates::Checked;
ctrl->Refresh();
}
void wxPGCheckBoxEditor::SetValueToUnspecified( wxPGProperty* WXUNUSED(property), wxWindow* ctrl ) const
{
((wxSimpleCheckBox*)ctrl)->m_state = wxSCB_STATE_UNSPECIFIED;
((wxSimpleCheckBox*)ctrl)->m_state = wxSimpleCheckBoxStates::Unspecified;
ctrl->Refresh();
}

View file

@ -366,14 +366,12 @@ void wxPropertyGridPage::SetSplitterPosition( int splitterPos, int col )
if ( pg->GetState() == this )
pg->SetSplitterPosition(splitterPos);
else
DoSetSplitterPosition(splitterPos, col, false);
DoSetSplitterPosition(splitterPos, col, wxPGSplitterPositionFlags::Null);
}
void wxPropertyGridPage::DoSetSplitterPosition( int pos,
int splitterColumn,
int flags )
void wxPropertyGridPage::DoSetSplitterPosition(int pos, int splitterColumn, wxPGSplitterPositionFlags flags )
{
if ( (flags & wxPG_SPLITTER_ALL_PAGES) && m_manager->GetPageCount() )
if ( !!(flags & wxPGSplitterPositionFlags::AllPages) && m_manager->GetPageCount() )
m_manager->SetSplitterPosition( pos, splitterColumn );
else
wxPropertyGridPageState::DoSetSplitterPosition( pos,
@ -515,8 +513,8 @@ private:
x += colWidth;
pg->DoSetSplitterPosition(x, col,
wxPG_SPLITTER_REFRESH |
wxPG_SPLITTER_FROM_EVENT);
wxPGSplitterPositionFlags::Refresh |
wxPGSplitterPositionFlags::FromEvent);
}
void OnResizing(wxHeaderCtrlEvent& evt)
@ -528,7 +526,7 @@ private:
OnColumWidthsChanged();
wxPropertyGrid* pg = m_manager->GetGrid();
pg->SendEvent(wxEVT_PG_COL_DRAGGING, nullptr, nullptr, 0,
pg->SendEvent(wxEVT_PG_COL_DRAGGING, nullptr, nullptr, wxPGSelectPropertyFlags::Null,
(unsigned int)col);
}
@ -546,7 +544,7 @@ private:
evt.Veto();
// Allow application to veto dragging
else if ( pg->SendEvent(wxEVT_PG_COL_BEGIN_DRAG,
nullptr, nullptr, 0,
nullptr, nullptr, wxPGSelectPropertyFlags::Null,
(unsigned int)col) )
evt.Veto();
}
@ -556,7 +554,7 @@ private:
int col = evt.GetColumn();
wxPropertyGrid* pg = m_manager->GetGrid();
pg->SendEvent(wxEVT_PG_COL_END_DRAG,
nullptr, nullptr, 0,
nullptr, nullptr, wxPGSelectPropertyFlags::Null,
(unsigned int)col);
}
@ -2319,7 +2317,7 @@ void wxPropertyGridManager::SetSplitterPosition( int pos, int splitterColumn )
{
wxPropertyGridPage* page = GetPage(i);
page->DoSetSplitterPosition( pos, splitterColumn,
wxPG_SPLITTER_REFRESH );
wxPGSplitterPositionFlags::Refresh );
}
#if wxUSE_HEADERCTRL

View file

@ -1422,11 +1422,11 @@ bool wxPGProperty::OnEvent( wxPropertyGrid*, wxWindow*, wxEvent& )
}
void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags )
void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, wxPGSetValueFlags flags )
{
// If auto unspecified values are not wanted (via window or property style),
// then get default value instead of null wxVariant.
if ( value.IsNull() && (flags & wxPG_SETVAL_BY_USER) &&
if ( value.IsNull() && !!(flags & wxPGSetValueFlags::ByUser) &&
!UsesAutoUnspecified() )
{
value = GetDefaultValue();
@ -1457,7 +1457,7 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags )
}
if ( HasFlag( wxPG_PROP_AGGREGATE) )
flags |= wxPG_SETVAL_AGGREGATED;
flags |= wxPGSetValueFlags::Aggregated;
if ( pList && !pList->IsNull() )
{
@ -1481,15 +1481,15 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags )
//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 & wxPG_SETVAL_AGGREGATED) )
if ( child->HasFlag(wxPG_PROP_AGGREGATE) && !(flags & wxPGSetValueFlags::Aggregated) )
{
wxVariant listRefCopy = childValue;
child->SetValue(childValue, &listRefCopy, flags|wxPG_SETVAL_FROM_PARENT);
child->SetValue(childValue, &listRefCopy, flags| wxPGSetValueFlags::FromParent);
}
else
{
wxVariant oldVal = child->GetValue();
child->SetValue(oldVal, &childValue, flags|wxPG_SETVAL_FROM_PARENT);
child->SetValue(oldVal, &childValue, flags| wxPGSetValueFlags::FromParent);
}
}
else if ( child->GetValue() != childValue )
@ -1497,8 +1497,8 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags )
// For aggregate properties, we will trust RefreshChildren()
// to update child values.
if ( !HasFlag(wxPG_PROP_AGGREGATE) )
child->SetValue(childValue, nullptr, flags|wxPG_SETVAL_FROM_PARENT);
if ( flags & wxPG_SETVAL_BY_USER )
child->SetValue(childValue, nullptr, flags| wxPGSetValueFlags::FromParent);
if ( !!(flags & wxPGSetValueFlags::ByUser) )
child->SetFlag(wxPG_PROP_MODIFIED);
}
}
@ -1518,7 +1518,7 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags )
OnSetValue();
}
if ( flags & wxPG_SETVAL_BY_USER )
if ( !!(flags & wxPGSetValueFlags::ByUser) )
SetFlag(wxPG_PROP_MODIFIED);
if ( HasFlag(wxPG_PROP_AGGREGATE) )
@ -1540,16 +1540,16 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags )
if ( AreChildrenComponents() )
{
for ( unsigned int i = 0; i < GetChildCount(); i++ )
Item(i)->SetValue(value, nullptr, flags|wxPG_SETVAL_FROM_PARENT);
Item(i)->SetValue(value, nullptr, flags| wxPGSetValueFlags::FromParent);
}
}
if ( !(flags & wxPG_SETVAL_FROM_PARENT) )
if ( !(flags & wxPGSetValueFlags::FromParent) )
UpdateParentValues();
//
// Update editor control.
if ( flags & wxPG_SETVAL_REFRESH_EDITOR )
if ( !!(flags & wxPGSetValueFlags::RefreshEditor) )
{
wxPropertyGrid* pg = GetGridIfDisplayed();
if ( pg )
@ -1774,11 +1774,10 @@ wxPGCell& wxPGProperty::GetOrCreateCell( unsigned int column )
return m_cells[column];
}
void wxPGProperty::SetBackgroundColour( const wxColour& colour,
int flags )
void wxPGProperty::SetBackgroundColour(const wxColour& colour, wxPGPropertyValuesFlags flags)
{
wxPGProperty* firstProp = this;
bool recursively = (flags & wxPG_RECURSE) != 0;
bool recursively = !!(flags & wxPGPropertyValuesFlags::Recurse);
//
// If category is tried to set recursively, skip it and only
@ -1810,11 +1809,10 @@ void wxPGProperty::SetBackgroundColour( const wxColour& colour,
recursively );
}
void wxPGProperty::SetTextColour( const wxColour& colour,
int flags )
void wxPGProperty::SetTextColour(const wxColour& colour, wxPGPropertyValuesFlags flags)
{
wxPGProperty* firstProp = this;
bool recursively = (flags & wxPG_RECURSE) != 0;
bool recursively = !!(flags & wxPGPropertyValuesFlags::Recurse);
//
// If category is tried to set recursively, skip it and only
@ -1846,10 +1844,10 @@ void wxPGProperty::SetTextColour( const wxColour& colour,
recursively );
}
void wxPGProperty::SetDefaultColours(int flags)
void wxPGProperty::SetDefaultColours(wxPGPropertyValuesFlags flags)
{
wxPGProperty* firstProp = this;
bool recursively = (flags & wxPG_RECURSE) != 0;
bool recursively = !!(flags & wxPGPropertyValuesFlags::Recurse);
// If category is tried to set recursively, skip it and only
// affect the children.
@ -2130,7 +2128,7 @@ bool wxPGProperty::SetChoices( const wxPGChoices& choices )
if ( isSelected )
{
// Recreate editor
pg->DoSelectProperty(this, wxPG_SEL_FORCE);
pg->DoSelectProperty(this, wxPGSelectPropertyFlags::Force);
}
return true;
@ -2156,7 +2154,7 @@ const wxPGEditor* wxPGProperty::GetEditorClass() const
return editor;
}
bool wxPGProperty::Hide( bool hide, int flags )
bool wxPGProperty::Hide( bool hide, wxPGPropertyValuesFlags flags )
{
wxPropertyGrid* pg = GetGrid();
if ( pg )
@ -2165,14 +2163,14 @@ bool wxPGProperty::Hide( bool hide, int flags )
return DoHide( hide, flags );
}
bool wxPGProperty::DoHide( bool hide, int flags )
bool wxPGProperty::DoHide( bool hide, wxPGPropertyValuesFlags flags )
{
ChangeFlag(wxPG_PROP_HIDDEN, hide);
if ( flags & wxPG_RECURSE )
if ( !!(flags & wxPGPropertyValuesFlags::Recurse) )
{
for ( unsigned int i = 0; i < GetChildCount(); i++ )
Item(i)->DoHide(hide, flags | wxPG_RECURSE_STARTS);
Item(i)->DoHide(hide, flags | wxPGPropertyValuesFlags::RecurseStarts);
}
return true;
@ -2199,7 +2197,7 @@ bool wxPGProperty::RecreateEditor()
wxPGProperty* selected = pg->GetSelection();
if ( this == selected )
{
pg->DoSelectProperty(this, wxPG_SEL_FORCE);
pg->DoSelectProperty(this, wxPGSelectPropertyFlags::Force);
return true;
}
return false;

View file

@ -360,7 +360,7 @@ void wxPropertyGrid::Init1()
m_inCommitChangesFromEditor = false;
m_inDoSelectProperty = false;
m_inOnValidationFailure = false;
m_permanentValidationFailureBehavior = wxPG_VFB_DEFAULT;
m_permanentValidationFailureBehavior = wxPGVFBFlags::Default;
m_dragStatus = 0;
m_editorFocused = false;
@ -531,7 +531,7 @@ wxPropertyGrid::~wxPropertyGrid()
wxS("at idle time instead."));
}
DoSelectProperty(nullptr, wxPG_SEL_NOVALIDATE|wxPG_SEL_DONT_SEND_EVENT);
DoSelectProperty(nullptr, wxPGSelectPropertyFlags::NoValidate| wxPGSelectPropertyFlags::DontSendEvent);
// This should do prevent things from going too badly wrong
m_iFlags &= ~(wxPG_FL_INITIALIZED);
@ -685,13 +685,13 @@ void wxPropertyGrid::DoThaw()
// Force property re-selection
// NB: We must copy the selection.
wxArrayPGProperty selection = m_pState->m_selection;
DoSetSelection(selection, wxPG_SEL_FORCE | wxPG_SEL_NONVISIBLE);
DoSetSelection(selection, wxPGSelectPropertyFlags::Force | wxPGSelectPropertyFlags::Nonvisible);
}
}
// -----------------------------------------------------------------------
bool wxPropertyGrid::DoAddToSelection( wxPGProperty* prop, int selFlags )
bool wxPropertyGrid::DoAddToSelection( wxPGProperty* prop, wxPGSelectPropertyFlags selFlags )
{
wxCHECK( prop, false );
@ -712,7 +712,7 @@ bool wxPropertyGrid::DoAddToSelection( wxPGProperty* prop, int selFlags )
selection.push_back(prop);
if ( !(selFlags & wxPG_SEL_DONT_SEND_EVENT) )
if ( !(selFlags & wxPGSelectPropertyFlags::DontSendEvent) )
{
SendEvent( wxEVT_PG_SELECTED, prop, nullptr );
}
@ -725,7 +725,7 @@ bool wxPropertyGrid::DoAddToSelection( wxPGProperty* prop, int selFlags )
// -----------------------------------------------------------------------
bool wxPropertyGrid::DoRemoveFromSelection( wxPGProperty* prop, int selFlags )
bool wxPropertyGrid::DoRemoveFromSelection( wxPGProperty* prop, wxPGSelectPropertyFlags selFlags )
{
wxCHECK( prop, false );
bool res;
@ -749,7 +749,7 @@ bool wxPropertyGrid::DoRemoveFromSelection( wxPGProperty* prop, int selFlags )
bool wxPropertyGrid::DoSelectAndEdit( wxPGProperty* prop,
unsigned int colIndex,
unsigned int selFlags )
wxPGSelectPropertyFlags selFlags )
{
//
// NB: Enable following if label editor background colour is
@ -772,7 +772,7 @@ bool wxPropertyGrid::DoSelectAndEdit( wxPGProperty* prop,
else
{
// send event
DoClearSelection(false, wxPG_SEL_NO_REFRESH);
DoClearSelection(false, wxPGSelectPropertyFlags::NoRefresh);
if ( m_pState->m_editableColumns.find(colIndex) == m_pState->m_editableColumns.end() )
{
@ -780,7 +780,7 @@ bool wxPropertyGrid::DoSelectAndEdit( wxPGProperty* prop,
}
else
{
res = DoAddToSelection(prop, selFlags|wxPG_SEL_NO_REFRESH);
res = DoAddToSelection(prop, selFlags| wxPGSelectPropertyFlags::NoRefresh);
DoBeginLabelEdit(colIndex, selFlags);
}
@ -795,7 +795,7 @@ bool wxPropertyGrid::DoSelectAndEdit( wxPGProperty* prop,
bool wxPropertyGrid::AddToSelectionFromInputEvent( wxPGProperty* prop,
unsigned int colIndex,
wxMouseEvent* mouseEvent,
int selFlags )
wxPGSelectPropertyFlags selFlags )
{
const wxArrayPGProperty& selection = GetSelectedProperties();
bool alreadySelected = m_pState->DoIsPropertySelected(prop);
@ -909,7 +909,7 @@ bool wxPropertyGrid::AddToSelectionFromInputEvent( wxPGProperty* prop,
// -----------------------------------------------------------------------
void wxPropertyGrid::DoSetSelection( const wxArrayPGProperty& newSelection,
int selFlags )
wxPGSelectPropertyFlags selFlags )
{
if ( !newSelection.empty() )
{
@ -955,16 +955,16 @@ void wxPropertyGrid::MakeColumnEditable( unsigned int column,
// -----------------------------------------------------------------------
void wxPropertyGrid::DoBeginLabelEdit( unsigned int colIndex,
int selFlags )
wxPGSelectPropertyFlags selFlags )
{
wxPGProperty* selected = GetSelection();
wxCHECK_RET(selected, wxS("No property selected"));
wxCHECK_RET(colIndex != 1, wxS("Do not use this for column 1"));
if ( !(selFlags & wxPG_SEL_DONT_SEND_EVENT) )
if ( !(selFlags & wxPGSelectPropertyFlags::DontSendEvent) )
{
if ( SendEvent( wxEVT_PG_LABEL_EDIT_BEGIN,
selected, nullptr, 0,
selected, nullptr, wxPGSelectPropertyFlags::Null,
colIndex ) )
return;
}
@ -989,7 +989,7 @@ void wxPropertyGrid::DoBeginLabelEdit( unsigned int colIndex,
if ( cell && cell->HasText() )
text = cell->GetText();
DoEndLabelEdit(true, wxPG_SEL_NOVALIDATE); // send event
DoEndLabelEdit(true, wxPGSelectPropertyFlags::NoValidate); // send event
m_selColumn = colIndex;
@ -1040,7 +1040,7 @@ void wxPropertyGrid::OnLabelEditorKeyPress( wxKeyEvent& event )
// -----------------------------------------------------------------------
void wxPropertyGrid::DoEndLabelEdit( bool commit, int selFlags )
void wxPropertyGrid::DoEndLabelEdit( bool commit, wxPGSelectPropertyFlags selFlags )
{
if ( !m_labelEditor )
return;
@ -1052,7 +1052,7 @@ void wxPropertyGrid::DoEndLabelEdit( bool commit, int selFlags )
{
const int labelColIdx = m_selColumn;
if ( !(selFlags & wxPG_SEL_DONT_SEND_EVENT) )
if ( !(selFlags & wxPGSelectPropertyFlags::DontSendEvent) )
{
// Don't send wxEVT_PG_LABEL_EDIT_ENDING event recursively
// for the same property and the same label.
@ -1063,7 +1063,7 @@ void wxPropertyGrid::DoEndLabelEdit( bool commit, int selFlags )
return;
}
// wxPG_SEL_NOVALIDATE is passed correctly in selFlags
// wxPGSelectPropertyFlags::NoValidate is passed correctly in selFlags
if ( SendEvent( wxEVT_PG_LABEL_EDIT_ENDING,
prop, nullptr, selFlags,
m_selColumn ) )
@ -1620,7 +1620,7 @@ void wxPropertyGrid::PrepareAfterItemsAdded()
m_pState->m_itemsAdded = false;
if ( m_windowStyle & wxPG_AUTO_SORT )
Sort(wxPG_SORT_TOP_LEVEL_ONLY);
Sort(wxPGPropertyValuesFlags::SortTopLevelOnly);
RecalculateVirtualSize();
@ -2582,10 +2582,10 @@ void wxPropertyGrid::RefreshProperty( wxPGProperty* p )
{
// NB: We must copy the selection.
wxArrayPGProperty selection = m_pState->m_selection;
int selFlags = wxPG_SEL_FORCE;
wxPGSelectPropertyFlags selFlags = wxPGSelectPropertyFlags::Force;
// We want to keep property's editor focused.
if ( IsEditorFocused() )
selFlags |= wxPG_SEL_FOCUS;
selFlags |= wxPGSelectPropertyFlags::Focus;
DoSetSelection(selection, selFlags);
}
@ -2785,17 +2785,17 @@ void wxPropertyGrid::SwitchState( wxPropertyGridPageState* pNewState )
// if parent window is shown.
void wxPropertyGrid::DoSetSplitterPosition( int newxpos,
int splitterIndex,
int flags )
wxPGSplitterPositionFlags flags )
{
if ( newxpos < wxPG_DRAG_MARGIN )
return;
if ( flags & wxPG_SPLITTER_FROM_EVENT )
if ( !!(flags & wxPGSplitterPositionFlags::FromEvent) )
m_pState->m_dontCenterSplitter = true;
m_pState->DoSetSplitterPosition(newxpos, splitterIndex, flags);
if ( flags & wxPG_SPLITTER_REFRESH )
if ( !!(flags & wxPGSplitterPositionFlags::Refresh) )
{
if ( GetSelection() )
{
@ -2814,7 +2814,7 @@ void wxPropertyGrid::ResetColumnSizes( bool enableAutoResizing )
{
if ( m_pState )
{
m_pState->ResetColumnSizes(0);
m_pState->ResetColumnSizes(wxPGSplitterPositionFlags::Null);
if ( GetSelection() )
{
CorrectEditorWidgetSizeX();
@ -2874,7 +2874,7 @@ wxPGProperty* wxPropertyGrid::GetNearestPaintVisible( wxPGProperty* p ) const
// commits any changes in editor of selected property
// return true if validation did not fail
// flags are same as with DoSelectProperty
bool wxPropertyGrid::CommitChangesFromEditor( wxUint32 flags )
bool wxPropertyGrid::CommitChangesFromEditor(wxPGSelectPropertyFlags flags)
{
// Committing already?
if ( m_inCommitChangesFromEditor )
@ -2907,7 +2907,7 @@ bool wxPropertyGrid::CommitChangesFromEditor( wxUint32 flags )
wxWindow* oldFocus = m_curFocused;
bool validationFailure = false;
bool forceSuccess = (flags & (wxPG_SEL_NOVALIDATE | wxPG_SEL_FORCE)) != 0;
bool forceSuccess = !!(flags & (wxPGSelectPropertyFlags::NoValidate | wxPGSelectPropertyFlags::Force));
m_chgInfo_changedProperty = nullptr;
@ -3189,9 +3189,9 @@ bool wxPropertyGrid::OnValidationFailure( wxPGProperty* property,
if ( property->HasFlag(wxPG_PROP_INVALID_VALUE) )
{
m_validationInfo.SetFailureBehavior(
vfb & ~(wxPG_VFB_SHOW_MESSAGE |
wxPG_VFB_SHOW_MESSAGEBOX |
wxPG_VFB_SHOW_MESSAGE_ON_STATUSBAR));
vfb & ~(wxPGVFBFlags::ShowMessage |
wxPGVFBFlags::ShowMessageBox |
wxPGVFBFlags::ShowMessageOnStatusBar));
}
}
@ -3217,10 +3217,10 @@ bool wxPropertyGrid::DoOnValidationFailure( wxPGProperty* property, wxVariant& W
{
wxPGVFBFlags vfb = m_validationInfo.GetFailureBehavior();
if ( vfb & wxPG_VFB_BEEP )
if ( !!(vfb & wxPGVFBFlags::Beep) )
::wxBell();
if ( (vfb & wxPG_VFB_MARK_CELL) &&
if ( !!(vfb & wxPGVFBFlags::MarkCell) &&
!property->HasFlag(wxPG_PROP_INVALID_VALUE) )
{
unsigned int colCount = m_pState->GetColumnCount();
@ -3255,9 +3255,9 @@ bool wxPropertyGrid::DoOnValidationFailure( wxPGProperty* property, wxVariant& W
DrawItemAndChildren(property);
}
if ( vfb & (wxPG_VFB_SHOW_MESSAGE |
wxPG_VFB_SHOW_MESSAGEBOX |
wxPG_VFB_SHOW_MESSAGE_ON_STATUSBAR) )
if ( !!(vfb & (wxPGVFBFlags::ShowMessage |
wxPGVFBFlags::ShowMessageBox |
wxPGVFBFlags::ShowMessageOnStatusBar)) )
{
wxString msg = m_validationInfo.GetFailureMessage();
@ -3265,7 +3265,7 @@ bool wxPropertyGrid::DoOnValidationFailure( wxPGProperty* property, wxVariant& W
msg = _("You have entered invalid value. Press ESC to cancel editing.");
#if wxUSE_STATUSBAR
if ( vfb & wxPG_VFB_SHOW_MESSAGE_ON_STATUSBAR )
if ( !!(vfb & wxPGVFBFlags::ShowMessageOnStatusBar) )
{
if ( !wxPGGlobalVars->m_offline )
{
@ -3280,10 +3280,10 @@ bool wxPropertyGrid::DoOnValidationFailure( wxPGProperty* property, wxVariant& W
// so let's preserve the current focus in order to restore it afterwards.
wxWindow* focusedWnd = wxWindow::FindFocus();
if ( vfb & wxPG_VFB_SHOW_MESSAGE )
if ( !!(vfb & wxPGVFBFlags::ShowMessage) )
DoShowPropertyError(property, msg);
if ( vfb & wxPG_VFB_SHOW_MESSAGEBOX )
if ( !!(vfb & wxPGVFBFlags::ShowMessageBox) )
/* TRANSLATORS: Caption of message box displaying any property error */
::wxMessageBox(msg, _("Property Error"));
@ -3294,7 +3294,7 @@ bool wxPropertyGrid::DoOnValidationFailure( wxPGProperty* property, wxVariant& W
}
}
return (vfb & wxPG_VFB_STAY_IN_PROPERTY) ? false : true;
return !(vfb & wxPGVFBFlags::StayInProperty);
}
// -----------------------------------------------------------------------
@ -3303,7 +3303,7 @@ void wxPropertyGrid::DoOnValidationFailureReset( wxPGProperty* property )
{
wxPGVFBFlags vfb = m_validationInfo.GetFailureBehavior();
if ( vfb & wxPG_VFB_MARK_CELL )
if ( !(vfb & wxPGVFBFlags::MarkCell) )
{
// Revert cells
property->m_cells = m_propCellsBackup;
@ -3322,7 +3322,7 @@ void wxPropertyGrid::DoOnValidationFailureReset( wxPGProperty* property )
}
#if wxUSE_STATUSBAR
if ( vfb & wxPG_VFB_SHOW_MESSAGE_ON_STATUSBAR )
if ( !(vfb & wxPGVFBFlags::ShowMessageOnStatusBar) )
{
if ( !wxPGGlobalVars->m_offline )
{
@ -3333,7 +3333,7 @@ void wxPropertyGrid::DoOnValidationFailureReset( wxPGProperty* property )
}
#endif
if ( vfb & wxPG_VFB_SHOW_MESSAGE )
if ( !(vfb & wxPGVFBFlags::ShowMessage) )
{
DoHidePropertyError(property);
}
@ -3344,7 +3344,7 @@ void wxPropertyGrid::DoOnValidationFailureReset( wxPGProperty* property )
// -----------------------------------------------------------------------
// flags are same as with DoSelectProperty
bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, unsigned int selFlags )
bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, wxPGSelectPropertyFlags selFlags )
{
if ( m_inDoPropertyChanged )
return true;
@ -3366,7 +3366,7 @@ bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, unsigned int selFlags )
// If property's value is being changed, assume it is valid
OnValidationFailureReset(selected);
changedProperty->SetValue(value, &m_chgInfo_valueList, wxPG_SETVAL_BY_USER);
changedProperty->SetValue(value, &m_chgInfo_valueList, wxPGSetValueFlags::ByUser);
// NB: Call GetEditorControl() as late as possible, because OnSetValue()
// and perhaps other user-defined virtual functions may change it.
@ -3408,7 +3408,7 @@ bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, unsigned int selFlags )
//
// If value was set by wxPGProperty::OnEvent, then update the editor
// control.
if ( selFlags & wxPG_SEL_DIALOGVAL )
if ( !!(selFlags & wxPGSelectPropertyFlags::DialogVal) )
{
RefreshEditor();
}
@ -3562,7 +3562,7 @@ bool wxPropertyGrid::HandleCustomEditorEvent( wxEvent &event )
wxVariant pendingValue(selected->GetValueRef());
wxWindow* wnd = GetEditorControl();
wxWindow* editorWnd = wxDynamicCast(event.GetEventObject(), wxWindow);
int selFlags = 0;
wxPGSelectPropertyFlags selFlags = wxPGSelectPropertyFlags::Null;
bool wasUnspecified = selected->IsValueUnspecified();
int usesAutoUnspecified = selected->UsesAutoUnspecified();
bool valueIsPending = false;
@ -3685,7 +3685,7 @@ bool wxPropertyGrid::HandleCustomEditorEvent( wxEvent &event )
{
valueIsPending = true;
pendingValue = m_changeInEventValue;
selFlags |= wxPG_SEL_DIALOGVAL;
selFlags |= wxPGSelectPropertyFlags::DialogVal;
}
if ( !validationFailure && valueIsPending )
@ -3698,7 +3698,8 @@ bool wxPropertyGrid::HandleCustomEditorEvent( wxEvent &event )
}
else if ( valueIsPending )
{
selFlags |= ( !wasUnspecified && selected->IsValueUnspecified() && usesAutoUnspecified ) ? wxPG_SEL_SETUNSPEC : 0;
selFlags |= ( !wasUnspecified && selected->IsValueUnspecified() && usesAutoUnspecified )
? wxPGSelectPropertyFlags::SetUnspec : wxPGSelectPropertyFlags::Null;
DoPropertyChanged(selected, selFlags);
EditorsValueWasNotModified();
@ -3999,7 +4000,7 @@ void wxPropertyGrid::FreeEditors()
}
// Call with nullptr to de-select property
bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, wxPGSelectPropertyFlags flags )
{
/*
if (p)
@ -4031,7 +4032,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
prevFirstSel = nullptr;
// Always send event, as this is indirect call
DoEndLabelEdit(true, wxPG_SEL_NOVALIDATE);
DoEndLabelEdit(true, wxPGSelectPropertyFlags::NoValidate);
/*
if ( prevFirstSel )
@ -4066,12 +4067,12 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
// Is it the same?
if ( prevFirstSel == p &&
prevSelection.size() <= 1 &&
!(flags & wxPG_SEL_FORCE) )
!(flags & wxPGSelectPropertyFlags::Force) )
{
// Only set focus if not deselecting
if ( p )
{
if ( flags & wxPG_SEL_FOCUS )
if ( !!(flags & wxPGSelectPropertyFlags::Focus) )
{
if ( m_wndEditor )
{
@ -4233,7 +4234,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
SetupChildEventHandling(primaryCtrl);
// Focus and select all (wxTextCtrl, wxComboBox etc.)
if ( flags & wxPG_SEL_FOCUS )
if ( !!(flags & wxPGSelectPropertyFlags::Focus) )
{
primaryCtrl->SetFocus();
@ -4272,12 +4273,12 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
// NOTE: Due to problems focusing away from it, this
// has been disabled.
/*
if ( (flags & wxPG_SEL_FOCUS) && !m_wndEditor )
if ( (flags & wxPGSelectPropertyFlags::Focus) && !m_wndEditor )
m_wndEditor2->SetFocus();
*/
}
if ( flags & wxPG_SEL_FOCUS )
if ( !!(flags & wxPGSelectPropertyFlags::Focus) )
m_editorFocused = true;
}
@ -4292,7 +4293,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
// If it's inside collapsed section, expand parent, scroll, etc.
// Also, if it was partially visible, scroll it into view.
if ( !(flags & wxPG_SEL_NONVISIBLE) )
if ( !(flags & wxPGSelectPropertyFlags::Nonvisible) )
EnsureVisible( p );
if ( m_wndEditor )
@ -4300,7 +4301,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
m_wndEditor->Show(true);
}
if ( !(flags & wxPG_SEL_NO_REFRESH) )
if ( !(flags & wxPGSelectPropertyFlags::NoRefresh) )
DrawItem(p);
}
else
@ -4366,7 +4367,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
{
p = prevFirstSel;
}
if ( !(flags & wxPG_SEL_DONT_SEND_EVENT) && p)
if ( !(flags & wxPGSelectPropertyFlags::DontSendEvent) && p)
SendEvent( wxEVT_PG_SELECTED, p, nullptr );
return true;
@ -4381,7 +4382,7 @@ bool wxPropertyGrid::UnfocusEditor()
if ( !selected || !m_wndEditor || IsFrozen() )
return true;
if ( !CommitChangesFromEditor(0) )
if ( !CommitChangesFromEditor() )
return false;
SetFocusOnCanvas();
@ -4426,9 +4427,9 @@ bool wxPropertyGrid::SelectProperty( wxPGPropArg id, bool focus )
{
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
unsigned int flags = wxPG_SEL_DONT_SEND_EVENT;
wxPGSelectPropertyFlags flags = wxPGSelectPropertyFlags::DontSendEvent;
if ( focus )
flags |= wxPG_SEL_FOCUS;
flags |= wxPGSelectPropertyFlags::Focus;
return DoSelectProperty(p, flags);
}
@ -4495,7 +4496,7 @@ bool wxPropertyGrid::DoExpand( wxPGProperty* p, bool sendEvents )
// -----------------------------------------------------------------------
bool wxPropertyGrid::DoHideProperty( wxPGProperty* p, bool hide, int flags )
bool wxPropertyGrid::DoHideProperty( wxPGProperty* p, bool hide, wxPGPropertyValuesFlags flags )
{
if ( IsFrozen() )
return m_pState->DoHideProperty(p, hide, flags);
@ -4505,7 +4506,7 @@ bool wxPropertyGrid::DoHideProperty( wxPGProperty* p, bool hide, int flags )
{
if ( selected == p || selected->IsSomeParent(p) )
{
if ( !DoRemoveFromSelection(p, flags) )
if ( !DoRemoveFromSelection(p) )
return false;
}
}
@ -4691,10 +4692,10 @@ void wxPropertyGrid::SetFocusOnCanvas()
// Returns true if event was vetoed.
bool wxPropertyGrid::SendEvent( wxEventType eventType, wxPGProperty* p,
wxVariant* pValue,
unsigned int selFlags,
wxPGSelectPropertyFlags selFlags,
unsigned int column )
{
// selFlags should have wxPG_SEL_NOVALIDATE if event is not
// selFlags should have wxPGSelectPropertyFlags::NoValidate if event is not
// vetoable.
// Send property grid event of specific type and with specific property
@ -4715,7 +4716,7 @@ bool wxPropertyGrid::SendEvent( wxEventType eventType, wxPGProperty* p,
if ( p )
evt.SetPropertyValue(p->GetValue());
if ( !(selFlags & wxPG_SEL_NOVALIDATE) )
if ( !(selFlags & wxPGSelectPropertyFlags::NoValidate) )
evt.SetCanVeto(true);
}
@ -4803,11 +4804,11 @@ bool wxPropertyGrid::HandleMouseClick( int x, unsigned int y, wxMouseEvent &even
else if ( splitterHit == -1 )
{
// Click on value.
unsigned int selFlag = 0;
wxPGSelectPropertyFlags selFlag = wxPGSelectPropertyFlags::Null;
if ( columnHit == 1 )
{
m_iFlags |= wxPG_FL_ACTIVATION_BY_CLICK;
selFlag = wxPG_SEL_FOCUS;
selFlag = wxPGSelectPropertyFlags::Focus;
}
if ( !AddToSelectionFromInputEvent( p,
columnHit,
@ -4846,7 +4847,7 @@ bool wxPropertyGrid::HandleMouseClick( int x, unsigned int y, wxMouseEvent &even
SendEvent(wxEVT_PG_COL_DRAGGING,
m_propHover,
nullptr,
wxPG_SEL_NOVALIDATE,
wxPGSelectPropertyFlags::NoValidate,
0); // dragged splitter is always 0 here
}
}
@ -4857,11 +4858,11 @@ bool wxPropertyGrid::HandleMouseClick( int x, unsigned int y, wxMouseEvent &even
//
// send event
DoEndLabelEdit(true, wxPG_SEL_NOVALIDATE);
DoEndLabelEdit(true, wxPGSelectPropertyFlags::NoValidate);
// Allow application to veto dragging
if ( !SendEvent(wxEVT_PG_COL_BEGIN_DRAG,
p, nullptr, 0,
p, nullptr, wxPGSelectPropertyFlags::Null,
(unsigned int)splitterHit) )
{
if ( m_wndEditor )
@ -5002,14 +5003,14 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y,
// Move everything
DoSetSplitterPosition(newSplitterX,
m_draggedSplitter,
wxPG_SPLITTER_REFRESH |
wxPG_SPLITTER_FROM_EVENT);
wxPGSplitterPositionFlags::Refresh |
wxPGSplitterPositionFlags::FromEvent);
SendEvent(wxEVT_PG_COLS_RESIZED, wxNullProperty);
SendEvent(wxEVT_PG_COL_DRAGGING,
m_propHover,
nullptr,
wxPG_SEL_NOVALIDATE,
wxPGSelectPropertyFlags::NoValidate,
(unsigned int)m_draggedSplitter);
}
@ -5221,7 +5222,7 @@ bool wxPropertyGrid::HandleMouseUp( int x, unsigned int WXUNUSED(y),
SendEvent(wxEVT_PG_COL_END_DRAG,
m_propHover,
nullptr,
wxPG_SEL_NOVALIDATE,
wxPGSelectPropertyFlags::NoValidate,
(unsigned int)m_draggedSplitter);
// Disable splitter auto-centering (but only if moved any -
@ -5622,7 +5623,7 @@ void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild )
{
if ( !editorFocused && m_wndEditor )
{
DoSelectProperty( selected, wxPG_SEL_FOCUS );
DoSelectProperty( selected, wxPGSelectPropertyFlags::Focus );
}
else
{
@ -5722,7 +5723,7 @@ void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild )
// Mark as handled only for editable property
if ( !p->IsCategory() && p->IsEnabled() && !p->HasFlag(wxPG_PROP_READONLY) )
{
DoSelectProperty( p, wxPG_SEL_FOCUS );
DoSelectProperty( p, wxPGSelectPropertyFlags::Focus );
wasHandled = true;
}
}
@ -5761,14 +5762,14 @@ void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild )
p = wxPropertyGridIterator::OneStep( m_pState, wxPG_ITERATE_VISIBLE, p, selectDir );
if ( p )
{
int selFlags = 0;
wxPGSelectPropertyFlags selFlags = wxPGSelectPropertyFlags::Null;
int reopenLabelEditorCol = -1;
if ( action == wxPG_ACTION_EDIT )
{
// Make the next editor focused as well
// if we are actually going to edit the property.
selFlags |= wxPG_SEL_FOCUS;
selFlags |= wxPGSelectPropertyFlags::Focus;
}
else
{

View file

@ -178,7 +178,7 @@ wxPGProperty* wxPropertyGridInterface::GetSelection() const
bool wxPropertyGridInterface::ClearSelection( bool validation )
{
bool res = DoClearSelection(validation, wxPG_SEL_DONT_SEND_EVENT);
bool res = DoClearSelection(validation, wxPGSelectPropertyFlags::DontSendEvent);
wxPropertyGrid* pg = GetPropertyGrid();
if ( pg )
pg->Refresh();
@ -188,10 +188,10 @@ bool wxPropertyGridInterface::ClearSelection( bool validation )
// -----------------------------------------------------------------------
bool wxPropertyGridInterface::DoClearSelection( bool validation,
int selFlags )
wxPGSelectPropertyFlags selFlags )
{
if ( !validation )
selFlags |= wxPG_SEL_NOVALIDATE;
selFlags |= wxPGSelectPropertyFlags::NoValidate;
wxPropertyGridPageState* state = m_pState;
@ -233,7 +233,7 @@ bool wxPropertyGridInterface::EnableProperty( wxPGPropArg id, bool enable )
// If active, Set active Editor.
if ( grid && grid->GetState() == state && p == grid->GetSelection() )
grid->DoSelectProperty( p, wxPG_SEL_FORCE );
grid->DoSelectProperty( p, wxPGSelectPropertyFlags::Force );
}
else
{
@ -242,7 +242,7 @@ bool wxPropertyGridInterface::EnableProperty( wxPGPropArg id, bool enable )
// If active, Disable as active Editor.
if ( grid && grid->GetState() == state && p == grid->GetSelection() )
grid->DoSelectProperty( p, wxPG_SEL_FORCE );
grid->DoSelectProperty( p, wxPGSelectPropertyFlags::Force );
}
p->DoEnable(enable);
@ -252,11 +252,11 @@ bool wxPropertyGridInterface::EnableProperty( wxPGPropArg id, bool enable )
return true;
}
void wxPropertyGridInterface::SetPropertyReadOnly( wxPGPropArg id, bool set, int flags)
void wxPropertyGridInterface::SetPropertyReadOnly( wxPGPropArg id, bool set, wxPGPropertyValuesFlags flags)
{
wxPG_PROP_ARG_CALL_PROLOG()
if ( flags & wxPG_RECURSE )
if ( !!(flags & wxPGPropertyValuesFlags::Recurse) )
{
p->SetFlagRecursively(wxPG_PROP_READONLY, set);
}
@ -400,7 +400,7 @@ void wxPropertyGridInterface::SetPropertyValueString( wxPGPropArg id, const wxSt
// -----------------------------------------------------------------------
void wxPropertyGridInterface::SetValidationFailureBehavior( int vfbFlags )
void wxPropertyGridInterface::SetValidationFailureBehavior( wxPGVFBFlags vfbFlags )
{
GetPropertyGrid()->m_permanentValidationFailureBehavior = vfbFlags;
}
@ -424,13 +424,13 @@ wxPGProperty* wxPropertyGridInterface::GetPropertyByLabel( const wxString& label
// ----------------------------------------------------------------------------
void wxPropertyGridInterface::DoSetPropertyAttribute( wxPGPropArg id, const wxString& name,
wxVariant& value, long argFlags )
wxVariant& value, wxPGPropertyValuesFlags argFlags )
{
wxPG_PROP_ARG_CALL_PROLOG()
p->SetAttribute( name, value ); // property is also refreshed here
if ( argFlags & wxPG_RECURSE )
if ( !!(argFlags & wxPGPropertyValuesFlags::Recurse) )
{
for ( unsigned int i = 0; i < p->GetChildCount(); i++ )
DoSetPropertyAttribute(p->Item(i), name, value, argFlags);
@ -447,7 +447,7 @@ void wxPropertyGridInterface::SetPropertyAttributeAll( const wxString& attrName,
wxPropertyGridPageState* page;
while ( (page = GetPageState(pageIndex)) != nullptr )
{
DoSetPropertyAttribute(page->DoGetRoot(), attrName, value, wxPG_RECURSE);
DoSetPropertyAttribute(page->DoGetRoot(), attrName, value, wxPGPropertyValuesFlags::Recurse);
pageIndex++;
}
@ -531,12 +531,12 @@ wxPGProperty* wxPropertyGridInterface::GetPropertyByName( const wxString& name )
// -----------------------------------------------------------------------
bool wxPropertyGridInterface::HideProperty( wxPGPropArg id, bool hide, int flags )
bool wxPropertyGridInterface::HideProperty(wxPGPropArg id, bool hide, wxPGPropertyValuesFlags flags)
{
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
// Do nothing if single property is already hidden/visible as requested.
if ( !(flags & wxPG_RECURSE) )
if ( !(flags & wxPGPropertyValuesFlags::Recurse) )
{
if ( hide && p->HasFlag(wxPG_PROP_HIDDEN) )
return false;
@ -580,7 +580,7 @@ bool wxPropertyGridInterface::Expand( wxPGPropArg id )
// -----------------------------------------------------------------------
void wxPropertyGridInterface::Sort( int flags )
void wxPropertyGridInterface::Sort(wxPGPropertyValuesFlags flags)
{
wxPropertyGrid* pg = GetPropertyGrid();
@ -659,10 +659,8 @@ bool wxPropertyGridInterface::SetPropertyMaxLength( wxPGPropArg id, int maxLen )
// -----------------------------------------------------------------------
void
wxPropertyGridInterface::SetPropertyBackgroundColour( wxPGPropArg id,
const wxColour& colour,
int flags )
void wxPropertyGridInterface::SetPropertyBackgroundColour(wxPGPropArg id, const wxColour& colour,
wxPGPropertyValuesFlags flags )
{
wxPG_PROP_ARG_CALL_PROLOG()
p->SetBackgroundColour(colour, flags);
@ -671,7 +669,7 @@ wxPropertyGridInterface::SetPropertyBackgroundColour( wxPGPropArg id,
wxPropertyGrid* pg = m_pState->GetGrid();
if ( pg == p->GetGrid() )
{
if ( flags & wxPG_RECURSE )
if ( !!(flags & wxPGPropertyValuesFlags::Recurse) )
pg->DrawItemAndChildren(p);
else
pg->DrawItem(p);
@ -680,9 +678,8 @@ wxPropertyGridInterface::SetPropertyBackgroundColour( wxPGPropArg id,
// -----------------------------------------------------------------------
void wxPropertyGridInterface::SetPropertyTextColour( wxPGPropArg id,
const wxColour& colour,
int flags )
void wxPropertyGridInterface::SetPropertyTextColour(wxPGPropArg id, const wxColour& colour,
wxPGPropertyValuesFlags flags)
{
wxPG_PROP_ARG_CALL_PROLOG()
p->SetTextColour(colour, flags);
@ -691,7 +688,7 @@ void wxPropertyGridInterface::SetPropertyTextColour( wxPGPropArg id,
wxPropertyGrid* pg = m_pState->GetGrid();
if ( pg == p->GetGrid() )
{
if ( flags & wxPG_RECURSE )
if ( !!(flags & wxPGPropertyValuesFlags::Recurse) )
pg->DrawItemAndChildren(p);
else
pg->DrawItem(p);
@ -703,11 +700,11 @@ void wxPropertyGridInterface::SetPropertyTextColour( wxPGPropArg id,
#if WXWIN_COMPATIBILITY_3_0
void wxPropertyGridInterface::SetPropertyColoursToDefault(wxPGPropArg id)
{
SetPropertyColoursToDefault(id, wxPG_DONT_RECURSE);
SetPropertyColoursToDefault(id, wxPGPropertyValuesFlags::DontRecurse);
}
#endif // WXWIN_COMPATIBILITY_3_0
void wxPropertyGridInterface::SetPropertyColoursToDefault(wxPGPropArg id, int flags)
void wxPropertyGridInterface::SetPropertyColoursToDefault(wxPGPropArg id, wxPGPropertyValuesFlags flags)
{
wxPG_PROP_ARG_CALL_PROLOG()
p->SetDefaultColours(flags);
@ -716,7 +713,7 @@ void wxPropertyGridInterface::SetPropertyColoursToDefault(wxPGPropArg id, int fl
wxPropertyGrid* pg = m_pState->GetGrid();
if ( pg == p->GetGrid() )
{
if ( flags & wxPG_RECURSE )
if ( !!(flags & wxPGPropertyValuesFlags::Recurse) )
pg->DrawItemAndChildren(p);
else
pg->DrawItem(p);

View file

@ -599,8 +599,7 @@ static bool wxPG_SortFunc_ByLabel(wxPGProperty* p1, wxPGProperty* p2)
return p1->GetLabel().CmpNoCase( p2->GetLabel() ) < 0;
}
void wxPropertyGridPageState::DoSortChildren( wxPGProperty* p,
int flags )
void wxPropertyGridPageState::DoSortChildren(wxPGProperty* p, wxPGPropertyValuesFlags flags)
{
if ( !p )
p = m_properties;
@ -613,7 +612,7 @@ void wxPropertyGridPageState::DoSortChildren( wxPGProperty* p,
if ( p->HasFlag(wxPG_PROP_AGGREGATE) )
return;
if ( (flags & wxPG_SORT_TOP_LEVEL_ONLY)
if ( !!(flags & wxPGPropertyValuesFlags::SortTopLevelOnly)
&& !p->IsCategory() && !p->IsRoot() )
return;
@ -625,7 +624,7 @@ void wxPropertyGridPageState::DoSortChildren( wxPGProperty* p,
// Fix indices
p->FixIndicesOfChildren();
if ( flags & wxPG_RECURSE )
if ( !!(flags & wxPGPropertyValuesFlags::Recurse) )
{
// Apply sort recursively
for ( unsigned int i=0; i<p->GetChildCount(); i++ )
@ -635,9 +634,9 @@ void wxPropertyGridPageState::DoSortChildren( wxPGProperty* p,
// -----------------------------------------------------------------------
void wxPropertyGridPageState::DoSort( int flags )
void wxPropertyGridPageState::DoSort(wxPGPropertyValuesFlags flags)
{
DoSortChildren( m_properties, flags | wxPG_RECURSE );
DoSortChildren( m_properties, flags | wxPGPropertyValuesFlags::Recurse );
// We used to sort categories as well here also if in non-categorized
// mode, but doing would naturally cause child indices to become
@ -655,7 +654,7 @@ bool wxPropertyGridPageState::PrepareAfterItemsAdded()
m_itemsAdded = false;
if ( pg->HasFlag(wxPG_AUTO_SORT) )
DoSort(wxPG_SORT_TOP_LEVEL_ONLY);
DoSort(wxPGPropertyValuesFlags::SortTopLevelOnly);
return true;
}
@ -870,9 +869,8 @@ void wxPropertyGridPageState::PropagateColSizeDec( int column,
wxASSERT( decrease == 0 );
}
void wxPropertyGridPageState::DoSetSplitterPosition( int newXPos,
int splitterColumn,
int flags )
void wxPropertyGridPageState::DoSetSplitterPosition(int newXPos, int splitterColumn,
wxPGSplitterPositionFlags flags )
{
int adjust = newXPos - DoGetSplitterPosition(splitterColumn);
int otherColumn = splitterColumn + 1;
@ -894,8 +892,8 @@ void wxPropertyGridPageState::DoSetSplitterPosition( int newXPos,
if ( splitterColumn == 0 )
m_fSplitterX = (double) newXPos;
if ( !(flags & wxPG_SPLITTER_FROM_AUTO_CENTER) &&
!(flags & wxPG_SPLITTER_FROM_EVENT) )
if ( !(flags & wxPGSplitterPositionFlags::FromAutoCenter) &&
!(flags & wxPGSplitterPositionFlags::FromEvent) )
{
// Don't allow initial splitter auto-positioning after this.
m_isSplitterPreSet = true;
@ -1087,7 +1085,7 @@ void wxPropertyGridPageState::CheckColumnWidths( int widthChange )
}
DoSetSplitterPosition((int)splitterX, 0,
wxPG_SPLITTER_FROM_AUTO_CENTER);
wxPGSplitterPositionFlags::FromAutoCenter);
m_fSplitterX = splitterX; // needed to retain accuracy
}
@ -1096,12 +1094,12 @@ void wxPropertyGridPageState::CheckColumnWidths( int widthChange )
//
// Generic re-center code
//
ResetColumnSizes(wxPG_SPLITTER_FROM_AUTO_CENTER);
ResetColumnSizes(wxPGSplitterPositionFlags::FromAutoCenter);
}
}
}
void wxPropertyGridPageState::ResetColumnSizes( int setSplitterFlags )
void wxPropertyGridPageState::ResetColumnSizes(wxPGSplitterPositionFlags setSplitterFlags)
{
// Calculate sum of proportions
int psum = std::accumulate(m_columnProportions.begin(), m_columnProportions.end(), 0);
@ -1295,7 +1293,7 @@ void wxPropertyGridPageState::DoRemoveFromSelection( wxPGProperty* prop )
wxPGProperty* newFirst = sel.empty()? nullptr: sel[0];
pg->DoSelectProperty(newFirst,
wxPG_SEL_DONT_SEND_EVENT);
wxPGSelectPropertyFlags::DontSendEvent);
m_selection = sel;
@ -1346,7 +1344,7 @@ bool wxPropertyGridPageState::DoExpand( wxPGProperty* p )
// -----------------------------------------------------------------------
bool wxPropertyGridPageState::DoSelectProperty( wxPGProperty* p, unsigned int flags )
bool wxPropertyGridPageState::DoSelectProperty( wxPGProperty* p, wxPGSelectPropertyFlags flags )
{
if ( IsDisplayed() )
return m_pPropGrid->DoSelectProperty( p, flags );
@ -1357,7 +1355,7 @@ bool wxPropertyGridPageState::DoSelectProperty( wxPGProperty* p, unsigned int fl
// -----------------------------------------------------------------------
bool wxPropertyGridPageState::DoHideProperty( wxPGProperty* p, bool hide, int flags )
bool wxPropertyGridPageState::DoHideProperty(wxPGProperty* p, bool hide, wxPGPropertyValuesFlags flags)
{
p->DoHide(hide, flags);
VirtualHeightChanged();
@ -1371,9 +1369,9 @@ bool wxPropertyGridPageState::DoHideProperty( wxPGProperty* p, bool hide, int fl
// Returns list of wxVariant objects (non-categories and non-sub-properties only).
// Never includes sub-properties (unless they are parented by wxParentProperty).
wxVariant wxPropertyGridPageState::DoGetPropertyValues( const wxString& listname,
wxVariant wxPropertyGridPageState::DoGetPropertyValues(const wxString& listname,
wxPGProperty* baseparent,
long flags ) const
wxPGPropertyValuesFlags flags) const
{
wxPGProperty* pwc = baseparent;
@ -1386,7 +1384,7 @@ wxVariant wxPropertyGridPageState::DoGetPropertyValues( const wxString& listname
if ( pwc->HasAnyChild() )
{
if ( flags & wxPG_KEEP_STRUCTURE )
if ( !!(flags & wxPGPropertyValuesFlags::KeepStructure) )
{
wxASSERT( !pwc->HasFlag(wxPG_PROP_AGGREGATE) );
@ -1401,9 +1399,9 @@ wxVariant wxPropertyGridPageState::DoGetPropertyValues( const wxString& listname
}
else
{
v.Append( DoGetPropertyValues(p->GetBaseName(),p,flags|wxPG_KEEP_STRUCTURE) );
v.Append( DoGetPropertyValues(p->GetBaseName(),p,flags|wxPGPropertyValuesFlags::KeepStructure) );
}
if ( (flags & wxPG_INC_ATTRIBUTES) && p->GetAttributes().GetCount() )
if ( !!(flags & wxPGPropertyValuesFlags::IncAttributes) && p->GetAttributes().GetCount() )
v.Append( p->GetAttributesAsList() );
}
}
@ -1422,7 +1420,7 @@ wxVariant wxPropertyGridPageState::DoGetPropertyValues( const wxString& listname
wxVariant variant = p->GetValue();
variant.SetName( p->GetName() );
v.Append( variant );
if ( (flags & wxPG_INC_ATTRIBUTES) && p->GetAttributes().GetCount() )
if ( !!(flags & wxPGPropertyValuesFlags::IncAttributes) && p->GetAttributes().GetCount() )
v.Append( p->GetAttributesAsList() );
}
}
@ -1757,7 +1755,7 @@ wxPGProperty* wxPropertyGridPageState::DoInsert( wxPGProperty* parent, int index
void wxPropertyGridPageState::DoRemoveChildrenFromSelection(wxPGProperty* p,
bool recursive,
int selFlags)
wxPGSelectPropertyFlags selFlags)
{
wxPropertyGrid* pg = GetGrid();
@ -1906,7 +1904,7 @@ void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete )
if ( pg && IsDisplayed() )
{
pg->DoRemoveFromSelection(item,
wxPG_SEL_DELETING|wxPG_SEL_NOVALIDATE);
wxPGSelectPropertyFlags::Deleting|wxPGSelectPropertyFlags::NoValidate);
}
else
{
@ -1917,7 +1915,7 @@ void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete )
if ( item->IsChildSelected(true) )
{
DoRemoveChildrenFromSelection(item, true,
wxPG_SEL_DELETING|wxPG_SEL_NOVALIDATE);
wxPGSelectPropertyFlags::Deleting|wxPGSelectPropertyFlags::NoValidate);
}
// If deleted category or its sub-category is

View file

@ -319,7 +319,7 @@ static void PopulateWithExamples(wxPropertyGridManager* pgManager)
combinedFlags.Add(WXSIZEOF(flags_prop_labels), flags_prop_labels, flags_prop_values);
pg->Append(new wxFlagsProperty("FlagsProperty", wxPG_LABEL,
combinedFlags, wxTheApp->GetTopWindow()->GetWindowStyle() ) );
pg->SetPropertyAttribute("FlagsProperty", wxPG_BOOL_USE_CHECKBOX, true, wxPG_RECURSE);
pg->SetPropertyAttribute("FlagsProperty", wxPG_BOOL_USE_CHECKBOX, true, wxPGPropertyValuesFlags::Recurse);
wxArrayString tchoices;
tchoices.Add("Cabbage");
@ -431,8 +431,8 @@ static wxPropertyGridManager* CreateGrid(int style, int extraStyle)
pgManager->SetExtraStyle(extraStyle);
// This is the default validation failure behaviour
pgManager->SetValidationFailureBehavior(wxPG_VFB_MARK_CELL |
wxPG_VFB_SHOW_MESSAGEBOX);
pgManager->SetValidationFailureBehavior(wxPGVFBFlags::MarkCell |
wxPGVFBFlags::ShowMessageBox);
wxPropertyGrid* pg = pgManager->GetGrid();
// Set somewhat different unspecified value appearance
@ -1139,9 +1139,9 @@ TEST_CASE("PropertyGridTestCase", "[propgrid]")
SECTION("GetPropertyValues")
{
wxPropertyGridPage* page1 = pgManager->GetPage(0);
wxVariant pg1_values = page1->GetPropertyValues("Page1", nullptr, wxPG_KEEP_STRUCTURE);
wxVariant pg1_values = page1->GetPropertyValues("Page1", nullptr, wxPGPropertyValuesFlags::KeepStructure);
wxPropertyGridPage* page2 = pgManager->GetPage(1);
wxVariant pg2_values = page2->GetPropertyValues("Page2", nullptr, wxPG_KEEP_STRUCTURE);
wxVariant pg2_values = page2->GetPropertyValues("Page2", nullptr, wxPGPropertyValuesFlags::KeepStructure);
SUCCEED();
SECTION("SetPropertyValues")
@ -1332,13 +1332,13 @@ TEST_CASE("PropertyGridTestCase", "[propgrid]")
pgManager->Freeze();
// Set custom colours.
pg->SetPropertyTextColour("Appearance", wxColour(255, 0, 0), wxPG_DONT_RECURSE);
pg->SetPropertyTextColour("Appearance", wxColour(255, 0, 0), wxPGPropertyValuesFlags::DontRecurse);
pg->SetPropertyBackgroundColour("Appearance", wxColour(255, 255, 183));
pg->SetPropertyTextColour("Appearance", wxColour(255, 0, 183));
pg->SetPropertyTextColour("PositionCategory", wxColour(0, 255, 0), wxPG_DONT_RECURSE);
pg->SetPropertyTextColour("PositionCategory", wxColour(0, 255, 0), wxPGPropertyValuesFlags::DontRecurse);
pg->SetPropertyBackgroundColour("PositionCategory", wxColour(255, 226, 190));
pg->SetPropertyTextColour("PositionCategory", wxColour(255, 0, 190));
pg->SetPropertyTextColour("Environment", wxColour(0, 0, 255), wxPG_DONT_RECURSE);
pg->SetPropertyTextColour("Environment", wxColour(0, 0, 255), wxPGPropertyValuesFlags::DontRecurse);
pg->SetPropertyBackgroundColour("Environment", wxColour(208, 240, 175));
pg->SetPropertyTextColour("Environment", wxColour(255, 255, 255));
pg->SetPropertyBackgroundColour("More Examples", wxColour(172, 237, 255));