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