Make wxPGProperty an abstract class

wxPGProperty is intended to be only a base class for property classes and therefore shouldn't be instantiated directly.
This commit is contained in:
Artur Wieczorek
2019-06-24 23:17:33 +02:00
parent 315ff49136
commit 8c0a210a75
3 changed files with 46 additions and 41 deletions

View File

@@ -120,6 +120,8 @@ Changes in behaviour which may result in build errors
but must be explicitly selected (and libstdc++ must be installed in order
to use it).
- wxPGProperty ctors are not longer public since this class is intended to be
a base class and should not be instantiated directly.
3.1.3: (released 2019-??-??)
----------------------------

View File

@@ -979,14 +979,6 @@ class WXDLLIMPEXP_PROPGRID wxPGProperty : public wxObject
public:
typedef wxUint32 FlagType;
// Default constructor.
wxPGProperty();
// Constructor.
// All non-abstract property classes should have a constructor with
// the same first two arguments as this one.
wxPGProperty( const wxString& label, const wxString& name );
// Virtual destructor.
// It is customary for derived properties to implement this.
virtual ~wxPGProperty();
@@ -1897,6 +1889,13 @@ public:
protected:
// Ctors are ptotected because wxPGProperty is only a base class
// for all property classes and shouldn't be instantiated directly.
wxPGProperty();
// All non-abstract property classes should have a constructor with
// the same first two arguments as this one.
wxPGProperty(const wxString& label, const wxString& name);
// Sets property cell in fashion that reduces number of exclusive
// copies of cell data. Used when setting, for instance, same
// background colour for a number of properties.

View File

@@ -401,8 +401,9 @@ wxPG_PROP_CLASS_SPECIFIC_3 = 0x00400000
/**
@class wxPGProperty
wxPGProperty is base class for all wxPropertyGrid properties. In
sections below we cover few related topics.
wxPGProperty is base class for all wxPropertyGrid properties and as such
it is not intended to be instantiated directly.
In sections below we cover few related topics.
@li @ref pgproperty_properties
@li @ref pgproperty_creating
@@ -848,37 +849,6 @@ class wxPGProperty : public wxObject
public:
typedef wxUint32 FlagType;
/**
Default constructor.
*/
wxPGProperty();
/**
Constructor.
Non-abstract property classes should have constructor of this style:
@code
MyProperty( const wxString& label, const wxString& name, const T& value )
: wxPGProperty(label, name)
{
// Generally recommended way to set the initial value
// (as it should work in pretty much 100% of cases).
wxVariant variant;
variant << value;
SetValue(variant);
// If has private child properties then create them here.
// For example:
// AddPrivateChild( new wxStringProperty("Subprop 1",
// wxPG_LABEL,
// value.GetSubProp1()));
}
@endcode
*/
wxPGProperty( const wxString& label, const wxString& name );
/**
Virtual destructor. It is customary for derived properties to implement this.
*/
@@ -2080,6 +2050,40 @@ public:
void* m_clientData;
protected:
/**
Default constructor. It is protected because wxPGProperty is only
a base class for other property classes.
*/
wxPGProperty();
/**
Constructor. It is protected because wxPGProperty is only a base
class for other property classes.
Non-abstract property classes should have constructor of this style:
@code
MyProperty( const wxString& label, const wxString& name, const T& value )
: wxPGProperty(label, name)
{
// Generally recommended way to set the initial value
// (as it should work in pretty much 100% of cases).
wxVariant variant;
variant << value;
SetValue(variant);
// If has private child properties then create them here.
// For example:
// AddPrivateChild( new wxStringProperty("Subprop 1",
// wxPG_LABEL,
// value.GetSubProp1()));
}
@endcode
*/
wxPGProperty( const wxString& label, const wxString& name );
/**
Sets property cell in fashion that reduces number of exclusive
copies of cell data. Used when setting, for instance, same