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