Add wxSpinCtrl::SetBase() to allow entering hexadecimal numbers.

Add a generic SetBase() API even though right now only bases 10 and 16 are
supported as we might support other ones (e.g. 8?) in the future. Implement it
for MSW, GTK and generic versions.

Add controls allowing to test this feature to the widgets sample.

Add "base" property support to the XRC handler for wxSpinCtrl, document it and
test it in the xrc sample.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72414 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-08-30 20:24:38 +00:00
parent 36090ae57e
commit 9e565667d0
14 changed files with 328 additions and 23 deletions

View File

@@ -89,7 +89,7 @@ protected:
class WXDLLIMPEXP_CORE wxSpinCtrl : public wxSpinCtrlGTKBase
{
public:
wxSpinCtrl() {}
wxSpinCtrl() { Init(); }
wxSpinCtrl(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxString& value = wxEmptyString,
@@ -99,6 +99,8 @@ public:
int min = 0, int max = 100, int initial = 0,
const wxString& name = wxS("wxSpinCtrl"))
{
Init();
Create(parent, id, value, pos, size, style, min, max, initial, name);
}
@@ -127,6 +129,18 @@ public:
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);
private:
// Common part of all ctors.
void Init()
{
m_base = 10;
}
int m_base;
DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
};
@@ -180,6 +194,9 @@ public:
void SetIncrement(double inc) { DoSetIncrement(inc); }
void SetDigits(unsigned digits);
virtual int GetBase() const { return 10; }
virtual bool SetBase(int WXUNUSED(base)) { return false; }
DECLARE_DYNAMIC_CLASS(wxSpinCtrlDouble)
};