]>
Commit | Line | Data |
---|---|---|
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 | ||
13 | %module controls | |
14 | ||
15 | %{ | |
16 | #include "helpers.h" | |
17 | #include <wx/slider.h> | |
18 | #include <wx/spinbutt.h> | |
19 | #include <wx/spinctrl.h> | |
20 | #include <wx/dynarray.h> | |
21 | #include <wx/statline.h> | |
22 | #include <wx/tglbtn.h> | |
23 | ||
24 | #ifdef __WXMSW__ | |
25 | #if wxUSE_OWNER_DRAWN | |
26 | #include <wx/checklst.h> | |
27 | #endif | |
28 | #endif | |
29 | ||
30 | #ifdef __WXGTK__ | |
31 | #include <wx/checklst.h> | |
32 | #endif | |
33 | ||
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 | ||
48 | %pragma(python) code = "import wx" | |
49 | ||
50 | //---------------------------------------------------------------------- | |
51 | ||
52 | %readonly | |
53 | wxValidator wxDefaultValidator; | |
54 | %readwrite | |
55 | ||
56 | //---------------------------------------------------------------------- | |
57 | ||
58 | class wxControl : public wxWindow { | |
59 | public: | |
60 | wxControl(wxWindow *parent, | |
61 | wxWindowID id, | |
62 | const wxPoint& pos=wxDefaultPosition, | |
63 | const wxSize& size=wxDefaultSize, | |
64 | long style=0, | |
65 | const wxValidator& validator=wxDefaultValidator, | |
66 | const char* name="control"); | |
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"); | |
76 | ||
77 | ||
78 | void Command(wxCommandEvent& event); | |
79 | wxString GetLabel(); | |
80 | void SetLabel(const wxString& label); | |
81 | }; | |
82 | ||
83 | ||
84 | //---------------------------------------------------------------------- | |
85 | ||
86 | class wxButton : public wxControl { | |
87 | public: | |
88 | wxButton(wxWindow* parent, wxWindowID id, const wxString& label, | |
89 | const wxPoint& pos = wxDefaultPosition, | |
90 | const wxSize& size = wxDefaultSize, | |
91 | long style = 0, | |
92 | const wxValidator& validator = wxDefaultValidator, | |
93 | char* name = "button"); | |
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"); | |
102 | ||
103 | ||
104 | void SetDefault(); | |
105 | void SetBackgroundColour(const wxColour& colour); | |
106 | void SetForegroundColour(const wxColour& colour); | |
107 | ||
108 | void SetImageLabel(const wxBitmap& bitmap); | |
109 | void SetImageMargins(wxCoord x, wxCoord y); | |
110 | ||
111 | static wxSize GetDefaultSize(); | |
112 | }; | |
113 | ||
114 | //---------------------------------------------------------------------- | |
115 | ||
116 | class wxBitmapButton : public wxButton { | |
117 | public: | |
118 | wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, | |
119 | const wxPoint& pos = wxDefaultPosition, | |
120 | const wxSize& size = wxDefaultSize, | |
121 | long style = wxBU_AUTODRAW, | |
122 | const wxValidator& validator = wxDefaultValidator, | |
123 | char* name = "button"); | |
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"); | |
132 | ||
133 | ||
134 | wxBitmap& GetBitmapLabel(); | |
135 | wxBitmap& GetBitmapDisabled(); | |
136 | wxBitmap& GetBitmapFocus(); | |
137 | wxBitmap& GetBitmapSelected(); | |
138 | void SetBitmapDisabled(const wxBitmap& bitmap); | |
139 | void SetBitmapFocus(const wxBitmap& bitmap); | |
140 | void SetBitmapSelected(const wxBitmap& bitmap); | |
141 | void SetBitmapLabel(const wxBitmap& bitmap); | |
142 | ||
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; } | |
146 | }; | |
147 | ||
148 | //---------------------------------------------------------------------- | |
149 | ||
150 | class wxCheckBox : public wxControl { | |
151 | public: | |
152 | wxCheckBox(wxWindow* parent, wxWindowID id, const wxString& label, | |
153 | const wxPoint& pos = wxDefaultPosition, | |
154 | const wxSize& size = wxDefaultSize, | |
155 | long style = 0, | |
156 | const wxValidator& val = wxDefaultValidator, | |
157 | char* name = "checkBox"); | |
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"); | |
166 | ||
167 | ||
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, | |
177 | const wxPoint& pos = wxDefaultPosition, | |
178 | const wxSize& size = wxDefaultSize, | |
179 | int LCOUNT=0, wxString* choices=NULL, | |
180 | long style = 0, | |
181 | const wxValidator& validator = wxDefaultValidator, | |
182 | char* name = "choice"); | |
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"); | |
192 | ||
193 | ||
194 | void Append(const wxString& item); | |
195 | void Clear(); | |
196 | void Delete(int n); | |
197 | int FindString(const wxString& string); | |
198 | int GetColumns(); | |
199 | int GetSelection(); | |
200 | wxString GetString(const int n); | |
201 | wxString GetStringSelection(); | |
202 | int GetCount(); | |
203 | void SetColumns(const int n = 1); | |
204 | void SetSelection(const int n); | |
205 | void SetStringSelection(const wxString& string); | |
206 | void SetString(int n, const wxString& s); | |
207 | ||
208 | %pragma(python) addtoclass = " | |
209 | Number = GetCount | |
210 | Select = SetSelection | |
211 | " | |
212 | ||
213 | }; | |
214 | ||
215 | //---------------------------------------------------------------------- | |
216 | ||
217 | class wxComboBox : public wxChoice { | |
218 | public: | |
219 | wxComboBox(wxWindow* parent, wxWindowID id, char* value = "", | |
220 | const wxPoint& pos = wxDefaultPosition, | |
221 | const wxSize& size = wxDefaultSize, | |
222 | int LCOUNT=0, wxString* choices=NULL, | |
223 | long style = 0, | |
224 | const wxValidator& validator = wxDefaultValidator, | |
225 | char* name = "comboBox"); | |
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"); | |
235 | ||
236 | ||
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(); | |
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(); | |
258 | void SetSelection(int n); | |
259 | %name(SetMark)void SetSelection(long from, long to); | |
260 | void SetValue(const wxString& text); | |
261 | void SetEditable(bool editable); | |
262 | }; | |
263 | ||
264 | //---------------------------------------------------------------------- | |
265 | ||
266 | class wxGauge : public wxControl { | |
267 | public: | |
268 | wxGauge(wxWindow* parent, wxWindowID id, int range, | |
269 | const wxPoint& pos = wxDefaultPosition, | |
270 | const wxSize& size = wxDefaultSize, | |
271 | long style = wxGA_HORIZONTAL, | |
272 | const wxValidator& validator = wxDefaultValidator, | |
273 | char* name = "gauge"); | |
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"); | |
282 | ||
283 | ||
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, | |
299 | const wxPoint& pos = wxDefaultPosition, | |
300 | const wxSize& size = wxDefaultSize, | |
301 | long style = 0, | |
302 | char* name = "staticBox"); | |
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"); | |
310 | }; | |
311 | ||
312 | ||
313 | //---------------------------------------------------------------------- | |
314 | ||
315 | ||
316 | class wxStaticLine : public wxControl { | |
317 | public: | |
318 | wxStaticLine( wxWindow *parent, wxWindowID id, | |
319 | const wxPoint &pos = wxDefaultPosition, | |
320 | const wxSize &size = wxDefaultSize, | |
321 | long style = wxLI_HORIZONTAL, | |
322 | const char* name = "staticLine" ); | |
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" ); | |
330 | }; | |
331 | ||
332 | ||
333 | //---------------------------------------------------------------------- | |
334 | ||
335 | class wxStaticText : public wxControl { | |
336 | public: | |
337 | wxStaticText(wxWindow* parent, wxWindowID id, const wxString& label, | |
338 | const wxPoint& pos = wxDefaultPosition, | |
339 | const wxSize& size = wxDefaultSize, | |
340 | long style = 0, | |
341 | char* name = "staticText"); | |
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"); | |
349 | ||
350 | ||
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, | |
360 | const wxPoint& pos = wxDefaultPosition, | |
361 | const wxSize& size = wxDefaultSize, | |
362 | int LCOUNT, wxString* choices = NULL, | |
363 | long style = 0, | |
364 | const wxValidator& validator = wxDefaultValidator, | |
365 | char* name = "listBox"); | |
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"); | |
375 | ||
376 | ||
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(); | |
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()); | |
392 | for(size_t i=0; i<lst.GetCount(); i++) { | |
393 | PyTuple_SetItem(tup, i, PyInt_FromLong(lst[i])); | |
394 | } | |
395 | return tup; | |
396 | } | |
397 | } | |
398 | ||
399 | void InsertItems(int LCOUNT, wxString* choices, int pos); | |
400 | ||
401 | wxString GetString(int n); | |
402 | wxString GetStringSelection(); | |
403 | int GetCount(); | |
404 | %pragma(python) addtoclass = "Number = GetCount" | |
405 | bool IsSelected(const int n); | |
406 | bool Selected(const int n); | |
407 | void Set(int LCOUNT, wxString* choices); | |
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 | ||
417 | //---------------------------------------------------------------------- | |
418 | ||
419 | class wxCheckListBox : public wxListBox { | |
420 | public: | |
421 | wxCheckListBox(wxWindow *parent, wxWindowID id, | |
422 | const wxPoint& pos = wxDefaultPosition, | |
423 | const wxSize& size = wxDefaultSize, | |
424 | int LCOUNT = 0, | |
425 | wxString* choices = NULL, | |
426 | long style = 0, | |
427 | const wxValidator& validator = wxDefaultValidator, | |
428 | char* name = "listBox"); | |
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"); | |
439 | ||
440 | ||
441 | bool IsChecked(int uiIndex); | |
442 | void Check(int uiIndex, int bCheck = TRUE); | |
443 | void InsertItems(int LCOUNT, wxString* choices, int pos); | |
444 | ||
445 | int GetItemHeight(); | |
446 | }; | |
447 | ||
448 | //---------------------------------------------------------------------- | |
449 | ||
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 | ||
477 | class wxTextCtrl : public wxControl { | |
478 | public: | |
479 | wxTextCtrl(wxWindow* parent, wxWindowID id, char* value = "", | |
480 | const wxPoint& pos = wxDefaultPosition, | |
481 | const wxSize& size = wxDefaultSize, | |
482 | long style = 0, | |
483 | const wxValidator& validator = wxDefaultValidator, | |
484 | char* name = "text"); | |
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"); | |
493 | ||
494 | ||
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); | |
519 | void AppendText(const wxString& text); | |
520 | long XYToPosition(long x, long y); | |
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(); | |
529 | void Undo(); | |
530 | void Redo(); | |
531 | ||
532 | bool SetStyle(long start, long end, const wxTextAttr& style); | |
533 | bool SetDefaultStyle(const wxTextAttr& style); | |
534 | const wxTextAttr& GetDefaultStyle() const; | |
535 | ||
536 | void SetMaxLength(unsigned long len); | |
537 | ||
538 | %addmethods { | |
539 | void write(const wxString& text) { | |
540 | self->AppendText(text); | |
541 | } | |
542 | } | |
543 | }; | |
544 | ||
545 | //---------------------------------------------------------------------- | |
546 | ||
547 | class wxScrollBar : public wxControl { | |
548 | public: | |
549 | wxScrollBar(wxWindow* parent, wxWindowID id = -1, | |
550 | const wxPoint& pos = wxDefaultPosition, | |
551 | const wxSize& size = wxDefaultSize, | |
552 | long style = wxSB_HORIZONTAL, | |
553 | const wxValidator& validator = wxDefaultValidator, | |
554 | char* name = "scrollBar"); | |
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"); | |
563 | ||
564 | ||
565 | int GetRange(); | |
566 | int GetPageSize(); | |
567 | int GetThumbPosition(); | |
568 | int GetThumbSize(); | |
569 | %name(GetThumbLength) int GetThumbSize(); // to match the docs | |
570 | void SetThumbPosition(int viewStart); | |
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, | |
581 | const wxPoint& pos = wxDefaultPosition, | |
582 | const wxSize& size = wxDefaultSize, | |
583 | long style = wxSP_HORIZONTAL, | |
584 | char* name = "spinButton"); | |
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"); | |
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, | |
606 | const wxPoint& pos = wxDefaultPosition, | |
607 | const wxSize& size = wxDefaultSize, | |
608 | long style = 0, | |
609 | char* name = "staticBitmap"); | |
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"); | |
618 | ||
619 | ||
620 | const wxBitmap& GetBitmap(); | |
621 | void SetBitmap(const wxBitmap& bitmap); | |
622 | void SetIcon(const wxIcon& icon); | |
623 | }; | |
624 | ||
625 | //---------------------------------------------------------------------- | |
626 | ||
627 | class wxRadioBox : public wxControl { | |
628 | public: | |
629 | wxRadioBox(wxWindow* parent, wxWindowID id, | |
630 | const wxString& label, | |
631 | const wxPoint& point = wxDefaultPosition, | |
632 | const wxSize& size = wxDefaultSize, | |
633 | int LCOUNT = 0, wxString* choices = NULL, | |
634 | int majorDimension = 0, | |
635 | long style = wxRA_HORIZONTAL, | |
636 | const wxValidator& validator = wxDefaultValidator, | |
637 | char* name = "radioBox"); | |
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"); | |
649 | ||
650 | ||
651 | void Enable(bool enable); | |
652 | %name(EnableItem)void Enable(int n, bool enable); | |
653 | int FindString(const wxString& string); | |
654 | ||
655 | wxString GetString(int n); | |
656 | ||
657 | #ifdef __WXMSW__ | |
658 | void SetString(int n, const wxString& label); | |
659 | %pragma(python) addtoclass = " | |
660 | GetItemLabel = GetString | |
661 | SetItemLabel = SetString | |
662 | " | |
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 | ||
670 | int GetSelection(); | |
671 | wxString GetStringSelection(); | |
672 | int GetCount(); | |
673 | %pragma(python) addtoclass = "Number = GetCount" | |
674 | ||
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, | |
687 | const wxPoint& pos = wxDefaultPosition, | |
688 | const wxSize& size = wxDefaultSize, | |
689 | long style = 0, | |
690 | const wxValidator& validator = wxDefaultValidator, | |
691 | char* name = "radioButton"); | |
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"); | |
701 | ||
702 | ||
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, | |
713 | const wxPoint& point = wxDefaultPosition, | |
714 | const wxSize& size = wxDefaultSize, | |
715 | long style = wxSL_HORIZONTAL, | |
716 | const wxValidator& validator = wxDefaultValidator, | |
717 | char* name = "slider"); | |
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"); | |
727 | ||
728 | ||
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 | ||
753 | class wxSpinCtrl : public wxSpinButton { | |
754 | public: | |
755 | wxSpinCtrl(wxWindow *parent, | |
756 | wxWindowID id = -1, | |
757 | const char* value = "", | |
758 | const wxPoint& pos = wxDefaultPosition, | |
759 | const wxSize& size = wxDefaultSize, | |
760 | long style = wxSP_ARROW_KEYS, | |
761 | int min = 0, int max = 100, int initial = 0, | |
762 | const char* name = "wxSpinCtrl"); | |
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"); | |
773 | ||
774 | ||
775 | int GetMax(); | |
776 | int GetMin(); | |
777 | int GetValue(); | |
778 | void SetRange(int min, int max); | |
779 | void SetValue(int value); | |
780 | ||
781 | }; | |
782 | ||
783 | ||
784 | //---------------------------------------------------------------------- | |
785 | ||
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"); | |
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"); | |
808 | ||
809 | void SetValue(bool value); | |
810 | bool GetValue() const ; | |
811 | void SetLabel(const wxString& label); | |
812 | ||
813 | }; | |
814 | ||
815 | //---------------------------------------------------------------------- | |
816 | //---------------------------------------------------------------------- | |
817 | //---------------------------------------------------------------------- | |
818 | ||
819 | ||
820 |