]> git.saurik.com Git - wxWidgets.git/blob - interface/spinbutt.h
e5f83aed88395ca2efabf62f6af236b9d27023b5
[wxWidgets.git] / interface / spinbutt.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: spinbutt.h
3 // Purpose: documentation for wxSpinEvent class
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxSpinEvent
11 @wxheader{spinbutt.h}
12
13 This event class is used for the events generated by
14 wxSpinButton and wxSpinCtrl.
15
16 @library{wxcore}
17 @category{events}
18
19 @seealso
20 wxSpinButton and wxSpinCtrl
21 */
22 class wxSpinEvent : public wxNotifyEvent
23 {
24 public:
25 /**
26 The constructor is not normally used by the user code.
27 */
28 wxSpinEvent(wxEventType commandType = wxEVT_@NULL, int id = 0);
29
30 /**
31 Retrieve the current spin button or control value.
32 */
33 int GetPosition();
34
35 /**
36 Set the value associated with the event.
37 */
38 void SetPosition(int pos);
39 };
40
41
42 /**
43 @class wxSpinButton
44 @wxheader{spinbutt.h}
45
46 A wxSpinButton has two small up and down (or left and right) arrow buttons. It
47 is often used next to a text control for increment and decrementing a value.
48 Portable programs should try to use wxSpinCtrl instead
49 as wxSpinButton is not implemented for all platforms but wxSpinCtrl is as it
50 degenerates to a simple wxTextCtrl on such platforms.
51
52 @b NB: the range supported by this control (and wxSpinCtrl) depends on the
53 platform but is at least @c -0x8000 to @c 0x7fff. Under GTK and
54 Win32 with sufficiently new version of @c comctrl32.dll (at least 4.71 is
55 required, 5.80 is recommended) the full 32 bit range is supported.
56
57 @beginStyleTable
58 @style{wxSP_HORIZONTAL}:
59 Specifies a horizontal spin button (note that this style is not
60 supported in wxGTK).
61 @style{wxSP_VERTICAL}:
62 Specifies a vertical spin button.
63 @style{wxSP_ARROW_KEYS}:
64 The user can use arrow keys to change the value.
65 @style{wxSP_WRAP}:
66 The value wraps at the minimum and maximum.
67 @endStyleTable
68
69 @library{wxcore}
70 @category{ctrl}
71 @appearance{spinbutton.png}
72
73 @seealso
74 wxSpinCtrl
75 */
76 class wxSpinButton : public wxControl
77 {
78 public:
79 //@{
80 /**
81 Constructor, creating and showing a spin button.
82
83 @param parent
84 Parent window. Must not be @NULL.
85
86 @param id
87 Window identifier. The value wxID_ANY indicates a default value.
88
89 @param pos
90 Window position. If wxDefaultPosition is specified then a default position
91 is chosen.
92
93 @param size
94 Window size. If wxDefaultSize is specified then a default size is
95 chosen.
96
97 @param style
98 Window style. See wxSpinButton.
99
100 @param name
101 Window name.
102
103 @sa Create()
104 */
105 wxSpinButton();
106 wxSpinButton(wxWindow* parent, wxWindowID id,
107 const wxPoint& pos = wxDefaultPosition,
108 const wxSize& size = wxDefaultSize,
109 long style = wxSP_HORIZONTAL,
110 const wxString& name = "spinButton");
111 //@}
112
113 /**
114 Destructor, destroys the spin button control.
115 */
116 ~wxSpinButton();
117
118 /**
119 Scrollbar creation function called by the spin button constructor.
120 See wxSpinButton() for details.
121 */
122 bool Create(wxWindow* parent, wxWindowID id,
123 const wxPoint& pos = wxDefaultPosition,
124 const wxSize& size = wxDefaultSize,
125 long style = wxSP_HORIZONTAL,
126 const wxString& name = "spinButton");
127
128 /**
129 Returns the maximum permissible value.
130
131 @sa SetRange()
132 */
133 int GetMax();
134
135 /**
136 Returns the minimum permissible value.
137
138 @sa SetRange()
139 */
140 int GetMin();
141
142 /**
143 Returns the current spin button value.
144
145 @sa SetValue()
146 */
147 int GetValue();
148
149 /**
150 Sets the range of the spin button.
151
152 @param min
153 The minimum value for the spin button.
154
155 @param max
156 The maximum value for the spin button.
157
158 @sa GetMin(), GetMax()
159 */
160 void SetRange(int min, int max);
161
162 /**
163 Sets the value of the spin button.
164
165 @param value
166 The value for the spin button.
167 */
168 void SetValue(int value);
169 };