]>
Commit | Line | Data |
---|---|---|
7bf85405 RD |
1 | %module controls |
2 | %{ | |
3 | ///////////////////////////////////////////////////////////////////////////// | |
4 | // Name: controls.i | |
5 | // Purpose: Control (widget) classes for wxPython | |
6 | // | |
7 | // Author: Robin Dunn | |
8 | // | |
9 | // Created: 6/10/98 | |
10 | // RCS-ID: $Id$ | |
11 | // Copyright: (c) 1998 by Total Control Software | |
12 | // Licence: wxWindows license | |
13 | ///////////////////////////////////////////////////////////////////////////// | |
14 | ||
15 | ||
16 | #include "helpers.h" | |
17 | #include <wx/slider.h> | |
18 | #include <wx/spinbutt.h> | |
19 | %} | |
20 | ||
21 | //---------------------------------------------------------------------- | |
22 | ||
23 | %include typemaps.i | |
24 | %include my_typemaps.i | |
25 | ||
26 | // Import some definitions of other classes, etc. | |
27 | %import _defs.i | |
28 | %import misc.i | |
29 | %import windows.i | |
30 | %import gdi.i | |
31 | %import events.i | |
32 | ||
33 | //---------------------------------------------------------------------- | |
34 | ||
35 | %{ | |
36 | wxValidator wxPyDefaultValidator; // Non-const default because of SWIG | |
37 | %} | |
38 | ||
39 | //---------------------------------------------------------------------- | |
40 | ||
41 | class wxControl : public wxWindow { | |
42 | public: | |
43 | void Command(wxCommandEvent& event); | |
44 | wxString& GetLabel(); | |
45 | void SetLabel(const wxString& label); | |
46 | }; | |
47 | ||
48 | //---------------------------------------------------------------------- | |
49 | ||
50 | class wxButton : public wxControl { | |
51 | public: | |
52 | wxButton(wxWindow* parent, wxWindowID id, const wxString& label, | |
53 | const wxPoint& pos = wxPyDefaultPosition, | |
54 | const wxSize& size = wxPyDefaultSize, | |
55 | long style = 0, | |
56 | const wxValidator& validator = wxPyDefaultValidator, | |
57 | char* name = "button"); | |
58 | void SetDefault(); | |
59 | }; | |
60 | ||
61 | //---------------------------------------------------------------------- | |
62 | ||
63 | class wxBitmapButton : public wxButton { | |
64 | public: | |
65 | wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, | |
66 | const wxPoint& pos = wxPyDefaultPosition, | |
67 | const wxSize& size = wxPyDefaultSize, | |
68 | long style = wxBU_AUTODRAW, | |
69 | const wxValidator& validator = wxPyDefaultValidator, | |
70 | char* name = "button"); | |
71 | ||
72 | wxBitmap& GetBitmapDisabled(); | |
73 | wxBitmap& GetBitmapFocus(); | |
74 | wxBitmap& GetBitmapLabel(); | |
75 | wxBitmap& GetBitmapSelected(); | |
76 | void SetBitmapDisabled(const wxBitmap& bitmap); | |
77 | void SetBitmapFocus(const wxBitmap& bitmap); | |
78 | void SetBitmapLabel(const wxBitmap& bitmap); | |
79 | void SetBitmapSelected(const wxBitmap& bitmap); | |
80 | ||
81 | }; | |
82 | ||
83 | //---------------------------------------------------------------------- | |
84 | ||
85 | class wxCheckBox : public wxControl { | |
86 | public: | |
87 | wxCheckBox(wxWindow* parent, wxWindowID id, const wxString& label, | |
88 | const wxPoint& pos = wxPyDefaultPosition, | |
89 | const wxSize& size = wxPyDefaultSize, | |
90 | long style = 0, | |
91 | const wxValidator& val = wxPyDefaultValidator, | |
92 | char* name = "checkBox"); | |
93 | ||
94 | bool GetValue(); | |
95 | void SetValue(const bool state); | |
96 | }; | |
97 | ||
98 | //---------------------------------------------------------------------- | |
99 | ||
100 | class wxChoice : public wxControl { | |
101 | public: | |
102 | wxChoice(wxWindow *parent, wxWindowID id, | |
103 | const wxPoint& pos = wxPyDefaultPosition, | |
104 | const wxSize& size = wxPyDefaultSize, | |
105 | int LCOUNT=0, wxString* LIST=NULL, | |
106 | long style = 0, | |
107 | const wxValidator& validator = wxPyDefaultValidator, | |
108 | char* name = "choice"); | |
109 | ||
110 | void Append(const wxString& item); | |
111 | void Clear(); | |
112 | int FindString(const wxString& string); | |
113 | int GetColumns(); | |
114 | int GetSelection(); | |
115 | wxString GetString(const int n); | |
116 | wxString GetStringSelection(); | |
117 | int Number(); | |
118 | void SetColumns(const int n = 1); | |
119 | void SetSelection(const int n); | |
120 | void SetStringSelection(const wxString& string); | |
121 | }; | |
122 | ||
123 | //---------------------------------------------------------------------- | |
124 | ||
125 | class wxComboBox : public wxControl { | |
126 | public: | |
127 | wxComboBox(wxWindow* parent, wxWindowID id, char* value = "", | |
128 | const wxPoint& pos = wxPyDefaultPosition, | |
129 | const wxSize& size = wxPyDefaultSize, | |
130 | int LCOUNT=0, wxString* LIST=NULL, | |
131 | long style = 0, | |
132 | const wxValidator& validator = wxPyDefaultValidator, | |
133 | char* name = "comboBox"); | |
134 | ||
135 | void Append(const wxString& item); | |
136 | // TODO: void Append(const wxString& item, char* clientData); | |
137 | void Clear(); | |
138 | void Copy(); | |
139 | void Cut(); | |
140 | void Delete(int n); | |
141 | // NotMember??: void Deselect(int n); | |
142 | int FindString(const wxString& string); | |
143 | // TODO: char* GetClientData(const int n); | |
144 | long GetInsertionPoint(); | |
145 | long GetLastPosition(); | |
146 | int GetSelection(); | |
147 | wxString GetString(int n); | |
148 | wxString GetStringSelection(); | |
149 | wxString GetValue(); | |
150 | int Number(); | |
151 | void Paste(); | |
152 | void Replace(long from, long to, const wxString& text); | |
153 | void Remove(long from, long to); | |
154 | // TODO: void SetClientData(const int n, char* data); | |
155 | void SetInsertionPoint(long pos); | |
156 | void SetInsertionPointEnd(); | |
157 | void SetSelection(int n, bool select = TRUE); | |
158 | %name(SetMark)void SetSelection(long from, long to); | |
159 | void SetValue(const wxString& text); | |
160 | }; | |
161 | ||
162 | //---------------------------------------------------------------------- | |
163 | ||
164 | class wxGauge : public wxControl { | |
165 | public: | |
166 | wxGauge(wxWindow* parent, wxWindowID id, int range, | |
167 | const wxPoint& pos = wxPyDefaultPosition, | |
168 | const wxSize& size = wxPyDefaultSize, | |
169 | long style = wxGA_HORIZONTAL, | |
170 | const wxValidator& validator = wxPyDefaultValidator, | |
171 | char* name = "gauge"); | |
172 | ||
173 | int GetBezelFace(); | |
174 | int GetRange(); | |
175 | int GetShadowWidth(); | |
176 | int GetValue(); | |
177 | void SetBezelFace(int width); | |
178 | void SetRange(int range); | |
179 | void SetShadowWidth(int width); | |
180 | void SetValue(int pos); | |
181 | }; | |
182 | ||
183 | //---------------------------------------------------------------------- | |
184 | ||
185 | class wxStaticBox : public wxControl { | |
186 | public: | |
187 | wxStaticBox(wxWindow* parent, wxWindowID id, const wxString& label, | |
188 | const wxPoint& pos = wxPyDefaultPosition, | |
189 | const wxSize& size = wxPyDefaultSize, | |
190 | long style = 0, | |
191 | char* name = "staticBox"); | |
192 | }; | |
193 | ||
194 | ||
195 | //---------------------------------------------------------------------- | |
196 | ||
197 | class wxStaticText : public wxControl { | |
198 | public: | |
199 | wxStaticText(wxWindow* parent, wxWindowID id, const wxString& label, | |
200 | const wxPoint& pos = wxPyDefaultPosition, | |
201 | const wxSize& size = wxPyDefaultSize, | |
202 | long style = 0, | |
203 | char* name = "staticText"); | |
204 | ||
205 | wxString GetLabel(); | |
206 | void SetLabel(const wxString& label); | |
207 | }; | |
208 | ||
209 | //---------------------------------------------------------------------- | |
210 | ||
211 | class wxListBox : public wxControl { | |
212 | public: | |
213 | wxListBox(wxWindow* parent, wxWindowID id, | |
214 | const wxPoint& pos = wxPyDefaultPosition, | |
215 | const wxSize& size = wxPyDefaultSize, | |
216 | int LCOUNT, wxString* LIST = NULL, | |
217 | long style = 0, | |
218 | const wxValidator& validator = wxPyDefaultValidator, | |
219 | char* name = "listBox"); | |
220 | ||
221 | void Append(const wxString& item); | |
222 | // TODO: void Append(const wxString& item, char* clientData); | |
223 | void Clear(); | |
224 | void Delete(int n); | |
225 | void Deselect(int n); | |
226 | int FindString(const wxString& string); | |
227 | // TODO: char* GetClientData(const int n); | |
228 | int GetSelection(); | |
229 | // TODO: int GetSelections(int **selections); | |
230 | wxString GetString(int n); | |
231 | wxString GetStringSelection(); | |
232 | int Number(); | |
233 | bool Selected(const int n); | |
234 | void Set(int LCOUNT, wxString* LIST); | |
235 | // TODO: void SetClientData(const int n, char* data); | |
236 | void SetFirstItem(int n); | |
237 | %name(SetFirstItemStr)void SetFirstItem(const wxString& string); | |
238 | void SetSelection(int n, bool select = TRUE); | |
239 | void SetString(int n, const wxString& string); | |
240 | void SetStringSelection(const wxString& string, bool select = TRUE); | |
241 | }; | |
242 | ||
243 | ||
244 | //---------------------------------------------------------------------- | |
245 | ||
246 | class wxTextCtrl : public wxControl { | |
247 | public: | |
248 | wxTextCtrl(wxWindow* parent, wxWindowID id, char* value = "", | |
249 | const wxPoint& pos = wxPyDefaultPosition, | |
250 | const wxSize& size = wxPyDefaultSize, | |
251 | long style = 0, | |
252 | const wxValidator& validator = wxPyDefaultValidator, | |
253 | char* name = "text"); | |
254 | ||
255 | void Clear(); | |
256 | void Copy(); | |
257 | void Cut(); | |
258 | void DiscardEdits(); | |
259 | long GetInsertionPoint(); | |
260 | long GetLastPosition(); | |
261 | int GetLineLength(long lineNo); | |
262 | wxString GetLineText(long lineNo); | |
263 | int GetNumberOfLines(); | |
264 | wxString GetValue(); | |
265 | bool IsModified(); | |
266 | bool LoadFile(const wxString& filename); | |
267 | void Paste(); | |
268 | void PositionToXY(long pos, long *OUTPUT, long *OUTPUT); | |
269 | void Remove(long from, long to); | |
270 | void Replace(long from, long to, const wxString& value); | |
271 | bool SaveFile(const wxString& filename); | |
272 | void SetEditable(bool editable); | |
273 | void SetInsertionPoint(long pos); | |
274 | void SetInsertionPointEnd(); | |
275 | void SetSelection(long from, long to); | |
276 | void SetValue(const wxString& value); | |
277 | void ShowPosition(long pos); | |
278 | void WriteText(const wxString& text); | |
279 | long XYToPosition(long x, long y); | |
280 | }; | |
281 | ||
282 | //---------------------------------------------------------------------- | |
283 | ||
284 | class wxScrollBar : public wxControl { | |
285 | public: | |
286 | wxScrollBar(wxWindow* parent, wxWindowID id = -1, | |
287 | const wxPoint& pos = wxPyDefaultPosition, | |
288 | const wxSize& size = wxPyDefaultSize, | |
289 | long style = wxSB_HORIZONTAL, | |
290 | const wxValidator& validator = wxPyDefaultValidator, | |
291 | char* name = "scrollBar"); | |
292 | ||
293 | int GetRange(); | |
294 | int GetPageSize(); | |
295 | int GetPosition(); | |
296 | int GetThumbSize(); | |
297 | void SetPosition(int viewStart); | |
298 | void SetScrollbar(int position, int thumbSize, | |
299 | int range, int pageSize, | |
300 | bool refresh = TRUE); | |
301 | }; | |
302 | ||
303 | //---------------------------------------------------------------------- | |
304 | ||
305 | class wxSpinButton : public wxControl { | |
306 | public: | |
307 | wxSpinButton(wxWindow* parent, wxWindowID id = -1, | |
308 | const wxPoint& pos = wxPyDefaultPosition, | |
309 | const wxSize& size = wxPyDefaultSize, | |
310 | long style = wxSP_HORIZONTAL, | |
311 | char* name = "spinButton"); | |
312 | ||
313 | int GetMax(); | |
314 | int GetMin(); | |
315 | int GetValue(); | |
316 | void SetRange(int min, int max); | |
317 | void SetValue(int value); | |
318 | }; | |
319 | ||
320 | //---------------------------------------------------------------------- | |
321 | ||
322 | class wxStaticBitmap : public wxControl { | |
323 | public: | |
324 | wxStaticBitmap(wxWindow* parent, wxWindowID id, | |
325 | const wxBitmap& bitmap, | |
326 | const wxPoint& pos = wxPyDefaultPosition, | |
327 | const wxSize& size = wxPyDefaultSize, | |
328 | long style = 0, | |
329 | char* name = "staticBitmap"); | |
330 | ||
331 | wxBitmap& GetBitmap(); | |
332 | void SetBitmap(const wxBitmap& bitmap); | |
333 | }; | |
334 | ||
335 | //---------------------------------------------------------------------- | |
336 | ||
337 | class wxRadioBox : public wxControl { | |
338 | public: | |
339 | wxRadioBox(wxWindow* parent, wxWindowID id, | |
340 | const wxString& label, | |
341 | const wxPoint& point = wxPyDefaultPosition, | |
342 | const wxSize& size = wxPyDefaultSize, | |
343 | int LCOUNT = 0, wxString* LIST = NULL, | |
344 | int majorDimension = 0, | |
345 | long style = wxRA_HORIZONTAL, | |
346 | const wxValidator& validator = wxPyDefaultValidator, | |
347 | char* name = "radioBox"); | |
348 | ||
349 | %name(EnableBox)void Enable(bool enable); | |
350 | void Enable(int n, bool enable); | |
351 | int FindString(const wxString& string); | |
352 | %name(GetBoxLabel)wxString GetLabel(); | |
353 | wxString GetLabel(int n); | |
354 | int GetSelection(); | |
355 | wxString GetString(int n); | |
356 | wxString GetStringSelection(); | |
357 | int Number(); | |
358 | %name(SetBoxLabel)void SetLabel(const wxString& label); | |
359 | void SetLabel(int n, const wxString& label); | |
360 | void SetSelection(int n); | |
361 | void SetStringSelection(const wxString& string); | |
362 | void Show(bool show); | |
363 | %name(ShowItem)void Show(int item, bool show); | |
364 | }; | |
365 | ||
366 | //---------------------------------------------------------------------- | |
367 | ||
368 | class wxRadioButton : public wxControl { | |
369 | public: | |
370 | wxRadioButton(wxWindow* parent, wxWindowID id, | |
371 | const wxString& label, | |
372 | const wxPoint& pos = wxPyDefaultPosition, | |
373 | const wxSize& size = wxPyDefaultSize, | |
374 | long style = 0, | |
375 | const wxValidator& validator = wxPyDefaultValidator, | |
376 | char* name = "radioButton"); | |
377 | ||
378 | bool GetValue(); | |
379 | void SetValue(bool value); | |
380 | }; | |
381 | ||
382 | //---------------------------------------------------------------------- | |
383 | ||
384 | class wxSlider : public wxControl { | |
385 | public: | |
386 | wxSlider(wxWindow* parent, wxWindowID id, | |
387 | int value, int minValue, int maxValue, | |
388 | const wxPoint& point = wxPyDefaultPosition, | |
389 | const wxSize& size = wxPyDefaultSize, | |
390 | long style = wxSL_HORIZONTAL, | |
391 | const wxValidator& validator = wxPyDefaultValidator, | |
392 | char* name = "slider"); | |
393 | ||
394 | void ClearSel(); | |
395 | void ClearTicks(); | |
396 | int GetLineSize(); | |
397 | int GetMax(); | |
398 | int GetMin(); | |
399 | int GetPageSize(); | |
400 | int GetSelEnd(); | |
401 | int GetSelStart(); | |
402 | int GetThumbLength(); | |
403 | int GetTickFreq(); | |
404 | int GetValue(); | |
405 | void SetRange(int minValue, int maxValue); | |
406 | void SetTickFreq(int n, int pos); | |
407 | void SetLineSize(int lineSize); | |
408 | void SetPageSize(int pageSize); | |
409 | void SetSelection(int startPos, int endPos); | |
410 | void SetThumbLength(int len); | |
411 | void SetTick(int tickPos); | |
412 | void SetValue(int value); | |
413 | }; | |
414 | ||
415 | ||
416 | //---------------------------------------------------------------------- | |
417 | ||
418 | ||
419 | ///////////////////////////////////////////////////////////////////////////// | |
420 | // | |
421 | // $Log$ | |
422 | // Revision 1.1 1998/08/09 08:25:49 RD | |
423 | // Initial version | |
424 | // | |
425 | // | |
426 |