]> git.saurik.com Git - wxWidgets.git/blob - interface/spinctrl.h
114faeefb8e261b89ce14799b7d5a66f94e1ba61
[wxWidgets.git] / interface / spinctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: spinctrl.h
3 // Purpose: documentation for wxSpinCtrl class
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxSpinCtrl
11 @wxheader{spinctrl.h}
12
13 wxSpinCtrl combines wxTextCtrl and
14 wxSpinButton in one control.
15
16 @beginStyleTable
17 @style{wxSP_ARROW_KEYS}:
18 The user can use arrow keys to change the value.
19 @style{wxSP_WRAP}:
20 The value wraps at the minimum and maximum.
21 @endStyleTable
22
23 @library{wxcore}
24 @category{ctrl}
25 @appearance{spinctrl.png}
26
27 @seealso
28 @ref overview_eventhandlingoverview, wxSpinButton, wxControl
29 */
30 class wxSpinCtrl : public wxControl
31 {
32 public:
33 //@{
34 /**
35 )
36 Constructor, creating and showing a spin control.
37
38 @param parent
39 Parent window. Must not be @NULL.
40 @param value
41 Default value.
42 @param id
43 Window identifier. The value wxID_ANY indicates a default value.
44 @param pos
45 Window position. If wxDefaultPosition is specified then a default
46 position is chosen.
47 @param size
48 Window size. If wxDefaultSize is specified then a default size
49 is chosen.
50 @param style
51 Window style. See wxSpinButton.
52 @param min
53 Minimal value.
54 @param max
55 Maximal value.
56 @param initial
57 Initial value.
58 @param name
59 Window name.
60
61 @see Create()
62 */
63 wxSpinCtrl();
64 wxSpinCtrl(wxWindow* parent, wxWindowID id = -1,
65 const wxString& value = wxEmptyString,
66 const wxPoint& pos = wxDefaultPosition,
67 const wxSize& size = wxDefaultSize,
68 long style = wxSP_ARROW_KEYS,
69 int min = 0, int max = 100,
70 int initial = 0);
71 //@}
72
73 /**
74 )
75 Creation function called by the spin control constructor.
76 See wxSpinCtrl() for details.
77 */
78 bool Create(wxWindow* parent, wxWindowID id = -1,
79 const wxString& value = wxEmptyString,
80 const wxPoint& pos = wxDefaultPosition,
81 const wxSize& size = wxDefaultSize,
82 long style = wxSP_ARROW_KEYS,
83 int min = 0, int max = 100,
84 int initial = 0);
85
86 /**
87 Gets maximal allowable value.
88 */
89 int GetMax();
90
91 /**
92 Gets minimal allowable value.
93 */
94 int GetMin();
95
96 /**
97 Gets the value of the spin control.
98 */
99 int GetValue();
100
101 /**
102 Sets range of allowable values.
103 */
104 void SetRange(int minVal, int maxVal);
105
106 /**
107 Select the text in the text part of the control between positions
108 @a from (inclusive) and @a to (exclusive). This is similar to
109 wxTextCtrl::SetSelection.
110 @b NB: this is currently only implemented for Windows and generic versions
111 of the control.
112 */
113 void SetSelection(long from, long to);
114
115 //@{
116 /**
117 Sets the value of the spin control.
118 */
119 void SetValue(const wxString& text);
120 void SetValue(int value);
121 //@}
122 };