From b19b28c8fca9815949753ed0c68097efe8943b18 Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Wed, 9 Jun 2010 13:55:48 +0000 Subject: [PATCH] Implement wx-prefixed macros versions of DECLARE/IMPLEMENT*CLASS macros. Implement compatibility aliases for non-prefixed macro names. Require a final semicolon where possible. Correct a recurring error in the docs: IMPLEMENT/DECLARE_CLASS are alias to the DYNAMIC macros, not to the ABSTRACT macros. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64532 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/listctrl.h | 2 +- include/wx/generic/private/listctrl.h | 2 +- include/wx/generic/treectlg.h | 2 +- include/wx/gtk1/treectrl.h | 2 +- include/wx/msw/listctrl.h | 2 +- include/wx/msw/treectrl.h | 2 +- include/wx/object.h | 149 ++++++++++++++++---------- include/wx/os2/listctrl.h | 2 +- include/wx/os2/treectrl.h | 2 +- include/wx/osx/listctrl.h | 2 +- include/wx/osx/treectrl.h | 2 +- include/wx/palmos/listctrl.h | 2 +- include/wx/palmos/treectrl.h | 2 +- include/wx/protocol/protocol.h | 2 +- include/wx/treectrl.h | 4 +- interface/wx/docview.h | 4 +- interface/wx/listctrl.h | 2 +- interface/wx/module.h | 20 ++-- interface/wx/msw/ole/activex.h | 10 +- interface/wx/object.h | 88 +++++++-------- interface/wx/propgrid/editors.h | 5 +- interface/wx/propgrid/property.h | 2 +- interface/wx/treectrl.h | 6 +- 23 files changed, 179 insertions(+), 137 deletions(-) diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index 91ee46b035..c699ddcf9a 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -121,7 +121,7 @@ public: void SetItemCount(long count); wxTextCtrl *EditLabel(long item, - wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)); + wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl)); wxTextCtrl* GetEditControl() const; void Edit( long item ) { EditLabel(item); } diff --git a/include/wx/generic/private/listctrl.h b/include/wx/generic/private/listctrl.h index f8fb6baaf2..cacf1bdcb5 100644 --- a/include/wx/generic/private/listctrl.h +++ b/include/wx/generic/private/listctrl.h @@ -524,7 +524,7 @@ public: // start editing the label of the given item wxTextCtrl *EditLabel(long item, - wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)); + wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl)); wxTextCtrl *GetEditControl() const { return m_textctrlWrapper ? m_textctrlWrapper->GetText() : NULL; diff --git a/include/wx/generic/treectlg.h b/include/wx/generic/treectlg.h index 7c068dd7f5..4e3ad3bff9 100644 --- a/include/wx/generic/treectlg.h +++ b/include/wx/generic/treectlg.h @@ -164,7 +164,7 @@ public: virtual void ScrollTo(const wxTreeItemId& item); virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, - wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)); + wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl)); virtual wxTextCtrl *GetEditControl() const; virtual void EndEditLabel(const wxTreeItemId& item, bool discardChanges = false); diff --git a/include/wx/gtk1/treectrl.h b/include/wx/gtk1/treectrl.h index 453f1f735e..fad692b336 100644 --- a/include/wx/gtk1/treectrl.h +++ b/include/wx/gtk1/treectrl.h @@ -316,7 +316,7 @@ public: // been before. textCtrlClass parameter allows you to create an edit // control of arbitrary user-defined class deriving from wxTextCtrl. wxTextCtrl* EditLabel(const wxTreeItemId& item, - wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)); + wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl)); // returns the same pointer as StartEdit() if the item is being edited, // NULL otherwise (it's assumed that no more than one item may be // edited simultaneously) diff --git a/include/wx/msw/listctrl.h b/include/wx/msw/listctrl.h index a5afb0df32..280c3f842b 100644 --- a/include/wx/msw/listctrl.h +++ b/include/wx/msw/listctrl.h @@ -288,7 +288,7 @@ public: void ClearAll(); // Edit the label - wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)); + wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl)); // End label editing, optionally cancelling the edit bool EndEditLabel(bool cancel); diff --git a/include/wx/msw/treectrl.h b/include/wx/msw/treectrl.h index b1e8e78492..83e4afa6f2 100644 --- a/include/wx/msw/treectrl.h +++ b/include/wx/msw/treectrl.h @@ -172,7 +172,7 @@ public: virtual void ScrollTo(const wxTreeItemId& item); virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, - wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)); + wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl)); virtual wxTextCtrl *GetEditControl() const; virtual void EndEditLabel(const wxTreeItemId& WXUNUSED(item), bool discardChanges = false) diff --git a/include/wx/object.h b/include/wx/object.h index 3b57f5425f..23b34bf334 100644 --- a/include/wx/object.h +++ b/include/wx/object.h @@ -26,7 +26,7 @@ class WXDLLIMPEXP_FWD_BASE wxString; #define wxUSE_EXTENDED_RTTI 0 #endif -#define DECLARE_CLASS_INFO_ITERATORS() \ +#define wxDECLARE_CLASS_INFO_ITERATORS() \ class WXDLLIMPEXP_BASE const_iterator \ { \ typedef wxHashTable_Node Node; \ @@ -55,7 +55,7 @@ class WXDLLIMPEXP_FWD_BASE wxString; }; \ \ static const_iterator begin_classinfo(); \ - static const_iterator end_classinfo(); + static const_iterator end_classinfo() #if wxUSE_EXTENDED_RTTI #include "wx/xti.h" @@ -130,7 +130,8 @@ public: ( m_baseInfo2 && m_baseInfo2->IsKindOf(info) ) ); } - DECLARE_CLASS_INFO_ITERATORS() + wxDECLARE_CLASS_INFO_ITERATORS(); + private: const wxChar *m_className; int m_objectSize; @@ -163,24 +164,25 @@ WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name); // Dynamic class macros // ---------------------------------------------------------------------------- -#define DECLARE_ABSTRACT_CLASS(name) \ +#define wxDECLARE_ABSTRACT_CLASS(name) \ public: \ static wxClassInfo ms_classInfo; \ - virtual wxClassInfo *GetClassInfo() const; + virtual wxClassInfo *GetClassInfo() const -#define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \ - DECLARE_NO_ASSIGN_CLASS(name) \ - DECLARE_DYNAMIC_CLASS(name) +#define wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \ + wxDECLARE_NO_ASSIGN_CLASS(name); \ + wxDECLARE_DYNAMIC_CLASS(name) -#define DECLARE_DYNAMIC_CLASS_NO_COPY(name) \ - DECLARE_NO_COPY_CLASS(name) \ - DECLARE_DYNAMIC_CLASS(name) +#define wxDECLARE_DYNAMIC_CLASS_NO_COPY(name) \ + wxDECLARE_NO_COPY_CLASS(name); \ + wxDECLARE_DYNAMIC_CLASS(name) -#define DECLARE_DYNAMIC_CLASS(name) \ - DECLARE_ABSTRACT_CLASS(name) \ - static wxObject* wxCreateObject(); +#define wxDECLARE_DYNAMIC_CLASS(name) \ + wxDECLARE_ABSTRACT_CLASS(name); \ + static wxObject* wxCreateObject() -#define DECLARE_CLASS(name) DECLARE_DYNAMIC_CLASS(name) +#define wxDECLARE_CLASS(name) \ + wxDECLARE_DYNAMIC_CLASS(name) // common part of the macros below @@ -205,13 +207,13 @@ WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name); // ----------------------------------- // Single inheritance with one base class -#define IMPLEMENT_DYNAMIC_CLASS(name, basename) \ +#define wxIMPLEMENT_DYNAMIC_CLASS(name, basename) \ wxIMPLEMENT_CLASS_COMMON1(name, basename, name::wxCreateObject) \ wxObject* name::wxCreateObject() \ { return new name; } // Multiple inheritance with two base classes -#define IMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) \ +#define wxIMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) \ wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, \ name::wxCreateObject) \ wxObject* name::wxCreateObject() \ @@ -222,17 +224,18 @@ WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name); // ----------------------------------- // Single inheritance with one base class - -#define IMPLEMENT_ABSTRACT_CLASS(name, basename) \ +#define wxIMPLEMENT_ABSTRACT_CLASS(name, basename) \ wxIMPLEMENT_CLASS_COMMON1(name, basename, NULL) // Multiple inheritance with two base classes - -#define IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \ +#define wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \ wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, NULL) -#define IMPLEMENT_CLASS IMPLEMENT_ABSTRACT_CLASS -#define IMPLEMENT_CLASS2 IMPLEMENT_ABSTRACT_CLASS2 +#define wxIMPLEMENT_CLASS(name, basename) \ + wxIMPLEMENT_ABSTRACT_CLASS(name, basename) + +#define wxIMPLEMENT_CLASS2(name, basename1, basename2) \ + IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) #endif // !wxUSE_EXTENDED_RTTI @@ -257,7 +260,7 @@ public: \ name##PluginSentinel(); \ ~name##PluginSentinel(); \ }; \ -name##PluginSentinel m_pluginsentinel; +name##PluginSentinel m_pluginsentinel #define _IMPLEMENT_DL_SENTINEL(name) \ const wxString name::name##PluginSentinel::sm_className(#name); \ @@ -276,35 +279,35 @@ name##PluginSentinel m_pluginsentinel; #endif // wxUSE_NESTED_CLASSES -#define DECLARE_PLUGGABLE_CLASS(name) \ - DECLARE_DYNAMIC_CLASS(name) _DECLARE_DL_SENTINEL(name, WXDLLIMPEXP_CORE) -#define DECLARE_ABSTRACT_PLUGGABLE_CLASS(name) \ - DECLARE_ABSTRACT_CLASS(name) _DECLARE_DL_SENTINEL(name, WXDLLIMPEXP_CORE) - -#define DECLARE_USER_EXPORTED_PLUGGABLE_CLASS(name, usergoo) \ - DECLARE_DYNAMIC_CLASS(name) _DECLARE_DL_SENTINEL(name, usergoo) -#define DECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, usergoo) \ - DECLARE_ABSTRACT_CLASS(name) _DECLARE_DL_SENTINEL(name, usergoo) - -#define IMPLEMENT_PLUGGABLE_CLASS(name, basename) \ - IMPLEMENT_DYNAMIC_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name) -#define IMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) \ - IMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name) -#define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) \ - IMPLEMENT_ABSTRACT_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name) -#define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \ - IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name) - -#define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(name, basename) \ - IMPLEMENT_PLUGGABLE_CLASS(name, basename) -#define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(name, basename1, basename2) \ - IMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) -#define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, basename) \ - IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) -#define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \ - IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) - -#define CLASSINFO(name) (&name::ms_classInfo) +#define wxDECLARE_PLUGGABLE_CLASS(name) \ + wxDECLARE_DYNAMIC_CLASS(name); _DECLARE_DL_SENTINEL(name, WXDLLIMPEXP_CORE) +#define wxDECLARE_ABSTRACT_PLUGGABLE_CLASS(name) \ + wxDECLARE_ABSTRACT_CLASS(name); _DECLARE_DL_SENTINEL(name, WXDLLIMPEXP_CORE) + +#define wxDECLARE_USER_EXPORTED_PLUGGABLE_CLASS(name, usergoo) \ + wxDECLARE_DYNAMIC_CLASS(name); _DECLARE_DL_SENTINEL(name, usergoo) +#define wxDECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, usergoo) \ + wxDECLARE_ABSTRACT_CLASS(name); _DECLARE_DL_SENTINEL(name, usergoo) + +#define wxIMPLEMENT_PLUGGABLE_CLASS(name, basename) \ + wxIMPLEMENT_DYNAMIC_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name) +#define wxIMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) \ + wxIMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name) +#define wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) \ + wxIMPLEMENT_ABSTRACT_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name) +#define wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \ + wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name) + +#define wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(name, basename) \ + wxIMPLEMENT_PLUGGABLE_CLASS(name, basename) +#define wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(name, basename1, basename2) \ + wxIMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) +#define wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, basename) \ + wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) +#define wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \ + wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) + +#define wxCLASSINFO(name) (&name::ms_classInfo) #define wxIS_KIND_OF(obj, className) obj->IsKindOf(&className::ms_classInfo) @@ -512,7 +515,7 @@ private: class WXDLLIMPEXP_BASE wxObject { - DECLARE_ABSTRACT_CLASS(wxObject) + wxDECLARE_ABSTRACT_CLASS(wxObject); public: wxObject() { m_refData = NULL; } @@ -665,4 +668,42 @@ private : #endif #endif // wxUSE_DEBUG_NEW_ALWAYS +// ---------------------------------------------------------------------------- +// Compatibility macro aliases +// ---------------------------------------------------------------------------- + +// deprecated variants _not_ requiring a semicolon after them and without wx prefix. +// (note that also some wx-prefixed macro do _not_ require a semicolon because +// it's not always possible to force the compire to require it) + +#define DECLARE_CLASS_INFO_ITERATORS() wxDECLARE_CLASS_INFO_ITERATORS(); +#define DECLARE_ABSTRACT_CLASS(n) wxDECLARE_ABSTRACT_CLASS(n); +#define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(n) wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(n); +#define DECLARE_DYNAMIC_CLASS_NO_COPY(n) wxDECLARE_DYNAMIC_CLASS_NO_COPY(n); +#define DECLARE_DYNAMIC_CLASS(n) wxDECLARE_DYNAMIC_CLASS(n); +#define DECLARE_CLASS(n) wxDECLARE_CLASS(n); + +#define IMPLEMENT_DYNAMIC_CLASS(n,b) wxIMPLEMENT_DYNAMIC_CLASS(n,b) +#define IMPLEMENT_DYNAMIC_CLASS2(n,b1,b2) wxIMPLEMENT_DYNAMIC_CLASS2(n,b1,b2) +#define IMPLEMENT_ABSTRACT_CLASS(n,b) wxIMPLEMENT_ABSTRACT_CLASS(n,b) +#define IMPLEMENT_ABSTRACT_CLASS2(n,b1,b2) wxIMPLEMENT_ABSTRACT_CLASS2(n,b1,b2) +#define IMPLEMENT_CLASS(n,b) wxIMPLEMENT_CLASS(n,b) +#define IMPLEMENT_CLASS2(n,b1,b2) wxIMPLEMENT_CLASS2(n,b1,b2) + +#define DECLARE_PLUGGABLE_CLASS(n) wxDECLARE_PLUGGABLE_CLASS(n); +#define DECLARE_ABSTRACT_PLUGGABLE_CLASS(n) wxDECLARE_ABSTRACT_PLUGGABLE_CLASS(n); +#define DECLARE_USER_EXPORTED_PLUGGABLE_CLASS(n,u) wxDECLARE_USER_EXPORTED_PLUGGABLE_CLASS(n,u); +#define DECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,u) wxDECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,u); + +#define IMPLEMENT_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_PLUGGABLE_CLASS(n,b) +#define IMPLEMENT_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_PLUGGABLE_CLASS2(n,b,b2) +#define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(n,b) +#define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2) +#define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(n,b) +#define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(n,b,b2) +#define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,b) +#define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2) + +#define CLASSINFO(n) wxCLASSINFO(n) + #endif // _WX_OBJECTH__ diff --git a/include/wx/os2/listctrl.h b/include/wx/os2/listctrl.h index 6c3a69371e..8514bf5c5d 100644 --- a/include/wx/os2/listctrl.h +++ b/include/wx/os2/listctrl.h @@ -308,7 +308,7 @@ public: // Edit the label // wxTextCtrl* EditLabel( long lItem - ,wxClassInfo* pTextControlClass = CLASSINFO(wxTextCtrl) + ,wxClassInfo* pTextControlClass = wxCLASSINFO(wxTextCtrl) ); // diff --git a/include/wx/os2/treectrl.h b/include/wx/os2/treectrl.h index 4a99d302bf..26d544ec9a 100644 --- a/include/wx/os2/treectrl.h +++ b/include/wx/os2/treectrl.h @@ -442,7 +442,7 @@ public: // interface compatibility, only. // wxTextCtrl* EditLabel( const wxTreeItemId& rItem - ,wxClassInfo* pTextCtrlClass = CLASSINFO(wxTextCtrl) + ,wxClassInfo* pTextCtrlClass = wxCLASSINFO(wxTextCtrl) ); // diff --git a/include/wx/osx/listctrl.h b/include/wx/osx/listctrl.h index e1c7449542..9e00dd47bf 100644 --- a/include/wx/osx/listctrl.h +++ b/include/wx/osx/listctrl.h @@ -217,7 +217,7 @@ class WXDLLIMPEXP_CORE wxListCtrl: public wxControl void ClearAll(); // Edit the label - wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)); + wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl)); // End label editing, optionally cancelling the edit bool EndEditLabel(bool cancel); diff --git a/include/wx/osx/treectrl.h b/include/wx/osx/treectrl.h index 644e8af2b0..626471f77d 100644 --- a/include/wx/osx/treectrl.h +++ b/include/wx/osx/treectrl.h @@ -215,7 +215,7 @@ public: bool DeleteAllItems(); // Edit the label (tree must have the focus) - wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)); + wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl)); // End label editing, optionally cancelling the edit bool EndEditLabel(bool cancel); diff --git a/include/wx/palmos/listctrl.h b/include/wx/palmos/listctrl.h index e1f6df59e6..aad5f3cdba 100644 --- a/include/wx/palmos/listctrl.h +++ b/include/wx/palmos/listctrl.h @@ -256,7 +256,7 @@ public: void ClearAll(); // Edit the label - wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)); + wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl)); // End label editing, optionally cancelling the edit bool EndEditLabel(bool cancel); diff --git a/include/wx/palmos/treectrl.h b/include/wx/palmos/treectrl.h index 6056ae3850..32b5fc9656 100644 --- a/include/wx/palmos/treectrl.h +++ b/include/wx/palmos/treectrl.h @@ -297,7 +297,7 @@ public: // been before. textCtrlClass parameter allows you to create an edit // control of arbitrary user-defined class deriving from wxTextCtrl. wxTextCtrl* EditLabel(const wxTreeItemId& item, - wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)); + wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl)); // returns the same pointer as StartEdit() if the item is being edited, // NULL otherwise (it's assumed that no more than one item may be // edited simultaneously) diff --git a/include/wx/protocol/protocol.h b/include/wx/protocol/protocol.h index 6dffb30f94..f61de27e7c 100644 --- a/include/wx/protocol/protocol.h +++ b/include/wx/protocol/protocol.h @@ -141,7 +141,7 @@ public: \ static wxProtoInfo g_proto_##class; #define IMPLEMENT_PROTOCOL(class, name, serv, host) \ -wxProtoInfo class::g_proto_##class(name, serv, host, CLASSINFO(class)); \ +wxProtoInfo class::g_proto_##class(name, serv, host, wxCLASSINFO(class)); \ bool wxProtocolUse##class = true; #define USE_PROTOCOL(class) \ diff --git a/include/wx/treectrl.h b/include/wx/treectrl.h index 7b2d71c6e2..129333ca74 100644 --- a/include/wx/treectrl.h +++ b/include/wx/treectrl.h @@ -22,7 +22,7 @@ #include "wx/control.h" #include "wx/treebase.h" -#include "wx/textctrl.h" // wxTextCtrl::ms_classinfo used through CLASSINFO macro +#include "wx/textctrl.h" // wxTextCtrl::ms_classinfo used through wxCLASSINFO macro class WXDLLIMPEXP_FWD_CORE wxImageList; @@ -353,7 +353,7 @@ public: // been before. textCtrlClass parameter allows you to create an edit // control of arbitrary user-defined class deriving from wxTextCtrl. virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, - wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)) = 0; + wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl)) = 0; // returns the same pointer as StartEdit() if the item is being edited, // NULL otherwise (it's assumed that no more than one item may be // edited simultaneously) diff --git a/interface/wx/docview.h b/interface/wx/docview.h index 09a4db25b1..6c294b46ae 100644 --- a/interface/wx/docview.h +++ b/interface/wx/docview.h @@ -43,13 +43,13 @@ public: A name that should be unique for a given view. @param docClassInfo A pointer to the run-time document class information as returned by - the CLASSINFO() macro, e.g. CLASSINFO(MyDocumentClass). If this is + the wxCLASSINFO() macro, e.g. wxCLASSINFO(MyDocumentClass). If this is not supplied, you will need to derive a new wxDocTemplate class and override the CreateDocument() member to return a new document instance on demand. @param viewClassInfo A pointer to the run-time view class information as returned by the - CLASSINFO() macro, e.g. CLASSINFO(MyViewClass). If this is not + wxCLASSINFO() macro, e.g. wxCLASSINFO(MyViewClass). If this is not supplied, you will need to derive a new wxDocTemplate class and override the CreateView() member to return a new view instance on demand. diff --git a/interface/wx/listctrl.h b/interface/wx/listctrl.h index 9b5291f766..b6dae581e3 100644 --- a/interface/wx/listctrl.h +++ b/interface/wx/listctrl.h @@ -245,7 +245,7 @@ public: will be sent which can be vetoed as well. */ wxTextCtrl* EditLabel(long item, - wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)); + wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl)); /** Finish editing the label. diff --git a/interface/wx/module.h b/interface/wx/module.h index a6a091e613..bd0875cfbb 100644 --- a/interface/wx/module.h +++ b/interface/wx/module.h @@ -15,7 +15,7 @@ To define a new kind of module, derive a class from wxModule, override the wxModule::OnInit and wxModule::OnExit functions, and add the - DECLARE_DYNAMIC_CLASS and IMPLEMENT_DYNAMIC_CLASS to header and implementation + wxDECLARE_DYNAMIC_CLASS and wxIMPLEMENT_DYNAMIC_CLASS to header and implementation files (which can be the same file). On initialization, wxWidgets will find all classes derived from wxModule, create an instance of each, and call each wxModule::OnInit function. On exit, wxWidgets @@ -37,24 +37,24 @@ virtual void OnExit() { wxDDECleanUp(); }; private: - DECLARE_DYNAMIC_CLASS(wxDDEModule) + wxDECLARE_DYNAMIC_CLASS(wxDDEModule); }; - IMPLEMENT_DYNAMIC_CLASS(wxDDEModule, wxModule) + wxIMPLEMENT_DYNAMIC_CLASS(wxDDEModule, wxModule); // Another module which uses DDE in its OnInit() class MyModule: public wxModule { public: - MyModule() { AddDependency(CLASSINFO(wxDDEModule)); } + MyModule() { AddDependency(wxCLASSINFO(wxDDEModule)); } virtual bool OnInit() { ... code using DDE ... } virtual void OnExit() { ... } private: - DECLARE_DYNAMIC_CLASS(MyModule) + wxDECLARE_DYNAMIC_CLASS(MyModule); }; - IMPLEMENT_DYNAMIC_CLASS(MyModule, wxModule) + wxIMPLEMENT_DYNAMIC_CLASS(MyModule, wxModule); // Another module which uses DDE in its OnInit() // but uses a named dependency @@ -66,10 +66,10 @@ virtual void OnExit() { ... } private: - DECLARE_DYNAMIC_CLASS(MyModule2) + wxDECLARE_DYNAMIC_CLASS(MyModule2) }; - IMPLEMENT_DYNAMIC_CLASS(MyModule2, wxModule) + wxIMPLEMENT_DYNAMIC_CLASS(MyModule2, wxModule) @endcode @library{wxbase} @@ -104,7 +104,7 @@ protected: /** Call this function from the constructor of the derived class. - @a dep must be the CLASSINFO() of a wxModule-derived class and the + @a dep must be the wxCLASSINFO() of a wxModule-derived class and the corresponding module will be loaded before and unloaded after this module. @param dep @@ -119,7 +119,7 @@ protected: the class info. This is useful when a module is declared entirely in a source file and - there is no header for the declaration of the module needed by CLASSINFO(), + there is no header for the declaration of the module needed by wxCLASSINFO(), however errors are not detected until run-time, instead of compile-time, then. Note that circular dependencies are detected and result in a fatal error. diff --git a/interface/wx/msw/ole/activex.h b/interface/wx/msw/ole/activex.h index d69892ba83..d8b5d97cb4 100644 --- a/interface/wx/msw/ole/activex.h +++ b/interface/wx/msw/ole/activex.h @@ -263,16 +263,16 @@ public: wxActiveXContainer* m_pAX; wxAutomationObject m_PDF; - DECLARE_DYNAMIC_CLASS(wxPDFMediaBackend) + wxDECLARE_DYNAMIC_CLASS(wxPDFMediaBackend) }; - IMPLEMENT_DYNAMIC_CLASS(wxPDFMediaBackend, wxMediaBackend); - Put this in one of your existant source files and then create a wxMediaCtrl with - - //[this] is the parent window, "myfile.pdf" is the PDF file to open + wxIMPLEMENT_DYNAMIC_CLASS(wxPDFMediaBackend, wxMediaBackend); + + // Put this in one of your existant source files and then create a wxMediaCtrl with wxMediaCtrl* mymediactrl = new wxMediaCtrl(this, "myfile.pdf", wxID_ANY, wxDefaultPosition, wxSize(300,300), 0, "wxPDFMediaBackend"); + // [this] is the parent window, "myfile.pdf" is the PDF file to open @endcode diff --git a/interface/wx/object.h b/interface/wx/object.h index 787e5f7a13..1a90e47c78 100644 --- a/interface/wx/object.h +++ b/interface/wx/object.h @@ -42,7 +42,7 @@ virtual wxObjectRefData *CreateRefData() const; virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; - DECLARE_DYNAMIC_CLASS(MyCar) + wxDECLARE_DYNAMIC_CLASS(MyCar) }; @@ -83,7 +83,7 @@ #define M_CARDATA ((MyCarRefData *)m_refData) - IMPLEMENT_DYNAMIC_CLASS(MyCar,wxObject) + wxIMPLEMENT_DYNAMIC_CLASS(MyCar, wxObject); MyCar::MyCar( int price ) { @@ -275,12 +275,12 @@ public: Example: @code - bool tmp = obj->IsKindOf(CLASSINFO(wxFrame)); + bool tmp = obj->IsKindOf(wxCLASSINFO(wxFrame)); @endcode @param info A pointer to a class information object, which may be obtained - by using the ::CLASSINFO macro. + by using the ::wxCLASSINFO macro. @return @true if the class represented by info is the same class as this one or is derived from it. @@ -412,8 +412,8 @@ protected: This class stores meta-information about classes. Instances of this class are not generally defined directly by an application, - but indirectly through use of macros such as ::DECLARE_DYNAMIC_CLASS and - ::IMPLEMENT_DYNAMIC_CLASS. + but indirectly through use of macros such as ::wxDECLARE_DYNAMIC_CLASS and + ::wxIMPLEMENT_DYNAMIC_CLASS. @library{wxbase} @category{rtti} @@ -655,21 +655,12 @@ public: @header{wx/object.h} */ -#define CLASSINFO( className ) - -/** - Used inside a class declaration to declare that the class should be made - known to the class hierarchy, but objects of this class cannot be created - dynamically. The same as DECLARE_ABSTRACT_CLASS(). - - @header{wx/object.h} -*/ -#define DECLARE_CLASS( className ) +#define wxCLASSINFO( className ) /** Used inside a class declaration to declare that the class should be made known to the class hierarchy, but objects of this class cannot be created - dynamically. The same as DECLARE_CLASS(). + dynamically. @header{wx/object.h} @@ -678,7 +669,7 @@ public: @code class wxCommand: public wxObject { - DECLARE_ABSTRACT_CLASS(wxCommand) + wxDECLARE_ABSTRACT_CLASS(wxCommand); private: ... @@ -687,14 +678,14 @@ public: }; @endcode */ -#define DECLARE_ABSTRACT_CLASS( className ) +#define wxDECLARE_ABSTRACT_CLASS( className ) /** Used inside a class declaration to make the class known to wxWidgets RTTI system and also declare that the objects of this class should be dynamically creatable from run-time type information. Notice that this implies that the class should have a default constructor, if this is not - the case consider using DECLARE_CLASS(). + the case consider using wxDECLARE_ABSTRACT_CLASS(). @header{wx/object.h} @@ -703,7 +694,7 @@ public: @code class wxFrame: public wxWindow { - DECLARE_DYNAMIC_CLASS(wxFrame) + wxDECLARE_DYNAMIC_CLASS(wxFrame); private: const wxString& frameTitle; @@ -712,35 +703,27 @@ public: }; @endcode */ -#define DECLARE_DYNAMIC_CLASS( className ) +#define wxDECLARE_DYNAMIC_CLASS( className ) /** - Used in a C++ implementation file to complete the declaration of a class - that has run-time type information. The same as IMPLEMENT_ABSTRACT_CLASS(). - - @header{wx/object.h} -*/ -#define IMPLEMENT_CLASS( className, baseClassName ) - -/** - Used in a C++ implementation file to complete the declaration of a class - that has run-time type information and two base classes. The same as - IMPLEMENT_ABSTRACT_CLASS2(). + Used inside a class declaration to declare that the class should be made + known to the class hierarchy, but objects of this class cannot be created + dynamically. The same as wxDECLARE_DYNAMIC_CLASS(). @header{wx/object.h} */ -#define IMPLEMENT_CLASS2( className, baseClassName1, baseClassName2 ) +#define wxDECLARE_CLASS( className ) /** Used in a C++ implementation file to complete the declaration of a class - that has run-time type information. The same as IMPLEMENT_CLASS(). - + that has run-time type information. + @header{wx/object.h} Example: @code - IMPLEMENT_ABSTRACT_CLASS(wxCommand, wxObject) + wxIMPLEMENT_ABSTRACT_CLASS(wxCommand, wxObject); wxCommand::wxCommand(void) { @@ -748,16 +731,15 @@ public: } @endcode */ -#define IMPLEMENT_ABSTRACT_CLASS( className, baseClassName ) +#define wxIMPLEMENT_ABSTRACT_CLASS( className, baseClassName ) /** Used in a C++ implementation file to complete the declaration of a class - that has run-time type information and two base classes. The same as - IMPLEMENT_CLASS2(). + that has run-time type information and two base classes. @header{wx/object.h} */ -#define IMPLEMENT_ABSTRACT_CLASS2( className, baseClassName1, baseClassName2 ) +#define wxIMPLEMENT_ABSTRACT_CLASS2( className, baseClassName1, baseClassName2 ) /** Used in a C++ implementation file to complete the declaration of a class @@ -769,7 +751,7 @@ public: Example: @code - IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow) + wxIMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow); wxFrame::wxFrame(void) { @@ -777,7 +759,7 @@ public: } @endcode */ -#define IMPLEMENT_DYNAMIC_CLASS( className, baseClassName ) +#define wxIMPLEMENT_DYNAMIC_CLASS( className, baseClassName ) /** Used in a C++ implementation file to complete the declaration of a class @@ -786,7 +768,25 @@ public: @header{wx/object.h} */ -#define IMPLEMENT_DYNAMIC_CLASS2( className, baseClassName1, baseClassName2 ) +#define wxIMPLEMENT_DYNAMIC_CLASS2( className, baseClassName1, baseClassName2 ) + +/** + Used in a C++ implementation file to complete the declaration of a class + that has run-time type information, and whose instances can be created + dynamically. The same as wxIMPLEMENT_DYNAMIC_CLASS(). + + @header{wx/object.h} +*/ +#define wxIMPLEMENT_CLASS( className, baseClassName ) + +/** + Used in a C++ implementation file to complete the declaration of a class + that has run-time type information and two base classes, and whose instances + can be created dynamically. The same as wxIMPLEMENT_DYNAMIC_CLASS2(). + + @header{wx/object.h} +*/ +#define wxIMPLEMENT_CLASS2( className, baseClassName1, baseClassName2 ) /** Same as @c const_cast(x) if the compiler supports const cast or @c (T)x for diff --git a/interface/wx/propgrid/editors.h b/interface/wx/propgrid/editors.h index c74c2816a1..accd916528 100644 --- a/interface/wx/propgrid/editors.h +++ b/interface/wx/propgrid/editors.h @@ -184,7 +184,8 @@ public: class wxSampleMultiButtonEditor : public wxPGTextCtrlEditor { - DECLARE_DYNAMIC_CLASS(wxSampleMultiButtonEditor) + wxDECLARE_DYNAMIC_CLASS(wxSampleMultiButtonEditor); + public: wxSampleMultiButtonEditor() {} virtual ~wxSampleMultiButtonEditor() {} @@ -201,7 +202,7 @@ public: wxEvent& event ) const; }; - IMPLEMENT_DYNAMIC_CLASS(wxSampleMultiButtonEditor, wxPGTextCtrlEditor) + wxIMPLEMENT_DYNAMIC_CLASS(wxSampleMultiButtonEditor, wxPGTextCtrlEditor); wxPGWindowList wxSampleMultiButtonEditor::CreateControls( wxPropertyGrid* propGrid, wxPGProperty* property, diff --git a/interface/wx/propgrid/property.h b/interface/wx/propgrid/property.h index 762f6a37f1..8301bdf30f 100644 --- a/interface/wx/propgrid/property.h +++ b/interface/wx/propgrid/property.h @@ -621,7 +621,7 @@ wxPG_PROP_BEING_DELETED = 0x00200000 @endcode Since wxPGProperty derives from wxObject, you can use standard - DECLARE_DYNAMIC_CLASS and IMPLEMENT_DYNAMIC_CLASS macros. From the + wxDECLARE_DYNAMIC_CLASS and wxIMPLEMENT_DYNAMIC_CLASS macros. From the above example they were omitted for sake of simplicity, and besides, they are only really needed if you need to use wxRTTI with your property class. diff --git a/interface/wx/treectrl.h b/interface/wx/treectrl.h index f11959f743..55b34394ae 100644 --- a/interface/wx/treectrl.h +++ b/interface/wx/treectrl.h @@ -307,7 +307,7 @@ public: @see EndEditLabel(), wxTreeEvent */ virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, - wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)); + wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl)); /** Ends label editing. If @a cancelEdit is @true, the edit will be @@ -751,8 +751,8 @@ public: zero or positive value if the first item is less than, equal to or greater than the second one. - Please note that you @b must use wxRTTI macros DECLARE_DYNAMIC_CLASS() - and IMPLEMENT_DYNAMIC_CLASS() if you override this function because + Please note that you @b must use wxRTTI macros wxDECLARE_DYNAMIC_CLASS() + and wxIMPLEMENT_DYNAMIC_CLASS() if you override this function because otherwise the base class considers that it is not overridden and uses the default comparison, i.e. sorts the items alphabetically, which allows it optimize away the calls to the virtual function completely. -- 2.45.2