]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: spinbutt.h | |
3 | // Purpose: interface of wxSpinEvent | |
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 | @see wxSpinButton and wxSpinCtrl | |
20 | */ | |
21 | class wxSpinEvent : public wxNotifyEvent | |
22 | { | |
23 | public: | |
24 | /** | |
25 | The constructor is not normally used by the user code. | |
26 | */ | |
27 | wxSpinEvent(wxEventType commandType = wxEVT_NULL, int id = 0); | |
28 | ||
29 | /** | |
30 | Retrieve the current spin button or control value. | |
31 | */ | |
32 | int GetPosition() const; | |
33 | ||
34 | /** | |
35 | Set the value associated with the event. | |
36 | */ | |
37 | void SetPosition(int pos); | |
38 | }; | |
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 | @note 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 | @see wxSpinCtrl | |
74 | */ | |
75 | class wxSpinButton : public wxControl | |
76 | { | |
77 | public: | |
78 | //@{ | |
79 | /** | |
80 | Constructor, creating and showing a spin button. | |
81 | ||
82 | @param parent | |
83 | Parent window. Must not be @NULL. | |
84 | @param id | |
85 | Window identifier. The value wxID_ANY indicates a default value. | |
86 | @param pos | |
87 | Window position. If wxDefaultPosition is specified then a default | |
88 | position is chosen. | |
89 | @param size | |
90 | Window size. If wxDefaultSize is specified then a default size | |
91 | is chosen. | |
92 | @param style | |
93 | Window style. See wxSpinButton. | |
94 | @param name | |
95 | Window name. | |
96 | ||
97 | @see Create() | |
98 | */ | |
99 | wxSpinButton(); | |
100 | wxSpinButton(wxWindow* parent, wxWindowID id, | |
101 | const wxPoint& pos = wxDefaultPosition, | |
102 | const wxSize& size = wxDefaultSize, | |
103 | long style = wxSP_HORIZONTAL, | |
104 | const wxString& name = "spinButton"); | |
105 | //@} | |
106 | ||
107 | /** | |
108 | Destructor, destroys the spin button control. | |
109 | */ | |
110 | ~wxSpinButton(); | |
111 | ||
112 | /** | |
113 | Scrollbar creation function called by the spin button constructor. | |
114 | See wxSpinButton() for details. | |
115 | */ | |
116 | bool Create(wxWindow* parent, wxWindowID id, | |
117 | const wxPoint& pos = wxDefaultPosition, | |
118 | const wxSize& size = wxDefaultSize, | |
119 | long style = wxSP_HORIZONTAL, | |
120 | const wxString& name = "spinButton"); | |
121 | ||
122 | /** | |
123 | Returns the maximum permissible value. | |
124 | ||
125 | @see SetRange() | |
126 | */ | |
127 | int GetMax() const; | |
128 | ||
129 | /** | |
130 | Returns the minimum permissible value. | |
131 | ||
132 | @see SetRange() | |
133 | */ | |
134 | int GetMin() const; | |
135 | ||
136 | /** | |
137 | Returns the current spin button value. | |
138 | ||
139 | @see SetValue() | |
140 | */ | |
141 | int GetValue() const; | |
142 | ||
143 | /** | |
144 | Sets the range of the spin button. | |
145 | ||
146 | @param min | |
147 | The minimum value for the spin button. | |
148 | @param max | |
149 | The maximum value for the spin button. | |
150 | ||
151 | @see GetMin(), GetMax() | |
152 | */ | |
153 | void SetRange(int min, int max); | |
154 | ||
155 | /** | |
156 | Sets the value of the spin button. | |
157 | ||
158 | @param value | |
159 | The value for the spin button. | |
160 | */ | |
161 | void SetValue(int value); | |
162 | }; | |
163 |