From bcb016613e508aedde906a9f57cf2ac0cc8b25ba Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 21 Sep 2020 17:59:22 +0200 Subject: [PATCH] Make wxRadioButtonBase a plain class, not template Use a dirty hack to accommodate wxUniv by deriving wxRadioButtonBase from wxCheckBox, rather than wxControl, there. This is not pretty, but should be addressed by refactoring wxUniv code and in the meanwhile all the other ports don't have to bother with using a template class unnecessarily. --- include/wx/gtk/radiobut.h | 2 +- include/wx/gtk1/radiobut.h | 2 +- include/wx/motif/radiobut.h | 2 +- include/wx/msw/radiobut.h | 2 +- include/wx/osx/radiobut.h | 2 +- include/wx/qt/radiobut.h | 2 +- include/wx/radiobut.h | 21 ++++++++++++++------- include/wx/univ/radiobut.h | 4 +--- 8 files changed, 21 insertions(+), 16 deletions(-) diff --git a/include/wx/gtk/radiobut.h b/include/wx/gtk/radiobut.h index 785530a98e..8a19a022dd 100644 --- a/include/wx/gtk/radiobut.h +++ b/include/wx/gtk/radiobut.h @@ -13,7 +13,7 @@ // wxRadioButton //----------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase +class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase { public: wxRadioButton() { } diff --git a/include/wx/gtk1/radiobut.h b/include/wx/gtk1/radiobut.h index 662b681d74..d467f7100c 100644 --- a/include/wx/gtk1/radiobut.h +++ b/include/wx/gtk1/radiobut.h @@ -13,7 +13,7 @@ // wxRadioButton //----------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase +class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase { public: wxRadioButton() { } diff --git a/include/wx/motif/radiobut.h b/include/wx/motif/radiobut.h index 5759f01162..0233364946 100644 --- a/include/wx/motif/radiobut.h +++ b/include/wx/motif/radiobut.h @@ -11,7 +11,7 @@ #ifndef _WX_RADIOBUT_H_ #define _WX_RADIOBUT_H_ -class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase +class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase { wxDECLARE_DYNAMIC_CLASS(wxRadioButton); public: diff --git a/include/wx/msw/radiobut.h b/include/wx/msw/radiobut.h index 41103ed3b9..765f6bcc8f 100644 --- a/include/wx/msw/radiobut.h +++ b/include/wx/msw/radiobut.h @@ -13,7 +13,7 @@ #include "wx/msw/ownerdrawnbutton.h" -class WXDLLIMPEXP_CORE wxRadioButton : public wxRadioButtonBase< wxMSWOwnerDrawnButton > +class WXDLLIMPEXP_CORE wxRadioButton : public wxMSWOwnerDrawnButton { public: // ctors and creation functions diff --git a/include/wx/osx/radiobut.h b/include/wx/osx/radiobut.h index b6bcb8ada3..3934f839f8 100644 --- a/include/wx/osx/radiobut.h +++ b/include/wx/osx/radiobut.h @@ -11,7 +11,7 @@ #ifndef _WX_RADIOBUT_H_ #define _WX_RADIOBUT_H_ -class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase +class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase { wxDECLARE_DYNAMIC_CLASS(wxRadioButton); diff --git a/include/wx/qt/radiobut.h b/include/wx/qt/radiobut.h index da00d190cf..145b97a4ea 100644 --- a/include/wx/qt/radiobut.h +++ b/include/wx/qt/radiobut.h @@ -10,7 +10,7 @@ class QRadioButton; -class WXDLLIMPEXP_CORE wxRadioButton : public wxRadioButtonBase +class WXDLLIMPEXP_CORE wxRadioButton : public wxRadioButtonBase { public: wxRadioButton(); diff --git a/include/wx/radiobut.h b/include/wx/radiobut.h index a4d78656bc..90217847a5 100644 --- a/include/wx/radiobut.h +++ b/include/wx/radiobut.h @@ -27,14 +27,21 @@ namespace wxPrivate WXDLLIMPEXP_CORE wxRadioButton* wxGetLastButtonInGroup(const wxRadioButton *btn); } // namespace wxPrivate -// Unlike most of the other wxXXXBase classes, this one needs to be a template -// as wxRadioButton derives from different classes in different ports. -template -class wxRadioButtonBase : public W +// TODO: In wxUniv, wxRadioButton must derive from wxCheckBox as it reuses +// much of its code. This should be fixed by refactoring wxCheckBox to allow +// this class to reuse its functionality without inheriting from it, but for +// now use this hack to allow the existing code to compile. +#ifdef __WXUNIVERSAL__ + #include "wx/checkbox.h" + + typedef wxCheckBox wxRadioButtonBaseBase; +#else + typedef wxControl wxRadioButtonBaseBase; +#endif + +class WXDLLIMPEXP_CORE wxRadioButtonBase : public wxRadioButtonBaseBase { public: - typedef W BaseWindowClass; - wxRadioButtonBase() { } // Methods to be implemented by the derived classes: @@ -64,7 +71,7 @@ public: } private: - wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxRadioButtonBase, W); + wxDECLARE_NO_COPY_CLASS(wxRadioButtonBase); }; extern WXDLLIMPEXP_DATA_CORE(const char) wxRadioButtonNameStr[]; diff --git a/include/wx/univ/radiobut.h b/include/wx/univ/radiobut.h index ab81a71c5a..711e0a676c 100644 --- a/include/wx/univ/radiobut.h +++ b/include/wx/univ/radiobut.h @@ -11,13 +11,11 @@ #ifndef _WX_UNIV_RADIOBUT_H_ #define _WX_UNIV_RADIOBUT_H_ -#include "wx/checkbox.h" - // ---------------------------------------------------------------------------- // wxRadioButton // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxRadioButton : public wxRadioButtonBase +class WXDLLIMPEXP_CORE wxRadioButton : public wxRadioButtonBase { public: // constructors