]>
Commit | Line | Data |
---|---|---|
7bf85405 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: controls.i | |
3 | // Purpose: Control (widget) classes for wxPython | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 6/10/98 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 1998 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
03e9bead | 13 | %module controls |
7bf85405 | 14 | |
03e9bead | 15 | %{ |
7bf85405 RD |
16 | #include "helpers.h" |
17 | #include <wx/slider.h> | |
62bd0874 | 18 | #include <wx/spinbutt.h> |
f6bcfd97 | 19 | #include <wx/spinctrl.h> |
cf694132 | 20 | #include <wx/dynarray.h> |
8bf5d46e | 21 | #include <wx/statline.h> |
d1679124 | 22 | #include <wx/tglbtn.h> |
fb5e0af0 RD |
23 | |
24 | #ifdef __WXMSW__ | |
9c039d08 RD |
25 | #if wxUSE_OWNER_DRAWN |
26 | #include <wx/checklst.h> | |
27 | #endif | |
fb5e0af0 | 28 | #endif |
c95e68d8 RD |
29 | |
30 | #ifdef __WXGTK__ | |
31 | #include <wx/checklst.h> | |
32 | #endif | |
bb0054cd | 33 | |
7bf85405 RD |
34 | %} |
35 | ||
36 | //---------------------------------------------------------------------- | |
37 | ||
38 | %include typemaps.i | |
39 | %include my_typemaps.i | |
40 | ||
41 | // Import some definitions of other classes, etc. | |
42 | %import _defs.i | |
43 | %import misc.i | |
44 | %import windows.i | |
45 | %import gdi.i | |
46 | %import events.i | |
47 | ||
b8b8dda7 | 48 | %pragma(python) code = "import wx" |
9c039d08 | 49 | |
7bf85405 RD |
50 | //---------------------------------------------------------------------- |
51 | ||
2f90df85 RD |
52 | %readonly |
53 | wxValidator wxDefaultValidator; | |
54 | %readwrite | |
55 | ||
7bf85405 RD |
56 | //---------------------------------------------------------------------- |
57 | ||
58 | class wxControl : public wxWindow { | |
59 | public: | |
9b3d3bc4 RD |
60 | wxControl(wxWindow *parent, |
61 | wxWindowID id, | |
b68dc582 RD |
62 | const wxPoint& pos=wxDefaultPosition, |
63 | const wxSize& size=wxDefaultSize, | |
9b3d3bc4 | 64 | long style=0, |
b68dc582 | 65 | const wxValidator& validator=wxDefaultValidator, |
9b3d3bc4 | 66 | const char* name="control"); |
09f3d4e6 RD |
67 | %name(wxPreControl)wxControl(); |
68 | ||
69 | bool Create(wxWindow *parent, | |
70 | wxWindowID id, | |
71 | const wxPoint& pos=wxDefaultPosition, | |
72 | const wxSize& size=wxDefaultSize, | |
73 | long style=0, | |
74 | const wxValidator& validator=wxDefaultValidator, | |
75 | const char* name="control"); | |
9b3d3bc4 | 76 | |
6999b0d8 | 77 | |
7bf85405 | 78 | void Command(wxCommandEvent& event); |
fb5e0af0 | 79 | wxString GetLabel(); |
7bf85405 RD |
80 | void SetLabel(const wxString& label); |
81 | }; | |
82 | ||
6999b0d8 | 83 | |
7bf85405 RD |
84 | //---------------------------------------------------------------------- |
85 | ||
86 | class wxButton : public wxControl { | |
87 | public: | |
88 | wxButton(wxWindow* parent, wxWindowID id, const wxString& label, | |
b68dc582 RD |
89 | const wxPoint& pos = wxDefaultPosition, |
90 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 91 | long style = 0, |
b68dc582 | 92 | const wxValidator& validator = wxDefaultValidator, |
7bf85405 | 93 | char* name = "button"); |
09f3d4e6 RD |
94 | %name(wxPreButton)wxButton(); |
95 | ||
96 | bool Create(wxWindow* parent, wxWindowID id, const wxString& label, | |
97 | const wxPoint& pos = wxDefaultPosition, | |
98 | const wxSize& size = wxDefaultSize, | |
99 | long style = 0, | |
100 | const wxValidator& validator = wxDefaultValidator, | |
101 | char* name = "button"); | |
9c039d08 | 102 | |
9c039d08 | 103 | |
7bf85405 | 104 | void SetDefault(); |
9b3d3bc4 RD |
105 | void SetBackgroundColour(const wxColour& colour); |
106 | void SetForegroundColour(const wxColour& colour); | |
7bf85405 | 107 | |
09f3d4e6 RD |
108 | void SetImageLabel(const wxBitmap& bitmap); |
109 | void SetImageMargins(wxCoord x, wxCoord y); | |
6999b0d8 | 110 | |
09f3d4e6 RD |
111 | static wxSize GetDefaultSize(); |
112 | }; | |
6999b0d8 | 113 | |
7bf85405 RD |
114 | //---------------------------------------------------------------------- |
115 | ||
116 | class wxBitmapButton : public wxButton { | |
117 | public: | |
118 | wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, | |
b68dc582 RD |
119 | const wxPoint& pos = wxDefaultPosition, |
120 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 121 | long style = wxBU_AUTODRAW, |
b68dc582 | 122 | const wxValidator& validator = wxDefaultValidator, |
7bf85405 | 123 | char* name = "button"); |
09f3d4e6 RD |
124 | %name(wxPreBitmapButton)wxBitmapButton(); |
125 | ||
126 | bool Create(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, | |
127 | const wxPoint& pos = wxDefaultPosition, | |
128 | const wxSize& size = wxDefaultSize, | |
129 | long style = wxBU_AUTODRAW, | |
130 | const wxValidator& validator = wxDefaultValidator, | |
131 | char* name = "button"); | |
7bf85405 | 132 | |
9c039d08 | 133 | |
fb5e0af0 | 134 | wxBitmap& GetBitmapLabel(); |
7bf85405 RD |
135 | wxBitmap& GetBitmapDisabled(); |
136 | wxBitmap& GetBitmapFocus(); | |
7bf85405 RD |
137 | wxBitmap& GetBitmapSelected(); |
138 | void SetBitmapDisabled(const wxBitmap& bitmap); | |
139 | void SetBitmapFocus(const wxBitmap& bitmap); | |
7bf85405 | 140 | void SetBitmapSelected(const wxBitmap& bitmap); |
fb5e0af0 | 141 | void SetBitmapLabel(const wxBitmap& bitmap); |
7bf85405 | 142 | |
f6bcfd97 BP |
143 | void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; } |
144 | int GetMarginX() const { return m_marginX; } | |
145 | int GetMarginY() const { return m_marginY; } | |
7bf85405 RD |
146 | }; |
147 | ||
148 | //---------------------------------------------------------------------- | |
149 | ||
150 | class wxCheckBox : public wxControl { | |
151 | public: | |
152 | wxCheckBox(wxWindow* parent, wxWindowID id, const wxString& label, | |
b68dc582 RD |
153 | const wxPoint& pos = wxDefaultPosition, |
154 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 155 | long style = 0, |
b68dc582 | 156 | const wxValidator& val = wxDefaultValidator, |
7bf85405 | 157 | char* name = "checkBox"); |
09f3d4e6 RD |
158 | %name(wxPreCheckBox)wxCheckBox(); |
159 | ||
160 | bool Create(wxWindow* parent, wxWindowID id, const wxString& label, | |
161 | const wxPoint& pos = wxDefaultPosition, | |
162 | const wxSize& size = wxDefaultSize, | |
163 | long style = 0, | |
164 | const wxValidator& val = wxDefaultValidator, | |
165 | char* name = "checkBox"); | |
7bf85405 | 166 | |
9c039d08 | 167 | |
7bf85405 RD |
168 | bool GetValue(); |
169 | void SetValue(const bool state); | |
170 | }; | |
171 | ||
172 | //---------------------------------------------------------------------- | |
173 | ||
174 | class wxChoice : public wxControl { | |
175 | public: | |
176 | wxChoice(wxWindow *parent, wxWindowID id, | |
b68dc582 RD |
177 | const wxPoint& pos = wxDefaultPosition, |
178 | const wxSize& size = wxDefaultSize, | |
eec92d76 | 179 | int LCOUNT=0, wxString* choices=NULL, |
7bf85405 | 180 | long style = 0, |
b68dc582 | 181 | const wxValidator& validator = wxDefaultValidator, |
7bf85405 | 182 | char* name = "choice"); |
09f3d4e6 RD |
183 | %name(wxPreChoice)wxChoice(); |
184 | ||
185 | bool Create(wxWindow *parent, wxWindowID id, | |
186 | const wxPoint& pos = wxDefaultPosition, | |
187 | const wxSize& size = wxDefaultSize, | |
188 | int LCOUNT=0, wxString* choices=NULL, | |
189 | long style = 0, | |
190 | const wxValidator& validator = wxDefaultValidator, | |
191 | char* name = "choice"); | |
7bf85405 | 192 | |
9c039d08 | 193 | |
7bf85405 RD |
194 | void Append(const wxString& item); |
195 | void Clear(); | |
0adbc166 | 196 | void Delete(int n); |
7bf85405 RD |
197 | int FindString(const wxString& string); |
198 | int GetColumns(); | |
199 | int GetSelection(); | |
200 | wxString GetString(const int n); | |
201 | wxString GetStringSelection(); | |
0adbc166 | 202 | int GetCount(); |
7bf85405 RD |
203 | void SetColumns(const int n = 1); |
204 | void SetSelection(const int n); | |
205 | void SetStringSelection(const wxString& string); | |
0adbc166 RD |
206 | void SetString(int n, const wxString& s); |
207 | ||
208 | %pragma(python) addtoclass = " | |
209 | Number = GetCount | |
210 | Select = SetSelection | |
211 | " | |
212 | ||
7bf85405 RD |
213 | }; |
214 | ||
215 | //---------------------------------------------------------------------- | |
216 | ||
bb0054cd | 217 | class wxComboBox : public wxChoice { |
7bf85405 RD |
218 | public: |
219 | wxComboBox(wxWindow* parent, wxWindowID id, char* value = "", | |
b68dc582 RD |
220 | const wxPoint& pos = wxDefaultPosition, |
221 | const wxSize& size = wxDefaultSize, | |
eec92d76 | 222 | int LCOUNT=0, wxString* choices=NULL, |
7bf85405 | 223 | long style = 0, |
b68dc582 | 224 | const wxValidator& validator = wxDefaultValidator, |
7bf85405 | 225 | char* name = "comboBox"); |
09f3d4e6 RD |
226 | %name(wxPreComboBox)wxComboBox(); |
227 | ||
228 | bool Create(wxWindow* parent, wxWindowID id, char* value = "", | |
229 | const wxPoint& pos = wxDefaultPosition, | |
230 | const wxSize& size = wxDefaultSize, | |
231 | int LCOUNT=0, wxString* choices=NULL, | |
232 | long style = 0, | |
233 | const wxValidator& validator = wxDefaultValidator, | |
234 | char* name = "comboBox"); | |
7bf85405 | 235 | |
9c039d08 | 236 | |
7bf85405 RD |
237 | void Append(const wxString& item); |
238 | // TODO: void Append(const wxString& item, char* clientData); | |
239 | void Clear(); | |
240 | void Copy(); | |
241 | void Cut(); | |
242 | void Delete(int n); | |
243 | // NotMember??: void Deselect(int n); | |
244 | int FindString(const wxString& string); | |
245 | // TODO: char* GetClientData(const int n); | |
246 | long GetInsertionPoint(); | |
247 | long GetLastPosition(); | |
248 | int GetSelection(); | |
249 | wxString GetString(int n); | |
250 | wxString GetStringSelection(); | |
251 | wxString GetValue(); | |
7bf85405 RD |
252 | void Paste(); |
253 | void Replace(long from, long to, const wxString& text); | |
254 | void Remove(long from, long to); | |
255 | // TODO: void SetClientData(const int n, char* data); | |
256 | void SetInsertionPoint(long pos); | |
257 | void SetInsertionPointEnd(); | |
1d99702e | 258 | void SetSelection(int n); |
7bf85405 RD |
259 | %name(SetMark)void SetSelection(long from, long to); |
260 | void SetValue(const wxString& text); | |
0adbc166 | 261 | void SetEditable(bool editable); |
7bf85405 RD |
262 | }; |
263 | ||
264 | //---------------------------------------------------------------------- | |
265 | ||
266 | class wxGauge : public wxControl { | |
267 | public: | |
268 | wxGauge(wxWindow* parent, wxWindowID id, int range, | |
b68dc582 RD |
269 | const wxPoint& pos = wxDefaultPosition, |
270 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 271 | long style = wxGA_HORIZONTAL, |
b68dc582 | 272 | const wxValidator& validator = wxDefaultValidator, |
7bf85405 | 273 | char* name = "gauge"); |
09f3d4e6 RD |
274 | %name(wxPreGauge)wxGauge(); |
275 | ||
276 | bool Create(wxWindow* parent, wxWindowID id, int range, | |
277 | const wxPoint& pos = wxDefaultPosition, | |
278 | const wxSize& size = wxDefaultSize, | |
279 | long style = wxGA_HORIZONTAL, | |
280 | const wxValidator& validator = wxDefaultValidator, | |
281 | char* name = "gauge"); | |
7bf85405 | 282 | |
9c039d08 | 283 | |
7bf85405 RD |
284 | int GetBezelFace(); |
285 | int GetRange(); | |
286 | int GetShadowWidth(); | |
287 | int GetValue(); | |
288 | void SetBezelFace(int width); | |
289 | void SetRange(int range); | |
290 | void SetShadowWidth(int width); | |
291 | void SetValue(int pos); | |
292 | }; | |
293 | ||
294 | //---------------------------------------------------------------------- | |
295 | ||
296 | class wxStaticBox : public wxControl { | |
297 | public: | |
298 | wxStaticBox(wxWindow* parent, wxWindowID id, const wxString& label, | |
b68dc582 RD |
299 | const wxPoint& pos = wxDefaultPosition, |
300 | const wxSize& size = wxDefaultSize, | |
7bf85405 RD |
301 | long style = 0, |
302 | char* name = "staticBox"); | |
09f3d4e6 RD |
303 | %name(wxPreStaticBox)wxStaticBox(); |
304 | ||
305 | bool Create(wxWindow* parent, wxWindowID id, const wxString& label, | |
306 | const wxPoint& pos = wxDefaultPosition, | |
307 | const wxSize& size = wxDefaultSize, | |
308 | long style = 0, | |
309 | char* name = "staticBox"); | |
7bf85405 RD |
310 | }; |
311 | ||
312 | ||
bb0054cd RD |
313 | //---------------------------------------------------------------------- |
314 | ||
8bf5d46e | 315 | |
bb0054cd RD |
316 | class wxStaticLine : public wxControl { |
317 | public: | |
318 | wxStaticLine( wxWindow *parent, wxWindowID id, | |
b68dc582 RD |
319 | const wxPoint &pos = wxDefaultPosition, |
320 | const wxSize &size = wxDefaultSize, | |
bb0054cd | 321 | long style = wxLI_HORIZONTAL, |
d24a34bb | 322 | const char* name = "staticLine" ); |
09f3d4e6 RD |
323 | %name(wxPreStaticLine)wxStaticLine(); |
324 | ||
325 | bool Create( wxWindow *parent, wxWindowID id, | |
326 | const wxPoint &pos = wxDefaultPosition, | |
327 | const wxSize &size = wxDefaultSize, | |
328 | long style = wxLI_HORIZONTAL, | |
329 | const char* name = "staticLine" ); | |
bb0054cd | 330 | }; |
8bf5d46e | 331 | |
bb0054cd | 332 | |
7bf85405 RD |
333 | //---------------------------------------------------------------------- |
334 | ||
335 | class wxStaticText : public wxControl { | |
336 | public: | |
337 | wxStaticText(wxWindow* parent, wxWindowID id, const wxString& label, | |
b68dc582 RD |
338 | const wxPoint& pos = wxDefaultPosition, |
339 | const wxSize& size = wxDefaultSize, | |
7bf85405 RD |
340 | long style = 0, |
341 | char* name = "staticText"); | |
09f3d4e6 RD |
342 | %name(wxPreStaticText)wxStaticText(); |
343 | ||
344 | bool Create(wxWindow* parent, wxWindowID id, const wxString& label, | |
345 | const wxPoint& pos = wxDefaultPosition, | |
346 | const wxSize& size = wxDefaultSize, | |
347 | long style = 0, | |
348 | char* name = "staticText"); | |
7bf85405 | 349 | |
9c039d08 | 350 | |
7bf85405 RD |
351 | wxString GetLabel(); |
352 | void SetLabel(const wxString& label); | |
353 | }; | |
354 | ||
355 | //---------------------------------------------------------------------- | |
356 | ||
357 | class wxListBox : public wxControl { | |
358 | public: | |
359 | wxListBox(wxWindow* parent, wxWindowID id, | |
b68dc582 RD |
360 | const wxPoint& pos = wxDefaultPosition, |
361 | const wxSize& size = wxDefaultSize, | |
eec92d76 | 362 | int LCOUNT, wxString* choices = NULL, |
7bf85405 | 363 | long style = 0, |
b68dc582 | 364 | const wxValidator& validator = wxDefaultValidator, |
7bf85405 | 365 | char* name = "listBox"); |
09f3d4e6 RD |
366 | %name(wxPreListBox)wxListBox(); |
367 | ||
368 | bool Create(wxWindow* parent, wxWindowID id, | |
369 | const wxPoint& pos = wxDefaultPosition, | |
370 | const wxSize& size = wxDefaultSize, | |
371 | int LCOUNT, wxString* choices = NULL, | |
372 | long style = 0, | |
373 | const wxValidator& validator = wxDefaultValidator, | |
374 | char* name = "listBox"); | |
7bf85405 | 375 | |
9c039d08 | 376 | |
7bf85405 RD |
377 | void Append(const wxString& item); |
378 | // TODO: void Append(const wxString& item, char* clientData); | |
379 | void Clear(); | |
380 | void Delete(int n); | |
381 | void Deselect(int n); | |
382 | int FindString(const wxString& string); | |
383 | // TODO: char* GetClientData(const int n); | |
384 | int GetSelection(); | |
cf694132 RD |
385 | |
386 | // int GetSelections(int **selections); | |
387 | %addmethods { | |
388 | PyObject* GetSelections() { | |
389 | wxArrayInt lst; | |
390 | self->GetSelections(lst); | |
391 | PyObject *tup = PyTuple_New(lst.GetCount()); | |
f6bcfd97 | 392 | for(size_t i=0; i<lst.GetCount(); i++) { |
cf694132 RD |
393 | PyTuple_SetItem(tup, i, PyInt_FromLong(lst[i])); |
394 | } | |
395 | return tup; | |
396 | } | |
397 | } | |
398 | ||
eec92d76 | 399 | void InsertItems(int LCOUNT, wxString* choices, int pos); |
2f90df85 | 400 | |
7bf85405 RD |
401 | wxString GetString(int n); |
402 | wxString GetStringSelection(); | |
0adbc166 RD |
403 | int GetCount(); |
404 | %pragma(python) addtoclass = "Number = GetCount" | |
405 | bool IsSelected(const int n); | |
7bf85405 | 406 | bool Selected(const int n); |
eec92d76 | 407 | void Set(int LCOUNT, wxString* choices); |
7bf85405 RD |
408 | // TODO: void SetClientData(const int n, char* data); |
409 | void SetFirstItem(int n); | |
410 | %name(SetFirstItemStr)void SetFirstItem(const wxString& string); | |
411 | void SetSelection(int n, bool select = TRUE); | |
412 | void SetString(int n, const wxString& string); | |
413 | void SetStringSelection(const wxString& string, bool select = TRUE); | |
414 | }; | |
415 | ||
416 | ||
9c039d08 RD |
417 | //---------------------------------------------------------------------- |
418 | ||
9c039d08 RD |
419 | class wxCheckListBox : public wxListBox { |
420 | public: | |
421 | wxCheckListBox(wxWindow *parent, wxWindowID id, | |
b68dc582 RD |
422 | const wxPoint& pos = wxDefaultPosition, |
423 | const wxSize& size = wxDefaultSize, | |
9c039d08 | 424 | int LCOUNT = 0, |
eec92d76 | 425 | wxString* choices = NULL, |
9c039d08 | 426 | long style = 0, |
b68dc582 | 427 | const wxValidator& validator = wxDefaultValidator, |
9c039d08 | 428 | char* name = "listBox"); |
09f3d4e6 RD |
429 | %name(wxPreCheckListBox)wxCheckListBox(); |
430 | ||
431 | bool Create(wxWindow *parent, wxWindowID id, | |
432 | const wxPoint& pos = wxDefaultPosition, | |
433 | const wxSize& size = wxDefaultSize, | |
434 | int LCOUNT = 0, | |
435 | wxString* choices = NULL, | |
436 | long style = 0, | |
437 | const wxValidator& validator = wxDefaultValidator, | |
438 | char* name = "listBox"); | |
9c039d08 | 439 | |
9c039d08 RD |
440 | |
441 | bool IsChecked(int uiIndex); | |
694759cf | 442 | void Check(int uiIndex, int bCheck = TRUE); |
eec92d76 | 443 | void InsertItems(int LCOUNT, wxString* choices, int pos); |
9c039d08 RD |
444 | |
445 | int GetItemHeight(); | |
446 | }; | |
9c039d08 | 447 | |
7bf85405 RD |
448 | //---------------------------------------------------------------------- |
449 | ||
d56cebe7 RD |
450 | |
451 | class wxTextAttr | |
452 | { | |
453 | public: | |
454 | // ctors | |
455 | wxTextAttr(const wxColour& colText = wxNullColour, | |
456 | const wxColour& colBack = wxNullColour, | |
457 | const wxFont& font = wxNullFont); | |
458 | ~wxTextAttr(); | |
459 | ||
460 | // setters | |
461 | void SetTextColour(const wxColour& colText); | |
462 | void SetBackgroundColour(const wxColour& colBack); | |
463 | void SetFont(const wxFont& font); | |
464 | ||
465 | // accessors | |
466 | bool HasTextColour() const; | |
467 | bool HasBackgroundColour() const; | |
468 | bool HasFont() const; | |
469 | ||
470 | const wxColour& GetTextColour() const; | |
471 | const wxColour& GetBackgroundColour() const; | |
472 | const wxFont& GetFont() const; | |
473 | }; | |
474 | ||
475 | ||
476 | ||
7bf85405 RD |
477 | class wxTextCtrl : public wxControl { |
478 | public: | |
479 | wxTextCtrl(wxWindow* parent, wxWindowID id, char* value = "", | |
b68dc582 RD |
480 | const wxPoint& pos = wxDefaultPosition, |
481 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 482 | long style = 0, |
b68dc582 | 483 | const wxValidator& validator = wxDefaultValidator, |
7bf85405 | 484 | char* name = "text"); |
09f3d4e6 RD |
485 | %name(wxPreTextCtrl)wxTextCtrl(); |
486 | ||
487 | bool Create(wxWindow* parent, wxWindowID id, char* value = "", | |
488 | const wxPoint& pos = wxDefaultPosition, | |
489 | const wxSize& size = wxDefaultSize, | |
490 | long style = 0, | |
491 | const wxValidator& validator = wxDefaultValidator, | |
492 | char* name = "text"); | |
7bf85405 | 493 | |
9c039d08 | 494 | |
7bf85405 RD |
495 | void Clear(); |
496 | void Copy(); | |
497 | void Cut(); | |
498 | void DiscardEdits(); | |
499 | long GetInsertionPoint(); | |
500 | long GetLastPosition(); | |
501 | int GetLineLength(long lineNo); | |
502 | wxString GetLineText(long lineNo); | |
503 | int GetNumberOfLines(); | |
504 | wxString GetValue(); | |
505 | bool IsModified(); | |
506 | bool LoadFile(const wxString& filename); | |
507 | void Paste(); | |
508 | void PositionToXY(long pos, long *OUTPUT, long *OUTPUT); | |
509 | void Remove(long from, long to); | |
510 | void Replace(long from, long to, const wxString& value); | |
511 | bool SaveFile(const wxString& filename); | |
512 | void SetEditable(bool editable); | |
513 | void SetInsertionPoint(long pos); | |
514 | void SetInsertionPointEnd(); | |
515 | void SetSelection(long from, long to); | |
516 | void SetValue(const wxString& value); | |
517 | void ShowPosition(long pos); | |
518 | void WriteText(const wxString& text); | |
cf694132 | 519 | void AppendText(const wxString& text); |
7bf85405 | 520 | long XYToPosition(long x, long y); |
d403febc RD |
521 | |
522 | bool CanCopy(); | |
523 | bool CanCut(); | |
524 | bool CanPaste(); | |
525 | bool CanRedo(); | |
526 | bool CanUndo(); | |
527 | void GetSelection(long* OUTPUT, long* OUTPUT); | |
528 | bool IsEditable(); | |
b1462dfa RD |
529 | void Undo(); |
530 | void Redo(); | |
531 | ||
d56cebe7 RD |
532 | bool SetStyle(long start, long end, const wxTextAttr& style); |
533 | bool SetDefaultStyle(const wxTextAttr& style); | |
534 | const wxTextAttr& GetDefaultStyle() const; | |
535 | ||
00b6c4e3 RD |
536 | void SetMaxLength(unsigned long len); |
537 | ||
b1462dfa RD |
538 | %addmethods { |
539 | void write(const wxString& text) { | |
d56cebe7 | 540 | self->AppendText(text); |
b1462dfa RD |
541 | } |
542 | } | |
7bf85405 RD |
543 | }; |
544 | ||
545 | //---------------------------------------------------------------------- | |
546 | ||
547 | class wxScrollBar : public wxControl { | |
548 | public: | |
549 | wxScrollBar(wxWindow* parent, wxWindowID id = -1, | |
b68dc582 RD |
550 | const wxPoint& pos = wxDefaultPosition, |
551 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 552 | long style = wxSB_HORIZONTAL, |
b68dc582 | 553 | const wxValidator& validator = wxDefaultValidator, |
7bf85405 | 554 | char* name = "scrollBar"); |
09f3d4e6 RD |
555 | %name(wxPreScrollBar)wxScrollBar(); |
556 | ||
557 | bool Create(wxWindow* parent, wxWindowID id = -1, | |
558 | const wxPoint& pos = wxDefaultPosition, | |
559 | const wxSize& size = wxDefaultSize, | |
560 | long style = wxSB_HORIZONTAL, | |
561 | const wxValidator& validator = wxDefaultValidator, | |
562 | char* name = "scrollBar"); | |
7bf85405 | 563 | |
9c039d08 | 564 | |
7bf85405 RD |
565 | int GetRange(); |
566 | int GetPageSize(); | |
b8b8dda7 | 567 | int GetThumbPosition(); |
7bf85405 | 568 | int GetThumbSize(); |
26b9cf27 | 569 | %name(GetThumbLength) int GetThumbSize(); // to match the docs |
b8b8dda7 | 570 | void SetThumbPosition(int viewStart); |
7bf85405 RD |
571 | void SetScrollbar(int position, int thumbSize, |
572 | int range, int pageSize, | |
573 | bool refresh = TRUE); | |
574 | }; | |
575 | ||
576 | //---------------------------------------------------------------------- | |
577 | ||
578 | class wxSpinButton : public wxControl { | |
579 | public: | |
580 | wxSpinButton(wxWindow* parent, wxWindowID id = -1, | |
b68dc582 RD |
581 | const wxPoint& pos = wxDefaultPosition, |
582 | const wxSize& size = wxDefaultSize, | |
7bf85405 RD |
583 | long style = wxSP_HORIZONTAL, |
584 | char* name = "spinButton"); | |
09f3d4e6 RD |
585 | %name(wxPreSpinButton)wxSpinButton(); |
586 | ||
587 | bool Create(wxWindow* parent, wxWindowID id = -1, | |
588 | const wxPoint& pos = wxDefaultPosition, | |
589 | const wxSize& size = wxDefaultSize, | |
590 | long style = wxSP_HORIZONTAL, | |
591 | char* name = "spinButton"); | |
7bf85405 RD |
592 | |
593 | int GetMax(); | |
594 | int GetMin(); | |
595 | int GetValue(); | |
596 | void SetRange(int min, int max); | |
597 | void SetValue(int value); | |
598 | }; | |
599 | ||
600 | //---------------------------------------------------------------------- | |
601 | ||
602 | class wxStaticBitmap : public wxControl { | |
603 | public: | |
604 | wxStaticBitmap(wxWindow* parent, wxWindowID id, | |
605 | const wxBitmap& bitmap, | |
b68dc582 RD |
606 | const wxPoint& pos = wxDefaultPosition, |
607 | const wxSize& size = wxDefaultSize, | |
7bf85405 RD |
608 | long style = 0, |
609 | char* name = "staticBitmap"); | |
09f3d4e6 RD |
610 | %name(wxPreStaticBitmap)wxStaticBitmap(); |
611 | ||
612 | bool Create(wxWindow* parent, wxWindowID id, | |
613 | const wxBitmap& bitmap, | |
614 | const wxPoint& pos = wxDefaultPosition, | |
615 | const wxSize& size = wxDefaultSize, | |
616 | long style = 0, | |
617 | char* name = "staticBitmap"); | |
7bf85405 | 618 | |
9c039d08 | 619 | |
cf694132 | 620 | const wxBitmap& GetBitmap(); |
7bf85405 | 621 | void SetBitmap(const wxBitmap& bitmap); |
8bf5d46e | 622 | void SetIcon(const wxIcon& icon); |
7bf85405 RD |
623 | }; |
624 | ||
625 | //---------------------------------------------------------------------- | |
626 | ||
627 | class wxRadioBox : public wxControl { | |
628 | public: | |
629 | wxRadioBox(wxWindow* parent, wxWindowID id, | |
630 | const wxString& label, | |
b68dc582 RD |
631 | const wxPoint& point = wxDefaultPosition, |
632 | const wxSize& size = wxDefaultSize, | |
eec92d76 | 633 | int LCOUNT = 0, wxString* choices = NULL, |
7bf85405 RD |
634 | int majorDimension = 0, |
635 | long style = wxRA_HORIZONTAL, | |
b68dc582 | 636 | const wxValidator& validator = wxDefaultValidator, |
7bf85405 | 637 | char* name = "radioBox"); |
09f3d4e6 RD |
638 | %name(wxPreRadioBox)wxRadioBox(); |
639 | ||
640 | bool Create(wxWindow* parent, wxWindowID id, | |
641 | const wxString& label, | |
642 | const wxPoint& point = wxDefaultPosition, | |
643 | const wxSize& size = wxDefaultSize, | |
644 | int LCOUNT = 0, wxString* choices = NULL, | |
645 | int majorDimension = 0, | |
646 | long style = wxRA_HORIZONTAL, | |
647 | const wxValidator& validator = wxDefaultValidator, | |
648 | char* name = "radioBox"); | |
7bf85405 | 649 | |
9c039d08 | 650 | |
0699c864 RD |
651 | void Enable(bool enable); |
652 | %name(EnableItem)void Enable(int n, bool enable); | |
7bf85405 | 653 | int FindString(const wxString& string); |
bb0054cd | 654 | |
7bf85405 | 655 | wxString GetString(int n); |
2c8a649d RD |
656 | |
657 | #ifdef __WXMSW__ | |
0adbc166 RD |
658 | void SetString(int n, const wxString& label); |
659 | %pragma(python) addtoclass = " | |
660 | GetItemLabel = GetString | |
661 | SetItemLabel = SetString | |
662 | " | |
2c8a649d RD |
663 | int GetColumnCount(); |
664 | int GetRowCount(); | |
665 | #else | |
666 | %name(GetItemLabel)wxString GetLabel( int item ); | |
667 | %name(SetItemLabel)void SetLabel( int item, const wxString& label ); | |
668 | #endif | |
669 | ||
0adbc166 | 670 | int GetSelection(); |
7bf85405 | 671 | wxString GetStringSelection(); |
0adbc166 RD |
672 | int GetCount(); |
673 | %pragma(python) addtoclass = "Number = GetCount" | |
674 | ||
7bf85405 RD |
675 | void SetSelection(int n); |
676 | void SetStringSelection(const wxString& string); | |
677 | void Show(bool show); | |
678 | %name(ShowItem)void Show(int item, bool show); | |
679 | }; | |
680 | ||
681 | //---------------------------------------------------------------------- | |
682 | ||
683 | class wxRadioButton : public wxControl { | |
684 | public: | |
685 | wxRadioButton(wxWindow* parent, wxWindowID id, | |
686 | const wxString& label, | |
b68dc582 RD |
687 | const wxPoint& pos = wxDefaultPosition, |
688 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 689 | long style = 0, |
b68dc582 | 690 | const wxValidator& validator = wxDefaultValidator, |
7bf85405 | 691 | char* name = "radioButton"); |
09f3d4e6 RD |
692 | %name(wxPreRadioButton)wxRadioButton(); |
693 | ||
694 | bool Create(wxWindow* parent, wxWindowID id, | |
695 | const wxString& label, | |
696 | const wxPoint& pos = wxDefaultPosition, | |
697 | const wxSize& size = wxDefaultSize, | |
698 | long style = 0, | |
699 | const wxValidator& validator = wxDefaultValidator, | |
700 | char* name = "radioButton"); | |
7bf85405 | 701 | |
9c039d08 | 702 | |
7bf85405 RD |
703 | bool GetValue(); |
704 | void SetValue(bool value); | |
705 | }; | |
706 | ||
707 | //---------------------------------------------------------------------- | |
708 | ||
709 | class wxSlider : public wxControl { | |
710 | public: | |
711 | wxSlider(wxWindow* parent, wxWindowID id, | |
712 | int value, int minValue, int maxValue, | |
b68dc582 RD |
713 | const wxPoint& point = wxDefaultPosition, |
714 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 715 | long style = wxSL_HORIZONTAL, |
b68dc582 | 716 | const wxValidator& validator = wxDefaultValidator, |
7bf85405 | 717 | char* name = "slider"); |
09f3d4e6 RD |
718 | %name(wxPreSlider)wxSlider(); |
719 | ||
720 | bool Create(wxWindow* parent, wxWindowID id, | |
721 | int value, int minValue, int maxValue, | |
722 | const wxPoint& point = wxDefaultPosition, | |
723 | const wxSize& size = wxDefaultSize, | |
724 | long style = wxSL_HORIZONTAL, | |
725 | const wxValidator& validator = wxDefaultValidator, | |
726 | char* name = "slider"); | |
7bf85405 | 727 | |
9c039d08 | 728 | |
7bf85405 RD |
729 | void ClearSel(); |
730 | void ClearTicks(); | |
731 | int GetLineSize(); | |
732 | int GetMax(); | |
733 | int GetMin(); | |
734 | int GetPageSize(); | |
735 | int GetSelEnd(); | |
736 | int GetSelStart(); | |
737 | int GetThumbLength(); | |
738 | int GetTickFreq(); | |
739 | int GetValue(); | |
740 | void SetRange(int minValue, int maxValue); | |
741 | void SetTickFreq(int n, int pos); | |
742 | void SetLineSize(int lineSize); | |
743 | void SetPageSize(int pageSize); | |
744 | void SetSelection(int startPos, int endPos); | |
745 | void SetThumbLength(int len); | |
746 | void SetTick(int tickPos); | |
747 | void SetValue(int value); | |
748 | }; | |
749 | ||
750 | ||
751 | //---------------------------------------------------------------------- | |
752 | ||
f6bcfd97 BP |
753 | class wxSpinCtrl : public wxSpinButton { |
754 | public: | |
755 | wxSpinCtrl(wxWindow *parent, | |
756 | wxWindowID id = -1, | |
757 | const char* value = "", | |
b68dc582 RD |
758 | const wxPoint& pos = wxDefaultPosition, |
759 | const wxSize& size = wxDefaultSize, | |
f6bcfd97 BP |
760 | long style = wxSP_ARROW_KEYS, |
761 | int min = 0, int max = 100, int initial = 0, | |
762 | const char* name = "wxSpinCtrl"); | |
09f3d4e6 RD |
763 | %name(wxPreSpinCtrl)wxSpinCtrl(); |
764 | ||
765 | bool Create(wxWindow *parent, | |
766 | wxWindowID id = -1, | |
767 | const char* value = "", | |
768 | const wxPoint& pos = wxDefaultPosition, | |
769 | const wxSize& size = wxDefaultSize, | |
770 | long style = wxSP_ARROW_KEYS, | |
771 | int min = 0, int max = 100, int initial = 0, | |
772 | const char* name = "wxSpinCtrl"); | |
f6bcfd97 BP |
773 | |
774 | ||
c368d904 RD |
775 | int GetMax(); |
776 | int GetMin(); | |
777 | int GetValue(); | |
778 | void SetRange(int min, int max); | |
779 | void SetValue(int value); | |
780 | ||
f6bcfd97 BP |
781 | }; |
782 | ||
783 | ||
784 | //---------------------------------------------------------------------- | |
785 | ||
d1679124 RD |
786 | enum { wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, }; |
787 | ||
788 | class wxToggleButton : public wxControl { | |
789 | public: | |
790 | wxToggleButton(wxWindow *parent, | |
791 | wxWindowID id, | |
792 | const wxString& label, | |
793 | const wxPoint& pos = wxDefaultPosition, | |
794 | const wxSize& size = wxDefaultSize, | |
795 | long style = 0, | |
796 | const wxValidator& validator = wxDefaultValidator, | |
797 | const char* name = "toggle"); | |
09f3d4e6 RD |
798 | %name(wxPreToggleButton)wxToggleButton(); |
799 | ||
800 | bool Create(wxWindow *parent, | |
801 | wxWindowID id, | |
802 | const wxString& label, | |
803 | const wxPoint& pos = wxDefaultPosition, | |
804 | const wxSize& size = wxDefaultSize, | |
805 | long style = 0, | |
806 | const wxValidator& validator = wxDefaultValidator, | |
807 | const char* name = "toggle"); | |
d1679124 RD |
808 | |
809 | void SetValue(bool value); | |
810 | bool GetValue() const ; | |
811 | void SetLabel(const wxString& label); | |
812 | ||
813 | }; | |
814 | ||
815 | //---------------------------------------------------------------------- | |
816 | //---------------------------------------------------------------------- | |
817 | //---------------------------------------------------------------------- | |
818 | ||
c368d904 RD |
819 | |
820 |