Add wxRadioButtonBase::{Set,Get}Value()
Now that we do have wxRadioButtonBase class, declare wxRadioButton API methods as pure virtual in it, to force the derived classes to implement them. Also remove the outdated comment saying that there is no base class for wxRadioButtons in different ports, this is not true any longer.
This commit is contained in:
@@ -39,8 +39,8 @@ public:
|
||||
const wxString& name = wxASCII_STR(wxRadioButtonNameStr) );
|
||||
|
||||
virtual void SetLabel(const wxString& label) wxOVERRIDE;
|
||||
virtual void SetValue(bool val);
|
||||
virtual bool GetValue() const;
|
||||
virtual void SetValue(bool val) wxOVERRIDE;
|
||||
virtual bool GetValue() const wxOVERRIDE;
|
||||
|
||||
static wxVisualAttributes
|
||||
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
||||
|
@@ -43,8 +43,8 @@ public:
|
||||
const wxString& name = wxASCII_STR(wxRadioButtonNameStr));
|
||||
|
||||
// implement the radio button interface
|
||||
virtual void SetValue(bool value);
|
||||
virtual bool GetValue() const;
|
||||
virtual void SetValue(bool value) wxOVERRIDE;
|
||||
virtual bool GetValue() const wxOVERRIDE;
|
||||
|
||||
// implementation only from now on
|
||||
virtual bool MSWCommand(WXUINT param, WXWORD id) wxOVERRIDE;
|
||||
|
@@ -35,8 +35,8 @@ public:
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxASCII_STR(wxRadioButtonNameStr));
|
||||
|
||||
virtual void SetValue(bool val);
|
||||
virtual bool GetValue() const ;
|
||||
virtual void SetValue(bool val) wxOVERRIDE;
|
||||
virtual bool GetValue() const wxOVERRIDE;
|
||||
|
||||
// implementation
|
||||
|
||||
|
@@ -32,8 +32,8 @@ public:
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxASCII_STR(wxRadioButtonNameStr) );
|
||||
|
||||
virtual void SetValue(bool value);
|
||||
virtual bool GetValue() const;
|
||||
virtual void SetValue(bool value) wxOVERRIDE;
|
||||
virtual bool GetValue() const wxOVERRIDE;
|
||||
|
||||
virtual QWidget *GetHandle() const wxOVERRIDE;
|
||||
|
||||
|
@@ -15,21 +15,6 @@
|
||||
|
||||
#if wxUSE_RADIOBTN
|
||||
|
||||
/*
|
||||
There is no wxRadioButtonBase class as wxRadioButton interface is the same
|
||||
as wxCheckBox(Base), but under some platforms wxRadioButton really
|
||||
derives from wxCheckBox and on the others it doesn't.
|
||||
|
||||
The pseudo-declaration of wxRadioButtonBase would look like this:
|
||||
|
||||
class wxRadioButtonBase : public ...
|
||||
{
|
||||
public:
|
||||
virtual void SetValue(bool value);
|
||||
virtual bool GetValue() const;
|
||||
};
|
||||
*/
|
||||
|
||||
#include "wx/control.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxRadioButton;
|
||||
@@ -42,6 +27,8 @@ 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
|
||||
{
|
||||
@@ -50,6 +37,12 @@ public:
|
||||
|
||||
wxRadioButtonBase() { }
|
||||
|
||||
// Methods to be implemented by the derived classes:
|
||||
virtual void SetValue(bool value) = 0;
|
||||
virtual bool GetValue() const = 0;
|
||||
|
||||
|
||||
// Methods implemented by this class itself.
|
||||
wxRadioButton* GetFirstInGroup() const
|
||||
{
|
||||
return wxPrivate::wxGetFirstButtonInGroup(static_cast<const wxRadioButton*>(this));
|
||||
|
@@ -46,6 +46,10 @@ public:
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxASCII_STR(wxRadioButtonNameStr));
|
||||
|
||||
// (re)implement pure virtuals from wxRadioButtonBase
|
||||
virtual void SetValue(bool value) wxOVERRIDE { return wxCheckBox::SetValue(value); }
|
||||
virtual bool GetValue() const wxOVERRIDE { return wxCheckBox::GetValue(); }
|
||||
|
||||
// override some base class methods
|
||||
virtual void ChangeValue(bool value) wxOVERRIDE;
|
||||
|
||||
|
Reference in New Issue
Block a user