]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/controls.i
hopefully fixes focus assertion
[wxWidgets.git] / wxPython / src / controls.i
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
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
137 class wxButton : public wxControl {
138 public:
139 wxButton(wxWindow* parent, wxWindowID id, const wxString& label,
140 const wxPoint& pos = wxDefaultPosition,
141 const wxSize& size = wxDefaultSize,
142 long style = 0,
143 const wxValidator& validator = wxDefaultValidator,
144 char* name = "button");
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");
153
154
155 void SetDefault();
156 void SetBackgroundColour(const wxColour& colour);
157 void SetForegroundColour(const wxColour& colour);
158 #ifdef __WXMSW__
159 void SetImageLabel(const wxBitmap& bitmap);
160 void SetImageMargins(wxCoord x, wxCoord y);
161 #endif
162 static wxSize GetDefaultSize();
163 };
164
165 //----------------------------------------------------------------------
166
167 class wxBitmapButton : public wxButton {
168 public:
169 wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap,
170 const wxPoint& pos = wxDefaultPosition,
171 const wxSize& size = wxDefaultSize,
172 long style = wxBU_AUTODRAW,
173 const wxValidator& validator = wxDefaultValidator,
174 char* name = "button");
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");
183
184
185 wxBitmap& GetBitmapLabel();
186 wxBitmap& GetBitmapDisabled();
187 wxBitmap& GetBitmapFocus();
188 wxBitmap& GetBitmapSelected();
189 void SetBitmapDisabled(const wxBitmap& bitmap);
190 void SetBitmapFocus(const wxBitmap& bitmap);
191 void SetBitmapSelected(const wxBitmap& bitmap);
192 void SetBitmapLabel(const wxBitmap& bitmap);
193
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; }
197 };
198
199 //----------------------------------------------------------------------
200
201 class wxCheckBox : public wxControl {
202 public:
203 wxCheckBox(wxWindow* parent, wxWindowID id, const wxString& label,
204 const wxPoint& pos = wxDefaultPosition,
205 const wxSize& size = wxDefaultSize,
206 long style = 0,
207 const wxValidator& val = wxDefaultValidator,
208 char* name = "checkBox");
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");
217
218
219 bool GetValue();
220 void SetValue(const bool state);
221 };
222
223 //----------------------------------------------------------------------
224
225 class wxChoice : public wxControlWithItems {
226 public:
227 wxChoice(wxWindow *parent, wxWindowID id,
228 const wxPoint& pos = wxDefaultPosition,
229 const wxSize& size = wxDefaultSize,
230 int LCOUNT=0, wxString* choices=NULL,
231 long style = 0,
232 const wxValidator& validator = wxDefaultValidator,
233 char* name = "choice");
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");
243
244 void Clear();
245
246 int GetColumns();
247 void SetColumns(const int n = 1);
248 void SetSelection(const int n);
249 void SetStringSelection(const wxString& string);
250 void SetString(int n, const wxString& s);
251
252 %pragma(python) addtoclass = "
253 Select = SetSelection
254 "
255 };
256
257 //----------------------------------------------------------------------
258
259 class wxComboBox : public wxChoice {
260 public:
261 wxComboBox(wxWindow* parent, wxWindowID id, char* value = "",
262 const wxPoint& pos = wxDefaultPosition,
263 const wxSize& size = wxDefaultSize,
264 int LCOUNT=0, wxString* choices=NULL,
265 long style = 0,
266 const wxValidator& validator = wxDefaultValidator,
267 char* name = "comboBox");
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");
277
278
279 void Copy();
280 void Cut();
281 long GetInsertionPoint();
282 long GetLastPosition();
283 wxString GetValue();
284 void Paste();
285 void Replace(long from, long to, const wxString& text);
286 void Remove(long from, long to);
287 void SetInsertionPoint(long pos);
288 void SetInsertionPointEnd();
289 void SetSelection(int n);
290 %name(SetMark)void SetSelection(long from, long to);
291 void SetValue(const wxString& text);
292 void SetEditable(bool editable);
293 };
294
295 //----------------------------------------------------------------------
296
297 class wxGauge : public wxControl {
298 public:
299 wxGauge(wxWindow* parent, wxWindowID id, int range,
300 const wxPoint& pos = wxDefaultPosition,
301 const wxSize& size = wxDefaultSize,
302 long style = wxGA_HORIZONTAL,
303 const wxValidator& validator = wxDefaultValidator,
304 char* name = "gauge");
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");
313
314
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,
330 const wxPoint& pos = wxDefaultPosition,
331 const wxSize& size = wxDefaultSize,
332 long style = 0,
333 char* name = "staticBox");
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");
341 };
342
343
344 //----------------------------------------------------------------------
345
346
347 class wxStaticLine : public wxControl {
348 public:
349 wxStaticLine( wxWindow *parent, wxWindowID id,
350 const wxPoint &pos = wxDefaultPosition,
351 const wxSize &size = wxDefaultSize,
352 long style = wxLI_HORIZONTAL,
353 const char* name = "staticLine" );
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" );
361 };
362
363
364 //----------------------------------------------------------------------
365
366 class wxStaticText : public wxControl {
367 public:
368 wxStaticText(wxWindow* parent, wxWindowID id, const wxString& label,
369 const wxPoint& pos = wxDefaultPosition,
370 const wxSize& size = wxDefaultSize,
371 long style = 0,
372 char* name = "staticText");
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");
380
381
382 wxString GetLabel();
383 void SetLabel(const wxString& label);
384 };
385
386 //----------------------------------------------------------------------
387
388 class wxListBox : public wxControlWithItems {
389 public:
390 wxListBox(wxWindow* parent, wxWindowID id,
391 const wxPoint& pos = wxDefaultPosition,
392 const wxSize& size = wxDefaultSize,
393 int LCOUNT, wxString* choices = NULL,
394 long style = 0,
395 const wxValidator& validator = wxDefaultValidator,
396 char* name = "listBox");
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");
406
407 void Clear();
408 void Deselect(int n);
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());
416 for(size_t i=0; i<lst.GetCount(); i++) {
417 PyTuple_SetItem(tup, i, PyInt_FromLong(lst[i]));
418 }
419 return tup;
420 }
421 }
422
423
424 void InsertItems(int LCOUNT, wxString* choices, int pos);
425
426 bool IsSelected(const int n);
427 bool Selected(const int n);
428 void Set(int LCOUNT, wxString* choices);
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
437 //----------------------------------------------------------------------
438
439 class wxCheckListBox : public wxListBox {
440 public:
441 wxCheckListBox(wxWindow *parent, wxWindowID id,
442 const wxPoint& pos = wxDefaultPosition,
443 const wxSize& size = wxDefaultSize,
444 int LCOUNT = 0,
445 wxString* choices = NULL,
446 long style = 0,
447 const wxValidator& validator = wxDefaultValidator,
448 char* name = "listBox");
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");
459
460
461 bool IsChecked(int uiIndex);
462 void Check(int uiIndex, int bCheck = TRUE);
463 void InsertItems(int LCOUNT, wxString* choices, int pos);
464
465 int GetItemHeight();
466 };
467
468 //----------------------------------------------------------------------
469
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
497 class wxTextCtrl : public wxControl {
498 public:
499 wxTextCtrl(wxWindow* parent, wxWindowID id, char* value = "",
500 const wxPoint& pos = wxDefaultPosition,
501 const wxSize& size = wxDefaultSize,
502 long style = 0,
503 const wxValidator& validator = wxDefaultValidator,
504 char* name = "text");
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");
513
514
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);
539 void AppendText(const wxString& text);
540 long XYToPosition(long x, long y);
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();
549 void Undo();
550 void Redo();
551
552 bool SetStyle(long start, long end, const wxTextAttr& style);
553 bool SetDefaultStyle(const wxTextAttr& style);
554 const wxTextAttr& GetDefaultStyle() const;
555
556 void SetMaxLength(unsigned long len);
557
558 %addmethods {
559 void write(const wxString& text) {
560 self->AppendText(text);
561 }
562 }
563 };
564
565 //----------------------------------------------------------------------
566
567 class wxScrollBar : public wxControl {
568 public:
569 wxScrollBar(wxWindow* parent, wxWindowID id = -1,
570 const wxPoint& pos = wxDefaultPosition,
571 const wxSize& size = wxDefaultSize,
572 long style = wxSB_HORIZONTAL,
573 const wxValidator& validator = wxDefaultValidator,
574 char* name = "scrollBar");
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");
583
584
585 int GetRange();
586 int GetPageSize();
587 int GetThumbPosition();
588 int GetThumbSize();
589 %name(GetThumbLength) int GetThumbSize(); // to match the docs
590 void SetThumbPosition(int viewStart);
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,
601 const wxPoint& pos = wxDefaultPosition,
602 const wxSize& size = wxDefaultSize,
603 long style = wxSP_HORIZONTAL,
604 char* name = "spinButton");
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");
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,
626 const wxPoint& pos = wxDefaultPosition,
627 const wxSize& size = wxDefaultSize,
628 long style = 0,
629 char* name = "staticBitmap");
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");
638
639
640 const wxBitmap& GetBitmap();
641 void SetBitmap(const wxBitmap& bitmap);
642 void SetIcon(const wxIcon& icon);
643 };
644
645 //----------------------------------------------------------------------
646
647 class wxRadioBox : public wxControl {
648 public:
649 wxRadioBox(wxWindow* parent, wxWindowID id,
650 const wxString& label,
651 const wxPoint& point = wxDefaultPosition,
652 const wxSize& size = wxDefaultSize,
653 int LCOUNT = 0, wxString* choices = NULL,
654 int majorDimension = 0,
655 long style = wxRA_HORIZONTAL,
656 const wxValidator& validator = wxDefaultValidator,
657 char* name = "radioBox");
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");
669
670
671 void Enable(bool enable);
672 %name(EnableItem)void Enable(int n, bool enable);
673 int FindString(const wxString& string);
674
675 wxString GetString(int n);
676
677 #ifdef __WXMSW__
678 void SetString(int n, const wxString& label);
679 %pragma(python) addtoclass = "
680 GetItemLabel = GetString
681 SetItemLabel = SetString
682 "
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
690 int GetSelection();
691 wxString GetStringSelection();
692 int GetCount();
693 %pragma(python) addtoclass = "Number = GetCount"
694
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,
707 const wxPoint& pos = wxDefaultPosition,
708 const wxSize& size = wxDefaultSize,
709 long style = 0,
710 const wxValidator& validator = wxDefaultValidator,
711 char* name = "radioButton");
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");
721
722
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,
733 const wxPoint& point = wxDefaultPosition,
734 const wxSize& size = wxDefaultSize,
735 long style = wxSL_HORIZONTAL,
736 const wxValidator& validator = wxDefaultValidator,
737 char* name = "slider");
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");
747
748
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
773 class wxSpinCtrl : public wxSpinButton {
774 public:
775 wxSpinCtrl(wxWindow *parent,
776 wxWindowID id = -1,
777 const char* value = "",
778 const wxPoint& pos = wxDefaultPosition,
779 const wxSize& size = wxDefaultSize,
780 long style = wxSP_ARROW_KEYS,
781 int min = 0, int max = 100, int initial = 0,
782 const char* name = "wxSpinCtrl");
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");
793
794
795 int GetMax();
796 int GetMin();
797 int GetValue();
798 void SetRange(int min, int max);
799 void SetValue(int value);
800
801 };
802
803
804 //----------------------------------------------------------------------
805
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");
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");
828
829 void SetValue(bool value);
830 bool GetValue() const ;
831 void SetLabel(const wxString& label);
832
833 };
834
835 //----------------------------------------------------------------------
836 //----------------------------------------------------------------------
837 //----------------------------------------------------------------------
838
839
840