]>
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 | %include typemaps.i | |
38 | %include my_typemaps.i | |
39 | ||
40 | // Import some definitions of other classes, etc. | |
41 | %import _defs.i | |
42 | %import misc.i | |
43 | %import windows.i | |
44 | %import gdi.i | |
45 | %import events.i | |
46 | ||
47 | %pragma(python) code = "import wx" | |
48 | ||
49 | //---------------------------------------------------------------------- | |
50 | ||
51 | %readonly | |
52 | wxValidator wxDefaultValidator; | |
53 | %readwrite | |
54 | ||
55 | //---------------------------------------------------------------------- | |
56 | ||
57 | %{ | |
58 | //#define DECLARE_DEF_STRING(name) static wxString* wxPy##name | |
59 | ||
60 | // Put some wx default wxChar* values into wxStrings. | |
61 | DECLARE_DEF_STRING(ControlNameStr); | |
62 | DECLARE_DEF_STRING(ButtonNameStr); | |
63 | DECLARE_DEF_STRING(CheckBoxNameStr); | |
64 | DECLARE_DEF_STRING(ChoiceNameStr); | |
65 | DECLARE_DEF_STRING(ComboBoxNameStr); | |
66 | DECLARE_DEF_STRING(GaugeNameStr); | |
67 | DECLARE_DEF_STRING(StaticBoxNameStr); | |
68 | DECLARE_DEF_STRING(StaticTextNameStr); | |
69 | DECLARE_DEF_STRING(ListBoxNameStr); | |
70 | DECLARE_DEF_STRING(TextCtrlNameStr); | |
71 | DECLARE_DEF_STRING(ScrollBarNameStr); | |
72 | DECLARE_DEF_STRING(SPIN_BUTTON_NAME); | |
73 | DECLARE_DEF_STRING(StaticBitmapNameStr); | |
74 | DECLARE_DEF_STRING(RadioBoxNameStr); | |
75 | DECLARE_DEF_STRING(RadioButtonNameStr); | |
76 | DECLARE_DEF_STRING(SliderNameStr); | |
77 | ||
78 | wxChar* wxSpinCtrlNameStr = _T("wxSpinCtrl"); | |
79 | DECLARE_DEF_STRING(SpinCtrlNameStr); | |
80 | ||
81 | static const wxString wxPyEmptyString(wxT("")); | |
82 | %} | |
83 | ||
84 | //---------------------------------------------------------------------- | |
85 | ||
86 | // This is the base class for a control or 'widget'. | |
87 | // | |
88 | // A control is generally a small window which processes user input and/or | |
89 | // displays one or more item of data. | |
90 | class wxControl : public wxWindow { | |
91 | public: | |
92 | ||
93 | // | |
94 | wxControl(wxWindow *parent, | |
95 | wxWindowID id, | |
96 | const wxPoint& pos=wxDefaultPosition, | |
97 | const wxSize& size=wxDefaultSize, | |
98 | long style=0, | |
99 | const wxValidator& validator=wxDefaultValidator, | |
100 | const wxString& name=wxPyControlNameStr); | |
101 | ||
102 | // | |
103 | %name(wxPreControl)wxControl(); | |
104 | ||
105 | // | |
106 | bool Create(wxWindow *parent, | |
107 | wxWindowID id, | |
108 | const wxPoint& pos=wxDefaultPosition, | |
109 | const wxSize& size=wxDefaultSize, | |
110 | long style=0, | |
111 | const wxValidator& validator=wxDefaultValidator, | |
112 | const wxString& name=wxPyControlNameStr); | |
113 | ||
114 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
115 | %pragma(python) addtomethod = "wxPreControl:val._setOORInfo(val)" | |
116 | ||
117 | // Simulates the effect of the user issuing a command to the item. See | |
118 | // wxCommandEvent. | |
119 | void Command(wxCommandEvent& event); | |
120 | ||
121 | // Return a control's text. | |
122 | wxString GetLabel(); | |
123 | ||
124 | // Sets the item's text. | |
125 | void SetLabel(const wxString& label); | |
126 | }; | |
127 | ||
128 | ||
129 | //---------------------------------------------------------------------- | |
130 | ||
131 | ||
132 | class wxControlWithItems : public wxControl { | |
133 | public: | |
134 | ||
135 | // void Clear(); ambiguous, redefine below... | |
136 | ||
137 | // Deletes an item from the control | |
138 | void Delete(int n); | |
139 | ||
140 | // Returns the number of items in the control. | |
141 | int GetCount(); | |
142 | %pragma(python) addtoclass = "Number = GetCount" | |
143 | ||
144 | // Returns the string at the given position. | |
145 | wxString GetString(int n); | |
146 | ||
147 | // Sets the string value of an item. | |
148 | void SetString(int n, const wxString& s); | |
149 | ||
150 | // Finds an item matching the given string. Returns the zero-based | |
151 | // position of the item, or -1 if the string was not found. | |
152 | int FindString(const wxString& s); | |
153 | ||
154 | // Select the item at postion n. | |
155 | void Select(int n); | |
156 | ||
157 | // Gets the position of the selected item. | |
158 | int GetSelection(); | |
159 | ||
160 | // Gets the current selection as a string. | |
161 | wxString GetStringSelection() const; | |
162 | ||
163 | // void Append(const wxString& item); | |
164 | // void Append(const wxString& item, char* clientData); | |
165 | // char* GetClientData(const int n); | |
166 | // void SetClientData(const int n, char* data); | |
167 | ||
168 | ||
169 | %addmethods { | |
170 | // Adds the item to the control, associating the given data with the | |
171 | // item if not None. | |
172 | void Append(const wxString& item, PyObject* clientData=NULL) { | |
173 | if (clientData) { | |
174 | wxPyClientData* data = new wxPyClientData(clientData); | |
175 | self->Append(item, data); | |
176 | } else | |
177 | self->Append(item); | |
178 | } | |
179 | ||
180 | // Returns the client data associated with the given item, (if any.) | |
181 | PyObject* GetClientData(int n) { | |
182 | wxPyClientData* data = (wxPyClientData*)self->GetClientObject(n); | |
183 | if (data) { | |
184 | Py_INCREF(data->m_obj); | |
185 | return data->m_obj; | |
186 | } else { | |
187 | Py_INCREF(Py_None); | |
188 | return Py_None; | |
189 | } | |
190 | } | |
191 | ||
192 | // Associate the given client data with the item at position n. | |
193 | void SetClientData(int n, PyObject* clientData) { | |
194 | wxPyClientData* data = new wxPyClientData(clientData); | |
195 | self->SetClientObject(n, data); | |
196 | } | |
197 | } | |
198 | ||
199 | // append several items at once to the control | |
200 | %name(AppendItems)void Append(const wxArrayString& strings); | |
201 | ||
202 | }; | |
203 | ||
204 | //---------------------------------------------------------------------- | |
205 | ||
206 | // A button is a control that contains a text string, and is one of the most | |
207 | // common elements of a GUI. It may be placed on a dialog box or panel, or | |
208 | // indeed almost any other window. | |
209 | // | |
210 | // Styles | |
211 | // wxBU_LEFT: Left-justifies the label. WIN32 only. | |
212 | // wxBU_TOP: Aligns the label to the top of the button. WIN32 only. | |
213 | // wxBU_RIGHT: Right-justifies the bitmap label. WIN32 only. | |
214 | // wxBU_BOTTOM: Aligns the label to the bottom of the button. WIN32 only. | |
215 | // wxBU_EXACTFIT: Creates the button as small as possible instead of making | |
216 | // it of the standard size (which is the default behaviour.) | |
217 | // | |
218 | // Events | |
219 | // EVT_BUTTON(win,id,func): | |
220 | // Sent when the button is clicked. | |
221 | // | |
222 | class wxButton : public wxControl { | |
223 | public: | |
224 | // Constructor, creating and showing a button. | |
225 | // | |
226 | // parent: Parent window. Must not be None. | |
227 | // id: Button identifier. A value of -1 indicates a default value. | |
228 | // label: The text to be displayed on the button. | |
229 | // pos: The button position on it's parent. | |
230 | // size: Button size. If the default size (-1, -1) is specified then the | |
231 | // button is sized appropriately for the text. | |
232 | // style: Window style. See wxButton. | |
233 | // validator: Window validator. | |
234 | // name: Window name. | |
235 | wxButton(wxWindow* parent, wxWindowID id, const wxString& label, | |
236 | const wxPoint& pos = wxDefaultPosition, | |
237 | const wxSize& size = wxDefaultSize, | |
238 | long style = 0, | |
239 | const wxValidator& validator = wxDefaultValidator, | |
240 | const wxString& name = wxPyButtonNameStr); | |
241 | ||
242 | // Default constructor | |
243 | %name(wxPreButton)wxButton(); | |
244 | ||
245 | // Button creation function for two-step creation. | |
246 | bool Create(wxWindow* parent, wxWindowID id, const wxString& label, | |
247 | const wxPoint& pos = wxDefaultPosition, | |
248 | const wxSize& size = wxDefaultSize, | |
249 | long style = 0, | |
250 | const wxValidator& validator = wxDefaultValidator, | |
251 | const wxString& name = wxPyButtonNameStr); | |
252 | ||
253 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
254 | %pragma(python) addtomethod = "wxPreButton:val._setOORInfo(val)" | |
255 | ||
256 | // This sets the button to be the default item for the panel or dialog box. | |
257 | // | |
258 | // Under Windows, only dialog box buttons respond to this function. As | |
259 | // normal under Windows and Motif, pressing return causes the default | |
260 | // button to be depressed when the return key is pressed. See also | |
261 | // wxWindow.SetFocus which sets the keyboard focus for windows and text | |
262 | // panel items, and wxPanel.SetDefaultItem. | |
263 | void SetDefault(); | |
264 | ||
265 | // | |
266 | void SetBackgroundColour(const wxColour& colour); | |
267 | // | |
268 | void SetForegroundColour(const wxColour& colour); | |
269 | ||
270 | #ifdef __WXMSW__ | |
271 | // show the image in the button in addition to the label | |
272 | void SetImageLabel(const wxBitmap& bitmap); | |
273 | ||
274 | // set the margins around the image | |
275 | void SetImageMargins(wxCoord x, wxCoord y); | |
276 | #endif | |
277 | ||
278 | // returns the default button size for this platform | |
279 | static wxSize GetDefaultSize(); | |
280 | }; | |
281 | ||
282 | //---------------------------------------------------------------------- | |
283 | ||
284 | class wxBitmapButton : public wxButton { | |
285 | public: | |
286 | wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, | |
287 | const wxPoint& pos = wxDefaultPosition, | |
288 | const wxSize& size = wxDefaultSize, | |
289 | long style = wxBU_AUTODRAW, | |
290 | const wxValidator& validator = wxDefaultValidator, | |
291 | const wxString& name = wxPyButtonNameStr); | |
292 | %name(wxPreBitmapButton)wxBitmapButton(); | |
293 | ||
294 | bool Create(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, | |
295 | const wxPoint& pos = wxDefaultPosition, | |
296 | const wxSize& size = wxDefaultSize, | |
297 | long style = wxBU_AUTODRAW, | |
298 | const wxValidator& validator = wxDefaultValidator, | |
299 | const wxString& name = wxPyButtonNameStr); | |
300 | ||
301 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
302 | %pragma(python) addtomethod = "wxPreBitmapButton:val._setOORInfo(val)" | |
303 | ||
304 | wxBitmap GetBitmapLabel(); | |
305 | wxBitmap GetBitmapDisabled(); | |
306 | wxBitmap GetBitmapFocus(); | |
307 | wxBitmap GetBitmapSelected(); | |
308 | void SetBitmapDisabled(const wxBitmap& bitmap); | |
309 | void SetBitmapFocus(const wxBitmap& bitmap); | |
310 | void SetBitmapSelected(const wxBitmap& bitmap); | |
311 | void SetBitmapLabel(const wxBitmap& bitmap); | |
312 | ||
313 | void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; } | |
314 | int GetMarginX() const { return m_marginX; } | |
315 | int GetMarginY() const { return m_marginY; } | |
316 | }; | |
317 | ||
318 | //---------------------------------------------------------------------- | |
319 | ||
320 | class wxCheckBox : public wxControl { | |
321 | public: | |
322 | wxCheckBox(wxWindow* parent, wxWindowID id, const wxString& label, | |
323 | const wxPoint& pos = wxDefaultPosition, | |
324 | const wxSize& size = wxDefaultSize, | |
325 | long style = 0, | |
326 | const wxValidator& val = wxDefaultValidator, | |
327 | const wxString& name = wxPyCheckBoxNameStr); | |
328 | %name(wxPreCheckBox)wxCheckBox(); | |
329 | ||
330 | bool Create(wxWindow* parent, wxWindowID id, const wxString& label, | |
331 | const wxPoint& pos = wxDefaultPosition, | |
332 | const wxSize& size = wxDefaultSize, | |
333 | long style = 0, | |
334 | const wxValidator& val = wxDefaultValidator, | |
335 | const wxString& name = wxPyCheckBoxNameStr); | |
336 | ||
337 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
338 | %pragma(python) addtomethod = "wxPreCheckBox:val._setOORInfo(val)" | |
339 | ||
340 | bool GetValue(); | |
341 | bool IsChecked(); | |
342 | void SetValue(const bool state); | |
343 | }; | |
344 | ||
345 | //---------------------------------------------------------------------- | |
346 | ||
347 | class wxChoice : public wxControlWithItems { | |
348 | public: | |
349 | wxChoice(wxWindow *parent, wxWindowID id, | |
350 | const wxPoint& pos = wxDefaultPosition, | |
351 | const wxSize& size = wxDefaultSize, | |
352 | int LCOUNT=0, wxString* choices=NULL, | |
353 | long style = 0, | |
354 | const wxValidator& validator = wxDefaultValidator, | |
355 | const wxString& name = wxPyChoiceNameStr); | |
356 | %name(wxPreChoice)wxChoice(); | |
357 | ||
358 | bool Create(wxWindow *parent, wxWindowID id, | |
359 | const wxPoint& pos = wxDefaultPosition, | |
360 | const wxSize& size = wxDefaultSize, | |
361 | int LCOUNT=0, wxString* choices=NULL, | |
362 | long style = 0, | |
363 | const wxValidator& validator = wxDefaultValidator, | |
364 | const wxString& name = wxPyChoiceNameStr); | |
365 | ||
366 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
367 | %pragma(python) addtomethod = "wxPreChoice:val._setOORInfo(val)" | |
368 | ||
369 | void Clear(); | |
370 | ||
371 | int GetColumns(); | |
372 | void SetColumns(const int n = 1); | |
373 | void SetSelection(const int n); | |
374 | void SetStringSelection(const wxString& string); | |
375 | void SetString(int n, const wxString& s); | |
376 | ||
377 | %pragma(python) addtoclass = " | |
378 | Select = SetSelection | |
379 | " | |
380 | }; | |
381 | ||
382 | //---------------------------------------------------------------------- | |
383 | ||
384 | // wxGTK's wxComboBox doesn't derive from wxChoice like wxMSW, or | |
385 | // even wxControlWithItems, so we have to duplicate the methods | |
386 | // here... <blech!> | |
387 | ||
388 | #ifdef __WXGTK__ | |
389 | class wxComboBox : public wxControl | |
390 | { | |
391 | public: | |
392 | wxComboBox(wxWindow* parent, wxWindowID id, | |
393 | const wxString& value = wxPyEmptyString, | |
394 | const wxPoint& pos = wxDefaultPosition, | |
395 | const wxSize& size = wxDefaultSize, | |
396 | int LCOUNT=0, wxString* choices=NULL, | |
397 | long style = 0, | |
398 | const wxValidator& validator = wxDefaultValidator, | |
399 | const wxString& name = wxPyComboBoxNameStr); | |
400 | %name(wxPreComboBox)wxComboBox(); | |
401 | ||
402 | bool Create(wxWindow* parent, wxWindowID id, | |
403 | const wxString& value = wxPyEmptyString, | |
404 | const wxPoint& pos = wxDefaultPosition, | |
405 | const wxSize& size = wxDefaultSize, | |
406 | int LCOUNT=0, wxString* choices=NULL, | |
407 | long style = 0, | |
408 | const wxValidator& validator = wxDefaultValidator, | |
409 | const wxString& name = wxPyComboBoxNameStr); | |
410 | ||
411 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
412 | %pragma(python) addtomethod = "wxPreComboBox:val._setOORInfo(val)" | |
413 | ||
414 | void Copy(); | |
415 | void Cut(); | |
416 | long GetInsertionPoint(); | |
417 | long GetLastPosition(); | |
418 | wxString GetValue(); | |
419 | void Paste(); | |
420 | void Replace(long from, long to, const wxString& text); | |
421 | void Remove(long from, long to); | |
422 | void SetInsertionPoint(long pos); | |
423 | void SetInsertionPointEnd(); | |
424 | void SetSelection(int n); | |
425 | %name(SetMark)void SetSelection(long from, long to); | |
426 | void SetValue(const wxString& text); | |
427 | void SetEditable(bool editable); | |
428 | ||
429 | ||
430 | void Clear(); | |
431 | void Delete(int n); | |
432 | ||
433 | int GetCount(); | |
434 | %pragma(python) addtoclass = "Number = GetCount" | |
435 | wxString GetString(int n); | |
436 | int FindString(const wxString& s); | |
437 | ||
438 | //void SetString(int n, const wxString& s); *** No equivalent for wxGTK!!! | |
439 | ||
440 | // void Select(int n); | |
441 | %pragma(python) addtoclass = "Select = SetSelection" | |
442 | ||
443 | int GetSelection(); | |
444 | wxString GetStringSelection() const; | |
445 | ||
446 | // void Append(const wxString& item); | |
447 | // void Append(const wxString& item, char* clientData); | |
448 | // char* GetClientData(const int n); | |
449 | // void SetClientData(const int n, char* data); | |
450 | %addmethods { | |
451 | void Append(const wxString& item, PyObject* clientData=NULL) { | |
452 | if (clientData) { | |
453 | wxPyClientData* data = new wxPyClientData(clientData); | |
454 | self->Append(item, data); | |
455 | } else | |
456 | self->Append(item); | |
457 | } | |
458 | ||
459 | PyObject* GetClientData(int n) { | |
460 | wxPyClientData* data = (wxPyClientData*)self->GetClientObject(n); | |
461 | if (data) { | |
462 | Py_INCREF(data->m_obj); | |
463 | return data->m_obj; | |
464 | } else { | |
465 | Py_INCREF(Py_None); | |
466 | return Py_None; | |
467 | } | |
468 | } | |
469 | ||
470 | void SetClientData(int n, PyObject* clientData) { | |
471 | wxPyClientData* data = new wxPyClientData(clientData); | |
472 | self->SetClientObject(n, data); | |
473 | } | |
474 | } | |
475 | ||
476 | }; | |
477 | ||
478 | ||
479 | ||
480 | #else // For all but wxGTK | |
481 | ||
482 | ||
483 | class wxComboBox : public wxChoice { | |
484 | public: | |
485 | wxComboBox(wxWindow* parent, wxWindowID id, | |
486 | const wxString& value = wxPyEmptyString, | |
487 | const wxPoint& pos = wxDefaultPosition, | |
488 | const wxSize& size = wxDefaultSize, | |
489 | int LCOUNT=0, wxString* choices=NULL, | |
490 | long style = 0, | |
491 | const wxValidator& validator = wxDefaultValidator, | |
492 | const wxString& name = wxPyComboBoxNameStr); | |
493 | %name(wxPreComboBox)wxComboBox(); | |
494 | ||
495 | bool Create(wxWindow* parent, wxWindowID id, | |
496 | const wxString& value = wxPyEmptyString, | |
497 | const wxPoint& pos = wxDefaultPosition, | |
498 | const wxSize& size = wxDefaultSize, | |
499 | int LCOUNT=0, wxString* choices=NULL, | |
500 | long style = 0, | |
501 | const wxValidator& validator = wxDefaultValidator, | |
502 | const wxString& name = wxPyComboBoxNameStr); | |
503 | ||
504 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
505 | %pragma(python) addtomethod = "wxPreComboBox:val._setOORInfo(val)" | |
506 | ||
507 | void Copy(); | |
508 | void Cut(); | |
509 | long GetInsertionPoint(); | |
510 | long GetLastPosition(); | |
511 | wxString GetValue(); | |
512 | void Paste(); | |
513 | void Replace(long from, long to, const wxString& text); | |
514 | void Remove(long from, long to); | |
515 | void SetInsertionPoint(long pos); | |
516 | void SetInsertionPointEnd(); | |
517 | void SetSelection(int n); | |
518 | %name(SetMark)void SetSelection(long from, long to); | |
519 | void SetValue(const wxString& text); | |
520 | void SetEditable(bool editable); | |
521 | }; | |
522 | #endif | |
523 | ||
524 | ||
525 | //---------------------------------------------------------------------- | |
526 | ||
527 | class wxGauge : public wxControl { | |
528 | public: | |
529 | wxGauge(wxWindow* parent, wxWindowID id, int range, | |
530 | const wxPoint& pos = wxDefaultPosition, | |
531 | const wxSize& size = wxDefaultSize, | |
532 | long style = wxGA_HORIZONTAL, | |
533 | const wxValidator& validator = wxDefaultValidator, | |
534 | const wxString& name = wxPyGaugeNameStr); | |
535 | %name(wxPreGauge)wxGauge(); | |
536 | ||
537 | bool Create(wxWindow* parent, wxWindowID id, int range, | |
538 | const wxPoint& pos = wxDefaultPosition, | |
539 | const wxSize& size = wxDefaultSize, | |
540 | long style = wxGA_HORIZONTAL, | |
541 | const wxValidator& validator = wxDefaultValidator, | |
542 | const wxString& name = wxPyGaugeNameStr); | |
543 | ||
544 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
545 | %pragma(python) addtomethod = "wxPreGauge:val._setOORInfo(val)" | |
546 | ||
547 | int GetBezelFace(); | |
548 | int GetRange(); | |
549 | int GetShadowWidth(); | |
550 | int GetValue(); | |
551 | void SetBezelFace(int width); | |
552 | void SetRange(int range); | |
553 | void SetShadowWidth(int width); | |
554 | void SetValue(int pos); | |
555 | }; | |
556 | ||
557 | //---------------------------------------------------------------------- | |
558 | ||
559 | class wxStaticBox : public wxControl { | |
560 | public: | |
561 | wxStaticBox(wxWindow* parent, wxWindowID id, const wxString& label, | |
562 | const wxPoint& pos = wxDefaultPosition, | |
563 | const wxSize& size = wxDefaultSize, | |
564 | long style = 0, | |
565 | const wxString& name = wxPyStaticBoxNameStr); | |
566 | %name(wxPreStaticBox)wxStaticBox(); | |
567 | ||
568 | bool Create(wxWindow* parent, wxWindowID id, const wxString& label, | |
569 | const wxPoint& pos = wxDefaultPosition, | |
570 | const wxSize& size = wxDefaultSize, | |
571 | long style = 0, | |
572 | const wxString& name = wxPyStaticBoxNameStr); | |
573 | ||
574 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
575 | %pragma(python) addtomethod = "wxPreStaticBox:val._setOORInfo(val)" | |
576 | }; | |
577 | ||
578 | ||
579 | //---------------------------------------------------------------------- | |
580 | ||
581 | ||
582 | class wxStaticLine : public wxControl { | |
583 | public: | |
584 | wxStaticLine( wxWindow *parent, wxWindowID id, | |
585 | const wxPoint &pos = wxDefaultPosition, | |
586 | const wxSize &size = wxDefaultSize, | |
587 | long style = wxLI_HORIZONTAL, | |
588 | const wxString& name = wxPyStaticTextNameStr); | |
589 | %name(wxPreStaticLine)wxStaticLine(); | |
590 | ||
591 | bool Create( wxWindow *parent, wxWindowID id, | |
592 | const wxPoint &pos = wxDefaultPosition, | |
593 | const wxSize &size = wxDefaultSize, | |
594 | long style = wxLI_HORIZONTAL, | |
595 | const wxString& name = wxPyStaticTextNameStr); | |
596 | ||
597 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
598 | %pragma(python) addtomethod = "wxPreStaticLine:val._setOORInfo(val)" | |
599 | }; | |
600 | ||
601 | ||
602 | //---------------------------------------------------------------------- | |
603 | ||
604 | class wxStaticText : public wxControl { | |
605 | public: | |
606 | wxStaticText(wxWindow* parent, wxWindowID id, const wxString& label, | |
607 | const wxPoint& pos = wxDefaultPosition, | |
608 | const wxSize& size = wxDefaultSize, | |
609 | long style = 0, | |
610 | const wxString& name = wxPyStaticTextNameStr); | |
611 | %name(wxPreStaticText)wxStaticText(); | |
612 | ||
613 | bool Create(wxWindow* parent, wxWindowID id, const wxString& label, | |
614 | const wxPoint& pos = wxDefaultPosition, | |
615 | const wxSize& size = wxDefaultSize, | |
616 | long style = 0, | |
617 | const wxString& name = wxPyStaticTextNameStr); | |
618 | ||
619 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
620 | %pragma(python) addtomethod = "wxPreStaticText:val._setOORInfo(val)" | |
621 | ||
622 | wxString GetLabel(); | |
623 | void SetLabel(const wxString& label); | |
624 | }; | |
625 | ||
626 | //---------------------------------------------------------------------- | |
627 | ||
628 | class wxListBox : public wxControlWithItems { | |
629 | public: | |
630 | wxListBox(wxWindow* parent, wxWindowID id, | |
631 | const wxPoint& pos = wxDefaultPosition, | |
632 | const wxSize& size = wxDefaultSize, | |
633 | int LCOUNT, wxString* choices = NULL, | |
634 | long style = 0, | |
635 | const wxValidator& validator = wxDefaultValidator, | |
636 | const wxString& name = wxPyListBoxNameStr); | |
637 | %name(wxPreListBox)wxListBox(); | |
638 | ||
639 | bool Create(wxWindow* parent, wxWindowID id, | |
640 | const wxPoint& pos = wxDefaultPosition, | |
641 | const wxSize& size = wxDefaultSize, | |
642 | int LCOUNT, wxString* choices = NULL, | |
643 | long style = 0, | |
644 | const wxValidator& validator = wxDefaultValidator, | |
645 | const wxString& name = wxPyListBoxNameStr); | |
646 | ||
647 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
648 | %pragma(python) addtomethod = "wxPreListBox:val._setOORInfo(val)" | |
649 | ||
650 | void Clear(); | |
651 | void Deselect(int n); | |
652 | ||
653 | // int GetSelections(int **selections); | |
654 | %addmethods { | |
655 | PyObject* GetSelections() { | |
656 | wxArrayInt lst; | |
657 | self->GetSelections(lst); | |
658 | PyObject *tup = PyTuple_New(lst.GetCount()); | |
659 | for(size_t i=0; i<lst.GetCount(); i++) { | |
660 | PyTuple_SetItem(tup, i, PyInt_FromLong(lst[i])); | |
661 | } | |
662 | return tup; | |
663 | } | |
664 | } | |
665 | ||
666 | ||
667 | void InsertItems(int LCOUNT, wxString* choices, int pos); | |
668 | ||
669 | bool IsSelected(const int n); | |
670 | bool Selected(const int n); | |
671 | void Set(int LCOUNT, wxString* choices); | |
672 | void SetFirstItem(int n); | |
673 | %name(SetFirstItemStr)void SetFirstItem(const wxString& string); | |
674 | void SetSelection(int n, bool select = TRUE); | |
675 | void SetString(int n, const wxString& string); | |
676 | void SetStringSelection(const wxString& string, bool select = TRUE); | |
677 | }; | |
678 | ||
679 | ||
680 | //---------------------------------------------------------------------- | |
681 | ||
682 | class wxCheckListBox : public wxListBox { | |
683 | public: | |
684 | wxCheckListBox(wxWindow *parent, wxWindowID id, | |
685 | const wxPoint& pos = wxDefaultPosition, | |
686 | const wxSize& size = wxDefaultSize, | |
687 | int LCOUNT = 0, | |
688 | wxString* choices = NULL, | |
689 | long style = 0, | |
690 | const wxValidator& validator = wxDefaultValidator, | |
691 | const wxString& name = wxPyListBoxNameStr); | |
692 | %name(wxPreCheckListBox)wxCheckListBox(); | |
693 | ||
694 | bool Create(wxWindow *parent, wxWindowID id, | |
695 | const wxPoint& pos = wxDefaultPosition, | |
696 | const wxSize& size = wxDefaultSize, | |
697 | int LCOUNT = 0, | |
698 | wxString* choices = NULL, | |
699 | long style = 0, | |
700 | const wxValidator& validator = wxDefaultValidator, | |
701 | const wxString& name = wxPyListBoxNameStr); | |
702 | ||
703 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
704 | %pragma(python) addtomethod = "wxPreCheckListBox:val._setOORInfo(val)" | |
705 | ||
706 | bool IsChecked(int uiIndex); | |
707 | void Check(int uiIndex, int bCheck = TRUE); | |
708 | void InsertItems(int LCOUNT, wxString* choices, int pos); | |
709 | ||
710 | #ifndef __WXMAC__ | |
711 | int GetItemHeight(); | |
712 | #endif | |
713 | ||
714 | // return the index of the item at this position or wxNOT_FOUND | |
715 | int HitTest(const wxPoint& pt) const; | |
716 | %name(HitTestXY)int HitTest(wxCoord x, wxCoord y) const; | |
717 | ||
718 | }; | |
719 | ||
720 | //---------------------------------------------------------------------- | |
721 | ||
722 | ||
723 | class wxTextAttr | |
724 | { | |
725 | public: | |
726 | // ctors | |
727 | wxTextAttr(const wxColour& colText = wxNullColour, | |
728 | const wxColour& colBack = wxNullColour, | |
729 | const wxFont& font = wxNullFont); | |
730 | ~wxTextAttr(); | |
731 | ||
732 | // setters | |
733 | void SetTextColour(const wxColour& colText); | |
734 | void SetBackgroundColour(const wxColour& colBack); | |
735 | void SetFont(const wxFont& font); | |
736 | ||
737 | // accessors | |
738 | bool HasTextColour() const; | |
739 | bool HasBackgroundColour() const; | |
740 | bool HasFont() const; | |
741 | ||
742 | wxColour GetTextColour() const; | |
743 | wxColour GetBackgroundColour() const; | |
744 | wxFont GetFont() const; | |
745 | ||
746 | // returns false if we have any attributes set, true otherwise | |
747 | bool IsDefault(); | |
748 | ||
749 | // return the attribute having the valid font and colours: it uses the | |
750 | // attributes set in attr and falls back first to attrDefault and then to | |
751 | // the text control font/colours for those attributes which are not set | |
752 | static wxTextAttr Combine(const wxTextAttr& attr, | |
753 | const wxTextAttr& attrDef, | |
754 | const wxTextCtrl *text); | |
755 | }; | |
756 | ||
757 | ||
758 | ||
759 | class wxTextCtrl : public wxControl { | |
760 | public: | |
761 | wxTextCtrl(wxWindow* parent, wxWindowID id, | |
762 | const wxString& value = wxPyEmptyString, | |
763 | const wxPoint& pos = wxDefaultPosition, | |
764 | const wxSize& size = wxDefaultSize, | |
765 | long style = 0, | |
766 | const wxValidator& validator = wxDefaultValidator, | |
767 | const wxString& name = wxPyTextCtrlNameStr); | |
768 | %name(wxPreTextCtrl)wxTextCtrl(); | |
769 | ||
770 | bool Create(wxWindow* parent, wxWindowID id, | |
771 | const wxString& value = wxPyEmptyString, | |
772 | const wxPoint& pos = wxDefaultPosition, | |
773 | const wxSize& size = wxDefaultSize, | |
774 | long style = 0, | |
775 | const wxValidator& validator = wxDefaultValidator, | |
776 | const wxString& name = wxPyTextCtrlNameStr); | |
777 | ||
778 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
779 | %pragma(python) addtomethod = "wxPreTextCtrl:val._setOORInfo(val)" | |
780 | ||
781 | ||
782 | wxString GetValue() const; | |
783 | void SetValue(const wxString& value); | |
784 | ||
785 | wxString GetRange(long from, long to); | |
786 | ||
787 | int GetLineLength(long lineNo) const; | |
788 | wxString GetLineText(long lineNo) const; | |
789 | int GetNumberOfLines() const; | |
790 | ||
791 | bool IsModified() const; | |
792 | bool IsEditable() const; | |
793 | ||
794 | // If the return values from and to are the same, there is no selection. | |
795 | void GetSelection(long* OUTPUT, long* OUTPUT) const; | |
796 | wxString GetStringSelection(); | |
797 | ||
798 | void Clear(); | |
799 | void Replace(long from, long to, const wxString& value); | |
800 | void Remove(long from, long to); | |
801 | ||
802 | // load/save the controls contents from/to the file | |
803 | bool LoadFile(const wxString& file); | |
804 | bool SaveFile(const wxString& file = wxPyEmptyString); | |
805 | ||
806 | // clears the dirty flag | |
807 | void DiscardEdits(); | |
808 | ||
809 | // set the max number of characters which may be entered in a single line | |
810 | // text control | |
811 | void SetMaxLength(unsigned long len); | |
812 | ||
813 | // writing text inserts it at the current position, appending always | |
814 | // inserts it at the end | |
815 | void WriteText(const wxString& text); | |
816 | void AppendText(const wxString& text); | |
817 | ||
818 | // insert the character which would have resulted from this key event, | |
819 | // return TRUE if anything has been inserted | |
820 | bool EmulateKeyPress(const wxKeyEvent& event); | |
821 | ||
822 | // text control under some platforms supports the text styles: these | |
823 | // methods allow to apply the given text style to the given selection or to | |
824 | // set/get the style which will be used for all appended text | |
825 | bool SetStyle(long start, long end, const wxTextAttr& style); | |
826 | bool SetDefaultStyle(const wxTextAttr& style); | |
827 | const wxTextAttr& GetDefaultStyle() const; | |
828 | ||
829 | // translate between the position (which is just an index in the text ctrl | |
830 | // considering all its contents as a single strings) and (x, y) coordinates | |
831 | // which represent column and line. | |
832 | long XYToPosition(long x, long y) const; | |
833 | void PositionToXY(long pos, long *OUTPUT, long *OUTPUT) const; | |
834 | ||
835 | //bool PositionToXY(long pos, long *OUTPUT, long *OUTPUT) const; | |
836 | // TODO: check return value, raise exception. | |
837 | ||
838 | void ShowPosition(long pos); | |
839 | ||
840 | // Clipboard operations | |
841 | void Copy(); | |
842 | void Cut(); | |
843 | void Paste(); | |
844 | ||
845 | bool CanCopy() const; | |
846 | bool CanCut() const; | |
847 | bool CanPaste() const; | |
848 | ||
849 | // Undo/redo | |
850 | void Undo(); | |
851 | void Redo(); | |
852 | ||
853 | bool CanUndo() const; | |
854 | bool CanRedo() const; | |
855 | ||
856 | // Insertion point | |
857 | void SetInsertionPoint(long pos); | |
858 | void SetInsertionPointEnd(); | |
859 | long GetInsertionPoint() const; | |
860 | long GetLastPosition() const; | |
861 | ||
862 | void SetSelection(long from, long to); | |
863 | void SelectAll(); | |
864 | void SetEditable(bool editable); | |
865 | ||
866 | bool IsSingleLine(); | |
867 | bool IsMultiLine(); | |
868 | ||
869 | ||
870 | %addmethods { | |
871 | void write(const wxString& text) { | |
872 | self->AppendText(text); | |
873 | } | |
874 | } | |
875 | ||
876 | // TODO: replace this when the method is really added to wxTextCtrl | |
877 | %addmethods { | |
878 | wxString GetString(long from, long to) { | |
879 | return self->GetValue().Mid(from, to - from); | |
880 | } | |
881 | } | |
882 | }; | |
883 | ||
884 | //---------------------------------------------------------------------- | |
885 | ||
886 | class wxScrollBar : public wxControl { | |
887 | public: | |
888 | wxScrollBar(wxWindow* parent, wxWindowID id = -1, | |
889 | const wxPoint& pos = wxDefaultPosition, | |
890 | const wxSize& size = wxDefaultSize, | |
891 | long style = wxSB_HORIZONTAL, | |
892 | const wxValidator& validator = wxDefaultValidator, | |
893 | const wxString& name = wxPyScrollBarNameStr); | |
894 | %name(wxPreScrollBar)wxScrollBar(); | |
895 | ||
896 | bool Create(wxWindow* parent, wxWindowID id = -1, | |
897 | const wxPoint& pos = wxDefaultPosition, | |
898 | const wxSize& size = wxDefaultSize, | |
899 | long style = wxSB_HORIZONTAL, | |
900 | const wxValidator& validator = wxDefaultValidator, | |
901 | const wxString& name = wxPyScrollBarNameStr); | |
902 | ||
903 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
904 | %pragma(python) addtomethod = "wxPreScrollBar:val._setOORInfo(val)" | |
905 | ||
906 | int GetRange(); | |
907 | int GetPageSize(); | |
908 | int GetThumbPosition(); | |
909 | int GetThumbSize(); | |
910 | %name(GetThumbLength) int GetThumbSize(); // to match the docs | |
911 | ||
912 | bool IsVertical(); | |
913 | ||
914 | void SetThumbPosition(int viewStart); | |
915 | void SetScrollbar(int position, int thumbSize, | |
916 | int range, int pageSize, | |
917 | bool refresh = TRUE); | |
918 | }; | |
919 | ||
920 | //---------------------------------------------------------------------- | |
921 | ||
922 | class wxSpinButton : public wxControl { | |
923 | public: | |
924 | wxSpinButton(wxWindow* parent, wxWindowID id = -1, | |
925 | const wxPoint& pos = wxDefaultPosition, | |
926 | const wxSize& size = wxDefaultSize, | |
927 | long style = wxSP_HORIZONTAL, | |
928 | const wxString& name = wxPySPIN_BUTTON_NAME); | |
929 | %name(wxPreSpinButton)wxSpinButton(); | |
930 | ||
931 | bool Create(wxWindow* parent, wxWindowID id = -1, | |
932 | const wxPoint& pos = wxDefaultPosition, | |
933 | const wxSize& size = wxDefaultSize, | |
934 | long style = wxSP_HORIZONTAL, | |
935 | const wxString& name = wxPySPIN_BUTTON_NAME); | |
936 | ||
937 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
938 | %pragma(python) addtomethod = "wxPreSpinButton:val._setOORInfo(val)" | |
939 | ||
940 | int GetMax(); | |
941 | int GetMin(); | |
942 | int GetValue(); | |
943 | void SetRange(int min, int max); | |
944 | void SetValue(int value); | |
945 | }; | |
946 | ||
947 | //---------------------------------------------------------------------- | |
948 | ||
949 | class wxStaticBitmap : public wxControl { | |
950 | public: | |
951 | wxStaticBitmap(wxWindow* parent, wxWindowID id, | |
952 | const wxBitmap& bitmap, | |
953 | const wxPoint& pos = wxDefaultPosition, | |
954 | const wxSize& size = wxDefaultSize, | |
955 | long style = 0, | |
956 | const wxString& name = wxPyStaticBitmapNameStr); | |
957 | %name(wxPreStaticBitmap)wxStaticBitmap(); | |
958 | ||
959 | bool Create(wxWindow* parent, wxWindowID id, | |
960 | const wxBitmap& bitmap, | |
961 | const wxPoint& pos = wxDefaultPosition, | |
962 | const wxSize& size = wxDefaultSize, | |
963 | long style = 0, | |
964 | const wxString& name = wxPyStaticBitmapNameStr); | |
965 | ||
966 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
967 | %pragma(python) addtomethod = "wxPreStaticBitmap:val._setOORInfo(val)" | |
968 | ||
969 | wxBitmap GetBitmap(); | |
970 | void SetBitmap(const wxBitmap& bitmap); | |
971 | void SetIcon(const wxIcon& icon); | |
972 | }; | |
973 | ||
974 | //---------------------------------------------------------------------- | |
975 | ||
976 | class wxRadioBox : public wxControl { | |
977 | public: | |
978 | wxRadioBox(wxWindow* parent, wxWindowID id, | |
979 | const wxString& label, | |
980 | const wxPoint& point = wxDefaultPosition, | |
981 | const wxSize& size = wxDefaultSize, | |
982 | int LCOUNT = 0, wxString* choices = NULL, | |
983 | int majorDimension = 0, | |
984 | long style = wxRA_HORIZONTAL, | |
985 | const wxValidator& validator = wxDefaultValidator, | |
986 | const wxString& name = wxPyRadioBoxNameStr); | |
987 | %name(wxPreRadioBox)wxRadioBox(); | |
988 | ||
989 | bool Create(wxWindow* parent, wxWindowID id, | |
990 | const wxString& label, | |
991 | const wxPoint& point = wxDefaultPosition, | |
992 | const wxSize& size = wxDefaultSize, | |
993 | int LCOUNT = 0, wxString* choices = NULL, | |
994 | int majorDimension = 0, | |
995 | long style = wxRA_HORIZONTAL, | |
996 | const wxValidator& validator = wxDefaultValidator, | |
997 | const wxString& name = wxPyRadioBoxNameStr); | |
998 | ||
999 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
1000 | %pragma(python) addtomethod = "wxPreRadioBox:val._setOORInfo(val)" | |
1001 | ||
1002 | void Enable(bool enable); | |
1003 | %name(EnableItem)void Enable(int n, bool enable); | |
1004 | int FindString(const wxString& string); | |
1005 | ||
1006 | wxString GetString(int n); | |
1007 | void SetString(int n, const wxString& label); | |
1008 | %pragma(python) addtoclass = " | |
1009 | GetItemLabel = GetString | |
1010 | SetItemLabel = SetString | |
1011 | " | |
1012 | #ifndef __WXGTK__ | |
1013 | int GetColumnCount(); | |
1014 | int GetRowCount(); | |
1015 | int GetNextItem(int item, wxDirection dir, long style); | |
1016 | #endif | |
1017 | ||
1018 | int GetSelection(); | |
1019 | wxString GetStringSelection(); | |
1020 | int GetCount(); | |
1021 | %pragma(python) addtoclass = "Number = GetCount" | |
1022 | ||
1023 | void SetSelection(int n); | |
1024 | void SetStringSelection(const wxString& string); | |
1025 | void Show(bool show); | |
1026 | %name(ShowItem)void Show(int item, bool show); | |
1027 | }; | |
1028 | ||
1029 | //---------------------------------------------------------------------- | |
1030 | ||
1031 | class wxRadioButton : public wxControl { | |
1032 | public: | |
1033 | wxRadioButton(wxWindow* parent, wxWindowID id, | |
1034 | const wxString& label, | |
1035 | const wxPoint& pos = wxDefaultPosition, | |
1036 | const wxSize& size = wxDefaultSize, | |
1037 | long style = 0, | |
1038 | const wxValidator& validator = wxDefaultValidator, | |
1039 | const wxString& name = wxPyRadioButtonNameStr); | |
1040 | %name(wxPreRadioButton)wxRadioButton(); | |
1041 | ||
1042 | bool Create(wxWindow* parent, wxWindowID id, | |
1043 | const wxString& label, | |
1044 | const wxPoint& pos = wxDefaultPosition, | |
1045 | const wxSize& size = wxDefaultSize, | |
1046 | long style = 0, | |
1047 | const wxValidator& validator = wxDefaultValidator, | |
1048 | const wxString& name = wxPyRadioButtonNameStr); | |
1049 | ||
1050 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
1051 | %pragma(python) addtomethod = "wxPreRadioButton:val._setOORInfo(val)" | |
1052 | ||
1053 | bool GetValue(); | |
1054 | void SetValue(bool value); | |
1055 | }; | |
1056 | ||
1057 | //---------------------------------------------------------------------- | |
1058 | ||
1059 | class wxSlider : public wxControl { | |
1060 | public: | |
1061 | wxSlider(wxWindow* parent, wxWindowID id, | |
1062 | int value, int minValue, int maxValue, | |
1063 | const wxPoint& point = wxDefaultPosition, | |
1064 | const wxSize& size = wxDefaultSize, | |
1065 | long style = wxSL_HORIZONTAL, | |
1066 | const wxValidator& validator = wxDefaultValidator, | |
1067 | const wxString& name = wxPySliderNameStr); | |
1068 | %name(wxPreSlider)wxSlider(); | |
1069 | ||
1070 | bool Create(wxWindow* parent, wxWindowID id, | |
1071 | int value, int minValue, int maxValue, | |
1072 | const wxPoint& point = wxDefaultPosition, | |
1073 | const wxSize& size = wxDefaultSize, | |
1074 | long style = wxSL_HORIZONTAL, | |
1075 | const wxValidator& validator = wxDefaultValidator, | |
1076 | const wxString& name = wxPySliderNameStr); | |
1077 | ||
1078 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
1079 | %pragma(python) addtomethod = "wxPreSlider:val._setOORInfo(val)" | |
1080 | ||
1081 | void ClearSel(); | |
1082 | void ClearTicks(); | |
1083 | int GetLineSize(); | |
1084 | int GetMax(); | |
1085 | int GetMin(); | |
1086 | int GetPageSize(); | |
1087 | int GetSelEnd(); | |
1088 | int GetSelStart(); | |
1089 | int GetThumbLength(); | |
1090 | int GetTickFreq(); | |
1091 | int GetValue(); | |
1092 | void SetRange(int minValue, int maxValue); | |
1093 | void SetTickFreq(int n, int pos); | |
1094 | void SetLineSize(int lineSize); | |
1095 | void SetPageSize(int pageSize); | |
1096 | void SetSelection(int startPos, int endPos); | |
1097 | void SetThumbLength(int len); | |
1098 | void SetTick(int tickPos); | |
1099 | void SetValue(int value); | |
1100 | }; | |
1101 | ||
1102 | ||
1103 | //---------------------------------------------------------------------- | |
1104 | ||
1105 | class wxSpinCtrl : public wxSpinButton { | |
1106 | public: | |
1107 | wxSpinCtrl(wxWindow *parent, | |
1108 | wxWindowID id = -1, | |
1109 | const wxString& value = wxPyEmptyString, | |
1110 | const wxPoint& pos = wxDefaultPosition, | |
1111 | const wxSize& size = wxDefaultSize, | |
1112 | long style = wxSP_ARROW_KEYS, | |
1113 | int min = 0, int max = 100, int initial = 0, | |
1114 | const wxString& name = wxPySpinCtrlNameStr); | |
1115 | %name(wxPreSpinCtrl)wxSpinCtrl(); | |
1116 | ||
1117 | bool Create(wxWindow *parent, | |
1118 | wxWindowID id = -1, | |
1119 | const wxString& value = wxPyEmptyString, | |
1120 | const wxPoint& pos = wxDefaultPosition, | |
1121 | const wxSize& size = wxDefaultSize, | |
1122 | long style = wxSP_ARROW_KEYS, | |
1123 | int min = 0, int max = 100, int initial = 0, | |
1124 | const wxString& name = wxPySpinCtrlNameStr); | |
1125 | ||
1126 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
1127 | %pragma(python) addtomethod = "wxPreSpinCtrl:val._setOORInfo(val)" | |
1128 | ||
1129 | int GetMax(); | |
1130 | int GetMin(); | |
1131 | int GetValue(); | |
1132 | void SetRange(int min, int max); | |
1133 | void SetValue(int value); | |
1134 | ||
1135 | }; | |
1136 | ||
1137 | ||
1138 | //---------------------------------------------------------------------- | |
1139 | ||
1140 | #ifndef __WXMAC__ | |
1141 | enum { wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, }; | |
1142 | ||
1143 | class wxToggleButton : public wxControl { | |
1144 | public: | |
1145 | wxToggleButton(wxWindow *parent, | |
1146 | wxWindowID id, | |
1147 | const wxString& label, | |
1148 | const wxPoint& pos = wxDefaultPosition, | |
1149 | const wxSize& size = wxDefaultSize, | |
1150 | long style = 0, | |
1151 | const wxValidator& validator = wxDefaultValidator, | |
1152 | const wxString& name = wxPyCheckBoxNameStr); | |
1153 | %name(wxPreToggleButton)wxToggleButton(); | |
1154 | ||
1155 | bool Create(wxWindow *parent, | |
1156 | wxWindowID id, | |
1157 | const wxString& label, | |
1158 | const wxPoint& pos = wxDefaultPosition, | |
1159 | const wxSize& size = wxDefaultSize, | |
1160 | long style = 0, | |
1161 | const wxValidator& validator = wxDefaultValidator, | |
1162 | const wxString& name = wxPyCheckBoxNameStr); | |
1163 | ||
1164 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
1165 | %pragma(python) addtomethod = "wxPreToggleButton:val._setOORInfo(val)" | |
1166 | ||
1167 | void SetValue(bool value); | |
1168 | bool GetValue() const ; | |
1169 | void SetLabel(const wxString& label); | |
1170 | ||
1171 | }; | |
1172 | ||
1173 | #endif | |
1174 | ||
1175 | //---------------------------------------------------------------------- | |
1176 | //---------------------------------------------------------------------- | |
1177 | //---------------------------------------------------------------------- | |
1178 | ||
1179 | ||
1180 |