#if wxUSE_SPINBTN
+#include "wx/compositewin.h"
+
class WXDLLIMPEXP_FWD_CORE wxSpinButton;
class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
// function ambiguity.
// ----------------------------------------------------------------------------
-class WXDLLIMPEXP_CORE wxSpinCtrlGenericBase : public wxSpinCtrlBase
+class WXDLLIMPEXP_CORE wxSpinCtrlGenericBase
+ : public wxCompositeWindow<wxSpinCtrlBase>
{
public:
wxSpinCtrlGenericBase() { Init(); }
protected:
// override the base class virtuals involved into geometry calculations
virtual wxSize DoGetBestSize() const;
+ virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const;
virtual void DoMoveWindow(int x, int y, int width, int height);
#ifdef __WXMSW__
// common part of all ctors
void Init();
+ // Implement pure virtual function inherited from wxCompositeWindow.
+ virtual wxWindowList GetCompositeWindowParts() const;
+
DECLARE_EVENT_TABLE()
};
class WXDLLIMPEXP_CORE wxSpinCtrl : public wxSpinCtrlGenericBase
{
public:
- wxSpinCtrl() {}
+ wxSpinCtrl() { Init(); }
wxSpinCtrl(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxString& value = wxEmptyString,
int min = 0, int max = 100, int initial = 0,
const wxString& name = wxT("wxSpinCtrl"))
{
+ Init();
+
Create(parent, id, value, pos, size, style, min, max, initial, name);
}
void SetRange( int minVal, int maxVal ) { DoSetRange(minVal, maxVal); }
void SetIncrement(int inc) { DoSetIncrement(inc); }
+ virtual int GetBase() const { return m_base; }
+ virtual bool SetBase(int base);
+
protected:
virtual void DoSendEvent();
virtual bool DoTextToValue(const wxString& text, double *val);
virtual wxString DoValueToText(double val);
+
+private:
+ // Common part of all ctors.
+ void Init()
+ {
+ m_base = 10;
+ }
+
+ int m_base;
+
DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
};
void SetIncrement(double inc) { DoSetIncrement(inc); }
void SetDigits(unsigned digits);
+ // We don't implement bases support for floating point numbers, this is not
+ // very useful in practice.
+ virtual int GetBase() const { return 10; }
+ virtual bool SetBase(int WXUNUSED(base)) { return 0; }
+
protected:
virtual void DoSendEvent();