]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/spinctlg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/spinctlg.h
3 // Purpose: generic wxSpinCtrl class
4 // Author: Vadim Zeitlin
8 // Copyright: (c) Vadim Zeitlin
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_GENERIC_SPINCTRL_H_
13 #define _WX_GENERIC_SPINCTRL_H_
16 #pragma interface "spinctlg.h"
19 #include "wx/textctrl.h"
21 // ----------------------------------------------------------------------------
22 // generic wxSpinCtrl is just a text control
23 // ----------------------------------------------------------------------------
25 class WXDLLEXPORT wxSpinCtrl
: public wxTextCtrl
28 wxSpinCtrl() { Init(); }
30 wxSpinCtrl(wxWindow
*parent
,
32 const wxString
& value
= wxEmptyString
,
33 const wxPoint
& pos
= wxDefaultPosition
,
34 const wxSize
& size
= wxDefaultSize
,
35 long style
= wxSP_ARROW_KEYS
,
36 int min
= 0, int max
= 100, int initial
= 0,
37 const wxString
& name
= _T("wxSpinCtrl"))
39 Create(parent
, id
, value
, pos
, size
, style
, min
, max
, initial
, name
);
42 bool Create(wxWindow
*parent
,
44 const wxString
& value
= wxEmptyString
,
45 const wxPoint
& pos
= wxDefaultPosition
,
46 const wxSize
& size
= wxDefaultSize
,
47 long style
= wxSP_ARROW_KEYS
,
48 int min
= 0, int max
= 100, int initial
= 0,
49 const wxString
& name
= _T("wxSpinCtrl"))
53 bool ok
= wxTextCtrl::Create(parent
, id
, value
, pos
, size
, style
,
54 wxDefaultValidator
, name
);
61 int GetValue(int WXUNUSED(dummy
) = 1) const
64 if ( (wxSscanf(wxTextCtrl::GetValue(), wxT("%d"), &n
) != 1) )
70 int GetMin() const { return m_min
; }
71 int GetMax() const { return m_max
; }
74 void SetValue(const wxString
& value
) { wxTextCtrl::SetValue(value
); }
75 void SetValue(int val
) { wxString s
; s
<< val
; wxTextCtrl::SetValue(s
); }
76 void SetRange(int min
, int max
) { m_min
= min
; m_max
= max
; }
79 // initialize m_min/max with the default values
80 void Init() { SetRange(0, 100); }
86 DECLARE_DYNAMIC_CLASS(wxSpinCtrl
)
89 #endif // _WX_GENERIC_SPINCTRL_H_