]>
Commit | Line | Data |
---|---|---|
7bf85405 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: controls.i | |
3 | // Purpose: Control (widget) classes for wxPython | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 6/10/98 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 1998 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
03e9bead | 13 | %module controls |
7bf85405 | 14 | |
03e9bead | 15 | %{ |
7bf85405 RD |
16 | #include "helpers.h" |
17 | #include <wx/slider.h> | |
62bd0874 | 18 | #include <wx/spinbutt.h> |
f6bcfd97 | 19 | #include <wx/spinctrl.h> |
cf694132 | 20 | #include <wx/dynarray.h> |
8bf5d46e | 21 | #include <wx/statline.h> |
d1679124 | 22 | #include <wx/tglbtn.h> |
fb5e0af0 RD |
23 | |
24 | #ifdef __WXMSW__ | |
9c039d08 RD |
25 | #if wxUSE_OWNER_DRAWN |
26 | #include <wx/checklst.h> | |
27 | #endif | |
fb5e0af0 | 28 | #endif |
c95e68d8 RD |
29 | |
30 | #ifdef __WXGTK__ | |
31 | #include <wx/checklst.h> | |
32 | #endif | |
7bf85405 RD |
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 | ||
b8b8dda7 | 47 | %pragma(python) code = "import wx" |
9c039d08 | 48 | |
7bf85405 RD |
49 | //---------------------------------------------------------------------- |
50 | ||
2f90df85 RD |
51 | %readonly |
52 | wxValidator wxDefaultValidator; | |
53 | %readwrite | |
54 | ||
7bf85405 RD |
55 | //---------------------------------------------------------------------- |
56 | ||
137b5242 RD |
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 | //---------------------------------------------------------------------- | |
4268f798 RD |
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. | |
7bf85405 RD |
90 | class wxControl : public wxWindow { |
91 | public: | |
4268f798 RD |
92 | |
93 | // | |
9b3d3bc4 | 94 | wxControl(wxWindow *parent, |
b0e5c039 RD |
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); | |
4268f798 RD |
101 | |
102 | // | |
09f3d4e6 RD |
103 | %name(wxPreControl)wxControl(); |
104 | ||
4268f798 | 105 | // |
09f3d4e6 RD |
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, | |
137b5242 | 112 | const wxString& name=wxPyControlNameStr); |
9b3d3bc4 | 113 | |
0122b7e3 | 114 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 115 | %pragma(python) addtomethod = "wxPreControl:val._setOORInfo(val)" |
6999b0d8 | 116 | |
4268f798 RD |
117 | // Simulates the effect of the user issuing a command to the item. See |
118 | // wxCommandEvent. | |
7bf85405 | 119 | void Command(wxCommandEvent& event); |
4268f798 RD |
120 | |
121 | // Return a control's text. | |
fb5e0af0 | 122 | wxString GetLabel(); |
4268f798 RD |
123 | |
124 | // Sets the item's text. | |
7bf85405 RD |
125 | void SetLabel(const wxString& label); |
126 | }; | |
127 | ||
6999b0d8 | 128 | |
7bf85405 RD |
129 | //---------------------------------------------------------------------- |
130 | ||
900d9886 RD |
131 | |
132 | class wxControlWithItems : public wxControl { | |
133 | public: | |
134 | ||
135 | // void Clear(); ambiguous, redefine below... | |
4268f798 RD |
136 | |
137 | // Deletes an item from the control | |
900d9886 RD |
138 | void Delete(int n); |
139 | ||
4268f798 | 140 | // Returns the number of items in the control. |
900d9886 RD |
141 | int GetCount(); |
142 | %pragma(python) addtoclass = "Number = GetCount" | |
4268f798 RD |
143 | |
144 | // Returns the string at the given position. | |
900d9886 | 145 | wxString GetString(int n); |
4268f798 RD |
146 | |
147 | // Sets the string value of an item. | |
900d9886 | 148 | void SetString(int n, const wxString& s); |
4268f798 RD |
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. | |
900d9886 RD |
152 | int FindString(const wxString& s); |
153 | ||
4268f798 | 154 | // Select the item at postion n. |
900d9886 | 155 | void Select(int n); |
4268f798 RD |
156 | |
157 | // Gets the position of the selected item. | |
900d9886 RD |
158 | int GetSelection(); |
159 | ||
4268f798 | 160 | // Gets the current selection as a string. |
900d9886 RD |
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); | |
4268f798 RD |
167 | |
168 | ||
900d9886 | 169 | %addmethods { |
4268f798 RD |
170 | // Adds the item to the control, associating the given data with the |
171 | // item if not None. | |
900d9886 RD |
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 | ||
4268f798 | 180 | // Returns the client data associated with the given item, (if any.) |
900d9886 RD |
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 | ||
4268f798 | 192 | // Associate the given client data with the item at position n. |
900d9886 RD |
193 | void SetClientData(int n, PyObject* clientData) { |
194 | wxPyClientData* data = new wxPyClientData(clientData); | |
195 | self->SetClientObject(n, data); | |
196 | } | |
197 | } | |
198 | ||
ce914f73 RD |
199 | // append several items at once to the control |
200 | %name(AppendItems)void Append(const wxArrayString& strings); | |
201 | ||
900d9886 | 202 | }; |
4268f798 | 203 | |
900d9886 RD |
204 | //---------------------------------------------------------------------- |
205 | ||
4268f798 RD |
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 | // | |
7bf85405 RD |
222 | class wxButton : public wxControl { |
223 | public: | |
4268f798 RD |
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. | |
7bf85405 | 235 | wxButton(wxWindow* parent, wxWindowID id, const wxString& label, |
b68dc582 RD |
236 | const wxPoint& pos = wxDefaultPosition, |
237 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 238 | long style = 0, |
b68dc582 | 239 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 240 | const wxString& name = wxPyButtonNameStr); |
4268f798 RD |
241 | |
242 | // Default constructor | |
09f3d4e6 RD |
243 | %name(wxPreButton)wxButton(); |
244 | ||
4268f798 | 245 | // Button creation function for two-step creation. |
09f3d4e6 RD |
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, | |
137b5242 | 251 | const wxString& name = wxPyButtonNameStr); |
9c039d08 | 252 | |
0122b7e3 | 253 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 254 | %pragma(python) addtomethod = "wxPreButton:val._setOORInfo(val)" |
9c039d08 | 255 | |
4268f798 RD |
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. | |
7bf85405 | 263 | void SetDefault(); |
4268f798 RD |
264 | |
265 | // | |
9b3d3bc4 | 266 | void SetBackgroundColour(const wxColour& colour); |
4268f798 | 267 | // |
9b3d3bc4 | 268 | void SetForegroundColour(const wxColour& colour); |
4268f798 | 269 | |
059a841c | 270 | #ifdef __WXMSW__ |
4268f798 | 271 | // show the image in the button in addition to the label |
09f3d4e6 | 272 | void SetImageLabel(const wxBitmap& bitmap); |
4268f798 RD |
273 | |
274 | // set the margins around the image | |
09f3d4e6 | 275 | void SetImageMargins(wxCoord x, wxCoord y); |
059a841c | 276 | #endif |
4268f798 RD |
277 | |
278 | // returns the default button size for this platform | |
09f3d4e6 RD |
279 | static wxSize GetDefaultSize(); |
280 | }; | |
6999b0d8 | 281 | |
7bf85405 RD |
282 | //---------------------------------------------------------------------- |
283 | ||
284 | class wxBitmapButton : public wxButton { | |
285 | public: | |
286 | wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, | |
b68dc582 RD |
287 | const wxPoint& pos = wxDefaultPosition, |
288 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 289 | long style = wxBU_AUTODRAW, |
b68dc582 | 290 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 291 | const wxString& name = wxPyButtonNameStr); |
09f3d4e6 RD |
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, | |
137b5242 | 299 | const wxString& name = wxPyButtonNameStr); |
7bf85405 | 300 | |
0122b7e3 | 301 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 302 | %pragma(python) addtomethod = "wxPreBitmapButton:val._setOORInfo(val)" |
9c039d08 | 303 | |
c5943253 RD |
304 | wxBitmap GetBitmapLabel(); |
305 | wxBitmap GetBitmapDisabled(); | |
306 | wxBitmap GetBitmapFocus(); | |
307 | wxBitmap GetBitmapSelected(); | |
7bf85405 RD |
308 | void SetBitmapDisabled(const wxBitmap& bitmap); |
309 | void SetBitmapFocus(const wxBitmap& bitmap); | |
7bf85405 | 310 | void SetBitmapSelected(const wxBitmap& bitmap); |
fb5e0af0 | 311 | void SetBitmapLabel(const wxBitmap& bitmap); |
7bf85405 | 312 | |
f6bcfd97 BP |
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; } | |
7bf85405 RD |
316 | }; |
317 | ||
318 | //---------------------------------------------------------------------- | |
319 | ||
320 | class wxCheckBox : public wxControl { | |
321 | public: | |
322 | wxCheckBox(wxWindow* parent, wxWindowID id, const wxString& label, | |
b68dc582 RD |
323 | const wxPoint& pos = wxDefaultPosition, |
324 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 325 | long style = 0, |
b68dc582 | 326 | const wxValidator& val = wxDefaultValidator, |
137b5242 | 327 | const wxString& name = wxPyCheckBoxNameStr); |
09f3d4e6 RD |
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, | |
137b5242 | 335 | const wxString& name = wxPyCheckBoxNameStr); |
7bf85405 | 336 | |
0122b7e3 | 337 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 338 | %pragma(python) addtomethod = "wxPreCheckBox:val._setOORInfo(val)" |
9c039d08 | 339 | |
7bf85405 | 340 | bool GetValue(); |
1e4a197e | 341 | bool IsChecked(); |
7bf85405 RD |
342 | void SetValue(const bool state); |
343 | }; | |
344 | ||
345 | //---------------------------------------------------------------------- | |
346 | ||
900d9886 | 347 | class wxChoice : public wxControlWithItems { |
7bf85405 RD |
348 | public: |
349 | wxChoice(wxWindow *parent, wxWindowID id, | |
b68dc582 RD |
350 | const wxPoint& pos = wxDefaultPosition, |
351 | const wxSize& size = wxDefaultSize, | |
eec92d76 | 352 | int LCOUNT=0, wxString* choices=NULL, |
7bf85405 | 353 | long style = 0, |
b68dc582 | 354 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 355 | const wxString& name = wxPyChoiceNameStr); |
09f3d4e6 RD |
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, | |
137b5242 | 364 | const wxString& name = wxPyChoiceNameStr); |
7bf85405 | 365 | |
0122b7e3 | 366 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 367 | %pragma(python) addtomethod = "wxPreChoice:val._setOORInfo(val)" |
0122b7e3 | 368 | |
7bf85405 | 369 | void Clear(); |
900d9886 | 370 | |
7bf85405 | 371 | int GetColumns(); |
7bf85405 RD |
372 | void SetColumns(const int n = 1); |
373 | void SetSelection(const int n); | |
374 | void SetStringSelection(const wxString& string); | |
0adbc166 RD |
375 | void SetString(int n, const wxString& s); |
376 | ||
377 | %pragma(python) addtoclass = " | |
0adbc166 RD |
378 | Select = SetSelection |
379 | " | |
7bf85405 RD |
380 | }; |
381 | ||
382 | //---------------------------------------------------------------------- | |
383 | ||
c70fd24f RD |
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: | |
137b5242 RD |
392 | wxComboBox(wxWindow* parent, wxWindowID id, |
393 | const wxString& value = wxPyEmptyString, | |
c70fd24f RD |
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, | |
137b5242 | 399 | const wxString& name = wxPyComboBoxNameStr); |
c70fd24f RD |
400 | %name(wxPreComboBox)wxComboBox(); |
401 | ||
137b5242 RD |
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); | |
c70fd24f RD |
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 | ||
bb0054cd | 483 | class wxComboBox : public wxChoice { |
7bf85405 | 484 | public: |
137b5242 RD |
485 | wxComboBox(wxWindow* parent, wxWindowID id, |
486 | const wxString& value = wxPyEmptyString, | |
b68dc582 RD |
487 | const wxPoint& pos = wxDefaultPosition, |
488 | const wxSize& size = wxDefaultSize, | |
eec92d76 | 489 | int LCOUNT=0, wxString* choices=NULL, |
7bf85405 | 490 | long style = 0, |
b68dc582 | 491 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 492 | const wxString& name = wxPyComboBoxNameStr); |
09f3d4e6 RD |
493 | %name(wxPreComboBox)wxComboBox(); |
494 | ||
137b5242 RD |
495 | bool Create(wxWindow* parent, wxWindowID id, |
496 | const wxString& value = wxPyEmptyString, | |
09f3d4e6 RD |
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, | |
137b5242 | 502 | const wxString& name = wxPyComboBoxNameStr); |
7bf85405 | 503 | |
0122b7e3 | 504 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 505 | %pragma(python) addtomethod = "wxPreComboBox:val._setOORInfo(val)" |
9c039d08 | 506 | |
7bf85405 RD |
507 | void Copy(); |
508 | void Cut(); | |
7bf85405 RD |
509 | long GetInsertionPoint(); |
510 | long GetLastPosition(); | |
7bf85405 | 511 | wxString GetValue(); |
7bf85405 RD |
512 | void Paste(); |
513 | void Replace(long from, long to, const wxString& text); | |
514 | void Remove(long from, long to); | |
7bf85405 RD |
515 | void SetInsertionPoint(long pos); |
516 | void SetInsertionPointEnd(); | |
1d99702e | 517 | void SetSelection(int n); |
7bf85405 RD |
518 | %name(SetMark)void SetSelection(long from, long to); |
519 | void SetValue(const wxString& text); | |
0adbc166 | 520 | void SetEditable(bool editable); |
7bf85405 | 521 | }; |
c70fd24f RD |
522 | #endif |
523 | ||
7bf85405 RD |
524 | |
525 | //---------------------------------------------------------------------- | |
526 | ||
527 | class wxGauge : public wxControl { | |
528 | public: | |
529 | wxGauge(wxWindow* parent, wxWindowID id, int range, | |
b68dc582 RD |
530 | const wxPoint& pos = wxDefaultPosition, |
531 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 532 | long style = wxGA_HORIZONTAL, |
b68dc582 | 533 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 534 | const wxString& name = wxPyGaugeNameStr); |
09f3d4e6 RD |
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, | |
137b5242 | 542 | const wxString& name = wxPyGaugeNameStr); |
7bf85405 | 543 | |
0122b7e3 | 544 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 545 | %pragma(python) addtomethod = "wxPreGauge:val._setOORInfo(val)" |
9c039d08 | 546 | |
7bf85405 RD |
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, | |
b68dc582 RD |
562 | const wxPoint& pos = wxDefaultPosition, |
563 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 564 | long style = 0, |
137b5242 | 565 | const wxString& name = wxPyStaticBoxNameStr); |
09f3d4e6 RD |
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, | |
137b5242 | 572 | const wxString& name = wxPyStaticBoxNameStr); |
0122b7e3 RD |
573 | |
574 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
17c0e08c | 575 | %pragma(python) addtomethod = "wxPreStaticBox:val._setOORInfo(val)" |
7bf85405 RD |
576 | }; |
577 | ||
578 | ||
bb0054cd RD |
579 | //---------------------------------------------------------------------- |
580 | ||
8bf5d46e | 581 | |
bb0054cd RD |
582 | class wxStaticLine : public wxControl { |
583 | public: | |
584 | wxStaticLine( wxWindow *parent, wxWindowID id, | |
b68dc582 RD |
585 | const wxPoint &pos = wxDefaultPosition, |
586 | const wxSize &size = wxDefaultSize, | |
bb0054cd | 587 | long style = wxLI_HORIZONTAL, |
137b5242 | 588 | const wxString& name = wxPyStaticTextNameStr); |
09f3d4e6 RD |
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, | |
137b5242 | 595 | const wxString& name = wxPyStaticTextNameStr); |
0122b7e3 RD |
596 | |
597 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
17c0e08c | 598 | %pragma(python) addtomethod = "wxPreStaticLine:val._setOORInfo(val)" |
bb0054cd | 599 | }; |
8bf5d46e | 600 | |
bb0054cd | 601 | |
7bf85405 RD |
602 | //---------------------------------------------------------------------- |
603 | ||
604 | class wxStaticText : public wxControl { | |
605 | public: | |
606 | wxStaticText(wxWindow* parent, wxWindowID id, const wxString& label, | |
b68dc582 RD |
607 | const wxPoint& pos = wxDefaultPosition, |
608 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 609 | long style = 0, |
137b5242 | 610 | const wxString& name = wxPyStaticTextNameStr); |
09f3d4e6 RD |
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, | |
137b5242 | 617 | const wxString& name = wxPyStaticTextNameStr); |
7bf85405 | 618 | |
0122b7e3 | 619 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 620 | %pragma(python) addtomethod = "wxPreStaticText:val._setOORInfo(val)" |
9c039d08 | 621 | |
7bf85405 RD |
622 | wxString GetLabel(); |
623 | void SetLabel(const wxString& label); | |
624 | }; | |
625 | ||
626 | //---------------------------------------------------------------------- | |
627 | ||
900d9886 | 628 | class wxListBox : public wxControlWithItems { |
7bf85405 RD |
629 | public: |
630 | wxListBox(wxWindow* parent, wxWindowID id, | |
b68dc582 RD |
631 | const wxPoint& pos = wxDefaultPosition, |
632 | const wxSize& size = wxDefaultSize, | |
eec92d76 | 633 | int LCOUNT, wxString* choices = NULL, |
7bf85405 | 634 | long style = 0, |
b68dc582 | 635 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 636 | const wxString& name = wxPyListBoxNameStr); |
09f3d4e6 RD |
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, | |
137b5242 | 645 | const wxString& name = wxPyListBoxNameStr); |
7bf85405 | 646 | |
0122b7e3 | 647 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 648 | %pragma(python) addtomethod = "wxPreListBox:val._setOORInfo(val)" |
0122b7e3 | 649 | |
7bf85405 | 650 | void Clear(); |
7bf85405 | 651 | void Deselect(int n); |
cf694132 RD |
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()); | |
f6bcfd97 | 659 | for(size_t i=0; i<lst.GetCount(); i++) { |
cf694132 RD |
660 | PyTuple_SetItem(tup, i, PyInt_FromLong(lst[i])); |
661 | } | |
662 | return tup; | |
663 | } | |
664 | } | |
665 | ||
900d9886 | 666 | |
eec92d76 | 667 | void InsertItems(int LCOUNT, wxString* choices, int pos); |
2f90df85 | 668 | |
0adbc166 | 669 | bool IsSelected(const int n); |
7bf85405 | 670 | bool Selected(const int n); |
eec92d76 | 671 | void Set(int LCOUNT, wxString* choices); |
7bf85405 RD |
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 | ||
9c039d08 RD |
680 | //---------------------------------------------------------------------- |
681 | ||
9c039d08 RD |
682 | class wxCheckListBox : public wxListBox { |
683 | public: | |
684 | wxCheckListBox(wxWindow *parent, wxWindowID id, | |
b68dc582 RD |
685 | const wxPoint& pos = wxDefaultPosition, |
686 | const wxSize& size = wxDefaultSize, | |
9c039d08 | 687 | int LCOUNT = 0, |
eec92d76 | 688 | wxString* choices = NULL, |
9c039d08 | 689 | long style = 0, |
b68dc582 | 690 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 691 | const wxString& name = wxPyListBoxNameStr); |
09f3d4e6 RD |
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, | |
137b5242 | 701 | const wxString& name = wxPyListBoxNameStr); |
9c039d08 | 702 | |
0122b7e3 | 703 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 704 | %pragma(python) addtomethod = "wxPreCheckListBox:val._setOORInfo(val)" |
9c039d08 RD |
705 | |
706 | bool IsChecked(int uiIndex); | |
694759cf | 707 | void Check(int uiIndex, int bCheck = TRUE); |
eec92d76 | 708 | void InsertItems(int LCOUNT, wxString* choices, int pos); |
9c039d08 | 709 | |
e6056257 | 710 | #ifndef __WXMAC__ |
9c039d08 | 711 | int GetItemHeight(); |
e6056257 | 712 | #endif |
3b3ab7f6 RD |
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 | ||
9c039d08 | 718 | }; |
9c039d08 | 719 | |
7bf85405 RD |
720 | //---------------------------------------------------------------------- |
721 | ||
d56cebe7 RD |
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 | ||
c5943253 RD |
742 | wxColour GetTextColour() const; |
743 | wxColour GetBackgroundColour() const; | |
744 | wxFont GetFont() const; | |
98624b49 RD |
745 | |
746 | // returns false if we have any attributes set, true otherwise | |
747 | bool IsDefault(); | |
2f4e9287 RD |
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); | |
d56cebe7 RD |
755 | }; |
756 | ||
757 | ||
758 | ||
7bf85405 RD |
759 | class wxTextCtrl : public wxControl { |
760 | public: | |
137b5242 RD |
761 | wxTextCtrl(wxWindow* parent, wxWindowID id, |
762 | const wxString& value = wxPyEmptyString, | |
b68dc582 RD |
763 | const wxPoint& pos = wxDefaultPosition, |
764 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 765 | long style = 0, |
b68dc582 | 766 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 767 | const wxString& name = wxPyTextCtrlNameStr); |
09f3d4e6 RD |
768 | %name(wxPreTextCtrl)wxTextCtrl(); |
769 | ||
137b5242 RD |
770 | bool Create(wxWindow* parent, wxWindowID id, |
771 | const wxString& value = wxPyEmptyString, | |
09f3d4e6 RD |
772 | const wxPoint& pos = wxDefaultPosition, |
773 | const wxSize& size = wxDefaultSize, | |
774 | long style = 0, | |
775 | const wxValidator& validator = wxDefaultValidator, | |
137b5242 | 776 | const wxString& name = wxPyTextCtrlNameStr); |
7bf85405 | 777 | |
0122b7e3 | 778 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 779 | %pragma(python) addtomethod = "wxPreTextCtrl:val._setOORInfo(val)" |
9c039d08 | 780 | |
98624b49 RD |
781 | |
782 | wxString GetValue() const; | |
783 | void SetValue(const wxString& value); | |
784 | ||
68320e40 RD |
785 | wxString GetRange(long from, long to); |
786 | ||
98624b49 RD |
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; | |
b78b83ec | 796 | wxString GetStringSelection(); |
98624b49 | 797 | |
7bf85405 | 798 | void Clear(); |
7bf85405 | 799 | void Replace(long from, long to, const wxString& value); |
98624b49 RD |
800 | void Remove(long from, long to); |
801 | ||
802 | // load/save the controls contents from/to the file | |
803 | bool LoadFile(const wxString& file); | |
137b5242 | 804 | bool SaveFile(const wxString& file = wxPyEmptyString); |
98624b49 RD |
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 | |
7bf85405 | 815 | void WriteText(const wxString& text); |
cf694132 | 816 | void AppendText(const wxString& text); |
b1462dfa | 817 | |
db0ff83e RD |
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 | ||
98624b49 RD |
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 | |
d56cebe7 RD |
825 | bool SetStyle(long start, long end, const wxTextAttr& style); |
826 | bool SetDefaultStyle(const wxTextAttr& style); | |
827 | const wxTextAttr& GetDefaultStyle() const; | |
828 | ||
98624b49 RD |
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; | |
68320e40 RD |
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. | |
98624b49 RD |
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); | |
00b6c4e3 | 865 | |
64c06a50 RD |
866 | bool IsSingleLine(); |
867 | bool IsMultiLine(); | |
868 | ||
869 | ||
b1462dfa RD |
870 | %addmethods { |
871 | void write(const wxString& text) { | |
d56cebe7 | 872 | self->AppendText(text); |
b1462dfa RD |
873 | } |
874 | } | |
2f4e9287 RD |
875 | |
876 | // TODO: replace this when the method is really added to wxTextCtrl | |
877 | %addmethods { | |
878 | wxString GetString(long from, long to) { | |
64c06a50 | 879 | return self->GetValue().Mid(from, to - from); |
2f4e9287 RD |
880 | } |
881 | } | |
7bf85405 RD |
882 | }; |
883 | ||
884 | //---------------------------------------------------------------------- | |
885 | ||
886 | class wxScrollBar : public wxControl { | |
887 | public: | |
888 | wxScrollBar(wxWindow* parent, wxWindowID id = -1, | |
b68dc582 RD |
889 | const wxPoint& pos = wxDefaultPosition, |
890 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 891 | long style = wxSB_HORIZONTAL, |
b68dc582 | 892 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 893 | const wxString& name = wxPyScrollBarNameStr); |
09f3d4e6 RD |
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, | |
137b5242 | 901 | const wxString& name = wxPyScrollBarNameStr); |
7bf85405 | 902 | |
0122b7e3 | 903 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 904 | %pragma(python) addtomethod = "wxPreScrollBar:val._setOORInfo(val)" |
9c039d08 | 905 | |
7bf85405 RD |
906 | int GetRange(); |
907 | int GetPageSize(); | |
b8b8dda7 | 908 | int GetThumbPosition(); |
7bf85405 | 909 | int GetThumbSize(); |
26b9cf27 | 910 | %name(GetThumbLength) int GetThumbSize(); // to match the docs |
ebf4302c RD |
911 | |
912 | bool IsVertical(); | |
913 | ||
b8b8dda7 | 914 | void SetThumbPosition(int viewStart); |
7bf85405 RD |
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, | |
b68dc582 RD |
925 | const wxPoint& pos = wxDefaultPosition, |
926 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 927 | long style = wxSP_HORIZONTAL, |
137b5242 | 928 | const wxString& name = wxPySPIN_BUTTON_NAME); |
09f3d4e6 RD |
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, | |
137b5242 | 935 | const wxString& name = wxPySPIN_BUTTON_NAME); |
7bf85405 | 936 | |
0122b7e3 | 937 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 938 | %pragma(python) addtomethod = "wxPreSpinButton:val._setOORInfo(val)" |
0122b7e3 | 939 | |
7bf85405 RD |
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, | |
b68dc582 RD |
953 | const wxPoint& pos = wxDefaultPosition, |
954 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 955 | long style = 0, |
137b5242 | 956 | const wxString& name = wxPyStaticBitmapNameStr); |
09f3d4e6 RD |
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, | |
137b5242 | 964 | const wxString& name = wxPyStaticBitmapNameStr); |
7bf85405 | 965 | |
0122b7e3 | 966 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 967 | %pragma(python) addtomethod = "wxPreStaticBitmap:val._setOORInfo(val)" |
9c039d08 | 968 | |
c5943253 | 969 | wxBitmap GetBitmap(); |
7bf85405 | 970 | void SetBitmap(const wxBitmap& bitmap); |
8bf5d46e | 971 | void SetIcon(const wxIcon& icon); |
7bf85405 RD |
972 | }; |
973 | ||
974 | //---------------------------------------------------------------------- | |
975 | ||
976 | class wxRadioBox : public wxControl { | |
977 | public: | |
978 | wxRadioBox(wxWindow* parent, wxWindowID id, | |
979 | const wxString& label, | |
b68dc582 RD |
980 | const wxPoint& point = wxDefaultPosition, |
981 | const wxSize& size = wxDefaultSize, | |
eec92d76 | 982 | int LCOUNT = 0, wxString* choices = NULL, |
7bf85405 RD |
983 | int majorDimension = 0, |
984 | long style = wxRA_HORIZONTAL, | |
b68dc582 | 985 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 986 | const wxString& name = wxPyRadioBoxNameStr); |
09f3d4e6 RD |
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, | |
137b5242 | 997 | const wxString& name = wxPyRadioBoxNameStr); |
7bf85405 | 998 | |
0122b7e3 | 999 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 1000 | %pragma(python) addtomethod = "wxPreRadioBox:val._setOORInfo(val)" |
9c039d08 | 1001 | |
0699c864 RD |
1002 | void Enable(bool enable); |
1003 | %name(EnableItem)void Enable(int n, bool enable); | |
7bf85405 | 1004 | int FindString(const wxString& string); |
bb0054cd | 1005 | |
7bf85405 | 1006 | wxString GetString(int n); |
0adbc166 RD |
1007 | void SetString(int n, const wxString& label); |
1008 | %pragma(python) addtoclass = " | |
1009 | GetItemLabel = GetString | |
1010 | SetItemLabel = SetString | |
1011 | " | |
1e4a197e | 1012 | #ifndef __WXGTK__ |
2c8a649d RD |
1013 | int GetColumnCount(); |
1014 | int GetRowCount(); | |
1e4a197e | 1015 | int GetNextItem(int item, wxDirection dir, long style); |
2c8a649d RD |
1016 | #endif |
1017 | ||
0adbc166 | 1018 | int GetSelection(); |
7bf85405 | 1019 | wxString GetStringSelection(); |
0adbc166 RD |
1020 | int GetCount(); |
1021 | %pragma(python) addtoclass = "Number = GetCount" | |
1022 | ||
7bf85405 RD |
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, | |
b68dc582 RD |
1035 | const wxPoint& pos = wxDefaultPosition, |
1036 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 1037 | long style = 0, |
b68dc582 | 1038 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 1039 | const wxString& name = wxPyRadioButtonNameStr); |
09f3d4e6 RD |
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, | |
137b5242 | 1048 | const wxString& name = wxPyRadioButtonNameStr); |
7bf85405 | 1049 | |
0122b7e3 | 1050 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 1051 | %pragma(python) addtomethod = "wxPreRadioButton:val._setOORInfo(val)" |
9c039d08 | 1052 | |
7bf85405 RD |
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, | |
b68dc582 RD |
1063 | const wxPoint& point = wxDefaultPosition, |
1064 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 1065 | long style = wxSL_HORIZONTAL, |
b68dc582 | 1066 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 1067 | const wxString& name = wxPySliderNameStr); |
09f3d4e6 RD |
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, | |
137b5242 | 1076 | const wxString& name = wxPySliderNameStr); |
7bf85405 | 1077 | |
0122b7e3 | 1078 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 1079 | %pragma(python) addtomethod = "wxPreSlider:val._setOORInfo(val)" |
9c039d08 | 1080 | |
7bf85405 RD |
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 | ||
f6bcfd97 BP |
1105 | class wxSpinCtrl : public wxSpinButton { |
1106 | public: | |
1107 | wxSpinCtrl(wxWindow *parent, | |
1108 | wxWindowID id = -1, | |
137b5242 | 1109 | const wxString& value = wxPyEmptyString, |
b68dc582 RD |
1110 | const wxPoint& pos = wxDefaultPosition, |
1111 | const wxSize& size = wxDefaultSize, | |
f6bcfd97 BP |
1112 | long style = wxSP_ARROW_KEYS, |
1113 | int min = 0, int max = 100, int initial = 0, | |
137b5242 | 1114 | const wxString& name = wxPySpinCtrlNameStr); |
09f3d4e6 RD |
1115 | %name(wxPreSpinCtrl)wxSpinCtrl(); |
1116 | ||
1117 | bool Create(wxWindow *parent, | |
1118 | wxWindowID id = -1, | |
137b5242 | 1119 | const wxString& value = wxPyEmptyString, |
09f3d4e6 RD |
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, | |
137b5242 | 1124 | const wxString& name = wxPySpinCtrlNameStr); |
f6bcfd97 | 1125 | |
0122b7e3 | 1126 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 1127 | %pragma(python) addtomethod = "wxPreSpinCtrl:val._setOORInfo(val)" |
f6bcfd97 | 1128 | |
c368d904 RD |
1129 | int GetMax(); |
1130 | int GetMin(); | |
1131 | int GetValue(); | |
1132 | void SetRange(int min, int max); | |
1133 | void SetValue(int value); | |
1134 | ||
f6bcfd97 BP |
1135 | }; |
1136 | ||
1137 | ||
1138 | //---------------------------------------------------------------------- | |
1139 | ||
e6056257 | 1140 | #ifndef __WXMAC__ |
d1679124 RD |
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, | |
137b5242 | 1152 | const wxString& name = wxPyCheckBoxNameStr); |
09f3d4e6 RD |
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, | |
137b5242 | 1162 | const wxString& name = wxPyCheckBoxNameStr); |
d1679124 | 1163 | |
0122b7e3 | 1164 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 1165 | %pragma(python) addtomethod = "wxPreToggleButton:val._setOORInfo(val)" |
0122b7e3 | 1166 | |
d1679124 RD |
1167 | void SetValue(bool value); |
1168 | bool GetValue() const ; | |
1169 | void SetLabel(const wxString& label); | |
1170 | ||
1171 | }; | |
1172 | ||
e6056257 | 1173 | #endif |
68320e40 | 1174 | |
d1679124 RD |
1175 | //---------------------------------------------------------------------- |
1176 | //---------------------------------------------------------------------- | |
1177 | //---------------------------------------------------------------------- | |
1178 | ||
c368d904 RD |
1179 | |
1180 |