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