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