From 8c0a210a75e6790c8383b326cff7c434d8835f7f Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Mon, 24 Jun 2019 23:17:33 +0200 Subject: [PATCH] Make wxPGProperty an abstract class wxPGProperty is intended to be only a base class for property classes and therefore shouldn't be instantiated directly. --- docs/changes.txt | 2 + include/wx/propgrid/property.h | 15 ++++--- interface/wx/propgrid/property.h | 70 +++++++++++++++++--------------- 3 files changed, 46 insertions(+), 41 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index af29fa7cf9..dba5b51d06 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -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-??-??) ---------------------------- diff --git a/include/wx/propgrid/property.h b/include/wx/propgrid/property.h index e7f0e7e48e..711ca53a80 100644 --- a/include/wx/propgrid/property.h +++ b/include/wx/propgrid/property.h @@ -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. diff --git a/interface/wx/propgrid/property.h b/interface/wx/propgrid/property.h index ec87e71071..5589129d0d 100644 --- a/interface/wx/propgrid/property.h +++ b/interface/wx/propgrid/property.h @@ -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