]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/spinctlg.h
test
[wxWidgets.git] / include / wx / generic / spinctlg.h
CommitLineData
669a6e11
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/generic/spinctlg.h
3// Purpose: generic wxSpinCtrl class
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 28.10.99
7// RCS-ID: $Id$
8// Copyright: (c) Vadim Zeitlin
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_GENERIC_SPINCTRL_H_
13#define _WX_GENERIC_SPINCTRL_H_
14
15#include "wx/textctrl.h"
16
17// ----------------------------------------------------------------------------
18// generic wxSpinCtrl is just a text control
19// ----------------------------------------------------------------------------
20
21class WXDLLEXPORT wxSpinCtrl : public wxTextCtrl
22{
23public:
24 wxSpinCtrlBase() { Init(); }
25
26 // accessors
27 int GetValue() const
28 {
29 int n;
30 if ( (wxSscanf(wxTextCtrl::GetValue(), wxT("%d"), &n) != 1) )
31 n = INT_MIN;
32
33 return n;
34 }
35
36 int GetMin() const { return m_min; }
37 int GetMax() const { return m_max; }
38
39 // operations
40 void SetValue(const wxString& value) { wxTextCtrl::SetValue(value); }
41 void SetValue(int val) { wxString s; s << val; wxTextCtrl::SetValue(s); }
42 void SetRange(int min, int max) { m_min = min; m_max = max; }
43
44protected:
45 // initialize m_min/max with the default values
46 void Init() { SetRange(0, 100); }
47
48 int m_min;
49 int m_max;
50};
51
52#endif // _WX_GENERIC_SPINCTRL_H_
53