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.
This commit is contained in:
Vadim Zeitlin
2020-09-21 17:59:22 +02:00
parent 3d72c009be
commit bcb016613e
8 changed files with 21 additions and 16 deletions

View File

@@ -13,7 +13,7 @@
// wxRadioButton
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase<wxControl>
class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase
{
public:
wxRadioButton() { }

View File

@@ -13,7 +13,7 @@
// wxRadioButton
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase<wxControl>
class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase
{
public:
wxRadioButton() { }

View File

@@ -11,7 +11,7 @@
#ifndef _WX_RADIOBUT_H_
#define _WX_RADIOBUT_H_
class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase<wxControl>
class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase
{
wxDECLARE_DYNAMIC_CLASS(wxRadioButton);
public:

View File

@@ -13,7 +13,7 @@
#include "wx/msw/ownerdrawnbutton.h"
class WXDLLIMPEXP_CORE wxRadioButton : public wxRadioButtonBase< wxMSWOwnerDrawnButton<wxControl> >
class WXDLLIMPEXP_CORE wxRadioButton : public wxMSWOwnerDrawnButton<wxRadioButtonBase>
{
public:
// ctors and creation functions

View File

@@ -11,7 +11,7 @@
#ifndef _WX_RADIOBUT_H_
#define _WX_RADIOBUT_H_
class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase<wxControl>
class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase
{
wxDECLARE_DYNAMIC_CLASS(wxRadioButton);

View File

@@ -10,7 +10,7 @@
class QRadioButton;
class WXDLLIMPEXP_CORE wxRadioButton : public wxRadioButtonBase<wxControl>
class WXDLLIMPEXP_CORE wxRadioButton : public wxRadioButtonBase
{
public:
wxRadioButton();

View File

@@ -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 W>
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[];

View File

@@ -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<wxCheckBox>
class WXDLLIMPEXP_CORE wxRadioButton : public wxRadioButtonBase
{
public:
// constructors