]>
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 RD |
340 | bool GetValue(); |
341 | void SetValue(const bool state); | |
342 | }; | |
343 | ||
344 | //---------------------------------------------------------------------- | |
345 | ||
900d9886 | 346 | class wxChoice : public wxControlWithItems { |
7bf85405 RD |
347 | public: |
348 | wxChoice(wxWindow *parent, wxWindowID id, | |
b68dc582 RD |
349 | const wxPoint& pos = wxDefaultPosition, |
350 | const wxSize& size = wxDefaultSize, | |
eec92d76 | 351 | int LCOUNT=0, wxString* choices=NULL, |
7bf85405 | 352 | long style = 0, |
b68dc582 | 353 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 354 | const wxString& name = wxPyChoiceNameStr); |
09f3d4e6 RD |
355 | %name(wxPreChoice)wxChoice(); |
356 | ||
357 | bool Create(wxWindow *parent, wxWindowID id, | |
358 | const wxPoint& pos = wxDefaultPosition, | |
359 | const wxSize& size = wxDefaultSize, | |
360 | int LCOUNT=0, wxString* choices=NULL, | |
361 | long style = 0, | |
362 | const wxValidator& validator = wxDefaultValidator, | |
137b5242 | 363 | const wxString& name = wxPyChoiceNameStr); |
7bf85405 | 364 | |
0122b7e3 | 365 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 366 | %pragma(python) addtomethod = "wxPreChoice:val._setOORInfo(val)" |
0122b7e3 | 367 | |
7bf85405 | 368 | void Clear(); |
900d9886 | 369 | |
7bf85405 | 370 | int GetColumns(); |
7bf85405 RD |
371 | void SetColumns(const int n = 1); |
372 | void SetSelection(const int n); | |
373 | void SetStringSelection(const wxString& string); | |
0adbc166 RD |
374 | void SetString(int n, const wxString& s); |
375 | ||
376 | %pragma(python) addtoclass = " | |
0adbc166 RD |
377 | Select = SetSelection |
378 | " | |
7bf85405 RD |
379 | }; |
380 | ||
381 | //---------------------------------------------------------------------- | |
382 | ||
c70fd24f RD |
383 | // wxGTK's wxComboBox doesn't derive from wxChoice like wxMSW, or |
384 | // even wxControlWithItems, so we have to duplicate the methods | |
385 | // here... <blech!> | |
386 | ||
387 | #ifdef __WXGTK__ | |
388 | class wxComboBox : public wxControl | |
389 | { | |
390 | public: | |
137b5242 RD |
391 | wxComboBox(wxWindow* parent, wxWindowID id, |
392 | const wxString& value = wxPyEmptyString, | |
c70fd24f RD |
393 | const wxPoint& pos = wxDefaultPosition, |
394 | const wxSize& size = wxDefaultSize, | |
395 | int LCOUNT=0, wxString* choices=NULL, | |
396 | long style = 0, | |
397 | const wxValidator& validator = wxDefaultValidator, | |
137b5242 | 398 | const wxString& name = wxPyComboBoxNameStr); |
c70fd24f RD |
399 | %name(wxPreComboBox)wxComboBox(); |
400 | ||
137b5242 RD |
401 | bool Create(wxWindow* parent, wxWindowID id, |
402 | const wxString& value = wxPyEmptyString, | |
403 | const wxPoint& pos = wxDefaultPosition, | |
404 | const wxSize& size = wxDefaultSize, | |
405 | int LCOUNT=0, wxString* choices=NULL, | |
406 | long style = 0, | |
407 | const wxValidator& validator = wxDefaultValidator, | |
408 | const wxString& name = wxPyComboBoxNameStr); | |
c70fd24f RD |
409 | |
410 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
411 | %pragma(python) addtomethod = "wxPreComboBox:val._setOORInfo(val)" | |
412 | ||
413 | void Copy(); | |
414 | void Cut(); | |
415 | long GetInsertionPoint(); | |
416 | long GetLastPosition(); | |
417 | wxString GetValue(); | |
418 | void Paste(); | |
419 | void Replace(long from, long to, const wxString& text); | |
420 | void Remove(long from, long to); | |
421 | void SetInsertionPoint(long pos); | |
422 | void SetInsertionPointEnd(); | |
423 | void SetSelection(int n); | |
424 | %name(SetMark)void SetSelection(long from, long to); | |
425 | void SetValue(const wxString& text); | |
426 | void SetEditable(bool editable); | |
427 | ||
428 | ||
429 | void Clear(); | |
430 | void Delete(int n); | |
431 | ||
432 | int GetCount(); | |
433 | %pragma(python) addtoclass = "Number = GetCount" | |
434 | wxString GetString(int n); | |
435 | int FindString(const wxString& s); | |
436 | ||
437 | //void SetString(int n, const wxString& s); *** No equivalent for wxGTK!!! | |
438 | ||
439 | // void Select(int n); | |
440 | %pragma(python) addtoclass = "Select = SetSelection" | |
441 | ||
442 | int GetSelection(); | |
443 | wxString GetStringSelection() const; | |
444 | ||
445 | // void Append(const wxString& item); | |
446 | // void Append(const wxString& item, char* clientData); | |
447 | // char* GetClientData(const int n); | |
448 | // void SetClientData(const int n, char* data); | |
449 | %addmethods { | |
450 | void Append(const wxString& item, PyObject* clientData=NULL) { | |
451 | if (clientData) { | |
452 | wxPyClientData* data = new wxPyClientData(clientData); | |
453 | self->Append(item, data); | |
454 | } else | |
455 | self->Append(item); | |
456 | } | |
457 | ||
458 | PyObject* GetClientData(int n) { | |
459 | wxPyClientData* data = (wxPyClientData*)self->GetClientObject(n); | |
460 | if (data) { | |
461 | Py_INCREF(data->m_obj); | |
462 | return data->m_obj; | |
463 | } else { | |
464 | Py_INCREF(Py_None); | |
465 | return Py_None; | |
466 | } | |
467 | } | |
468 | ||
469 | void SetClientData(int n, PyObject* clientData) { | |
470 | wxPyClientData* data = new wxPyClientData(clientData); | |
471 | self->SetClientObject(n, data); | |
472 | } | |
473 | } | |
474 | ||
475 | }; | |
476 | ||
477 | ||
478 | ||
479 | #else // For all but wxGTK | |
480 | ||
481 | ||
bb0054cd | 482 | class wxComboBox : public wxChoice { |
7bf85405 | 483 | public: |
137b5242 RD |
484 | wxComboBox(wxWindow* parent, wxWindowID id, |
485 | const wxString& value = wxPyEmptyString, | |
b68dc582 RD |
486 | const wxPoint& pos = wxDefaultPosition, |
487 | const wxSize& size = wxDefaultSize, | |
eec92d76 | 488 | int LCOUNT=0, wxString* choices=NULL, |
7bf85405 | 489 | long style = 0, |
b68dc582 | 490 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 491 | const wxString& name = wxPyComboBoxNameStr); |
09f3d4e6 RD |
492 | %name(wxPreComboBox)wxComboBox(); |
493 | ||
137b5242 RD |
494 | bool Create(wxWindow* parent, wxWindowID id, |
495 | const wxString& value = wxPyEmptyString, | |
09f3d4e6 RD |
496 | const wxPoint& pos = wxDefaultPosition, |
497 | const wxSize& size = wxDefaultSize, | |
498 | int LCOUNT=0, wxString* choices=NULL, | |
499 | long style = 0, | |
500 | const wxValidator& validator = wxDefaultValidator, | |
137b5242 | 501 | const wxString& name = wxPyComboBoxNameStr); |
7bf85405 | 502 | |
0122b7e3 | 503 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 504 | %pragma(python) addtomethod = "wxPreComboBox:val._setOORInfo(val)" |
9c039d08 | 505 | |
7bf85405 RD |
506 | void Copy(); |
507 | void Cut(); | |
7bf85405 RD |
508 | long GetInsertionPoint(); |
509 | long GetLastPosition(); | |
7bf85405 | 510 | wxString GetValue(); |
7bf85405 RD |
511 | void Paste(); |
512 | void Replace(long from, long to, const wxString& text); | |
513 | void Remove(long from, long to); | |
7bf85405 RD |
514 | void SetInsertionPoint(long pos); |
515 | void SetInsertionPointEnd(); | |
1d99702e | 516 | void SetSelection(int n); |
7bf85405 RD |
517 | %name(SetMark)void SetSelection(long from, long to); |
518 | void SetValue(const wxString& text); | |
0adbc166 | 519 | void SetEditable(bool editable); |
7bf85405 | 520 | }; |
c70fd24f RD |
521 | #endif |
522 | ||
7bf85405 RD |
523 | |
524 | //---------------------------------------------------------------------- | |
525 | ||
526 | class wxGauge : public wxControl { | |
527 | public: | |
528 | wxGauge(wxWindow* parent, wxWindowID id, int range, | |
b68dc582 RD |
529 | const wxPoint& pos = wxDefaultPosition, |
530 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 531 | long style = wxGA_HORIZONTAL, |
b68dc582 | 532 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 533 | const wxString& name = wxPyGaugeNameStr); |
09f3d4e6 RD |
534 | %name(wxPreGauge)wxGauge(); |
535 | ||
536 | bool Create(wxWindow* parent, wxWindowID id, int range, | |
537 | const wxPoint& pos = wxDefaultPosition, | |
538 | const wxSize& size = wxDefaultSize, | |
539 | long style = wxGA_HORIZONTAL, | |
540 | const wxValidator& validator = wxDefaultValidator, | |
137b5242 | 541 | const wxString& name = wxPyGaugeNameStr); |
7bf85405 | 542 | |
0122b7e3 | 543 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 544 | %pragma(python) addtomethod = "wxPreGauge:val._setOORInfo(val)" |
9c039d08 | 545 | |
7bf85405 RD |
546 | int GetBezelFace(); |
547 | int GetRange(); | |
548 | int GetShadowWidth(); | |
549 | int GetValue(); | |
550 | void SetBezelFace(int width); | |
551 | void SetRange(int range); | |
552 | void SetShadowWidth(int width); | |
553 | void SetValue(int pos); | |
554 | }; | |
555 | ||
556 | //---------------------------------------------------------------------- | |
557 | ||
558 | class wxStaticBox : public wxControl { | |
559 | public: | |
560 | wxStaticBox(wxWindow* parent, wxWindowID id, const wxString& label, | |
b68dc582 RD |
561 | const wxPoint& pos = wxDefaultPosition, |
562 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 563 | long style = 0, |
137b5242 | 564 | const wxString& name = wxPyStaticBoxNameStr); |
09f3d4e6 RD |
565 | %name(wxPreStaticBox)wxStaticBox(); |
566 | ||
567 | bool Create(wxWindow* parent, wxWindowID id, const wxString& label, | |
568 | const wxPoint& pos = wxDefaultPosition, | |
569 | const wxSize& size = wxDefaultSize, | |
570 | long style = 0, | |
137b5242 | 571 | const wxString& name = wxPyStaticBoxNameStr); |
0122b7e3 RD |
572 | |
573 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
17c0e08c | 574 | %pragma(python) addtomethod = "wxPreStaticBox:val._setOORInfo(val)" |
7bf85405 RD |
575 | }; |
576 | ||
577 | ||
bb0054cd RD |
578 | //---------------------------------------------------------------------- |
579 | ||
8bf5d46e | 580 | |
bb0054cd RD |
581 | class wxStaticLine : public wxControl { |
582 | public: | |
583 | wxStaticLine( wxWindow *parent, wxWindowID id, | |
b68dc582 RD |
584 | const wxPoint &pos = wxDefaultPosition, |
585 | const wxSize &size = wxDefaultSize, | |
bb0054cd | 586 | long style = wxLI_HORIZONTAL, |
137b5242 | 587 | const wxString& name = wxPyStaticTextNameStr); |
09f3d4e6 RD |
588 | %name(wxPreStaticLine)wxStaticLine(); |
589 | ||
590 | bool Create( wxWindow *parent, wxWindowID id, | |
591 | const wxPoint &pos = wxDefaultPosition, | |
592 | const wxSize &size = wxDefaultSize, | |
593 | long style = wxLI_HORIZONTAL, | |
137b5242 | 594 | const wxString& name = wxPyStaticTextNameStr); |
0122b7e3 RD |
595 | |
596 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
17c0e08c | 597 | %pragma(python) addtomethod = "wxPreStaticLine:val._setOORInfo(val)" |
bb0054cd | 598 | }; |
8bf5d46e | 599 | |
bb0054cd | 600 | |
7bf85405 RD |
601 | //---------------------------------------------------------------------- |
602 | ||
603 | class wxStaticText : public wxControl { | |
604 | public: | |
605 | wxStaticText(wxWindow* parent, wxWindowID id, const wxString& label, | |
b68dc582 RD |
606 | const wxPoint& pos = wxDefaultPosition, |
607 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 608 | long style = 0, |
137b5242 | 609 | const wxString& name = wxPyStaticTextNameStr); |
09f3d4e6 RD |
610 | %name(wxPreStaticText)wxStaticText(); |
611 | ||
612 | bool Create(wxWindow* parent, wxWindowID id, const wxString& label, | |
613 | const wxPoint& pos = wxDefaultPosition, | |
614 | const wxSize& size = wxDefaultSize, | |
615 | long style = 0, | |
137b5242 | 616 | const wxString& name = wxPyStaticTextNameStr); |
7bf85405 | 617 | |
0122b7e3 | 618 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 619 | %pragma(python) addtomethod = "wxPreStaticText:val._setOORInfo(val)" |
9c039d08 | 620 | |
7bf85405 RD |
621 | wxString GetLabel(); |
622 | void SetLabel(const wxString& label); | |
623 | }; | |
624 | ||
625 | //---------------------------------------------------------------------- | |
626 | ||
900d9886 | 627 | class wxListBox : public wxControlWithItems { |
7bf85405 RD |
628 | public: |
629 | wxListBox(wxWindow* parent, wxWindowID id, | |
b68dc582 RD |
630 | const wxPoint& pos = wxDefaultPosition, |
631 | const wxSize& size = wxDefaultSize, | |
eec92d76 | 632 | int LCOUNT, wxString* choices = NULL, |
7bf85405 | 633 | long style = 0, |
b68dc582 | 634 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 635 | const wxString& name = wxPyListBoxNameStr); |
09f3d4e6 RD |
636 | %name(wxPreListBox)wxListBox(); |
637 | ||
638 | bool Create(wxWindow* parent, wxWindowID id, | |
639 | const wxPoint& pos = wxDefaultPosition, | |
640 | const wxSize& size = wxDefaultSize, | |
641 | int LCOUNT, wxString* choices = NULL, | |
642 | long style = 0, | |
643 | const wxValidator& validator = wxDefaultValidator, | |
137b5242 | 644 | const wxString& name = wxPyListBoxNameStr); |
7bf85405 | 645 | |
0122b7e3 | 646 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 647 | %pragma(python) addtomethod = "wxPreListBox:val._setOORInfo(val)" |
0122b7e3 | 648 | |
7bf85405 | 649 | void Clear(); |
7bf85405 | 650 | void Deselect(int n); |
cf694132 RD |
651 | |
652 | // int GetSelections(int **selections); | |
653 | %addmethods { | |
654 | PyObject* GetSelections() { | |
655 | wxArrayInt lst; | |
656 | self->GetSelections(lst); | |
657 | PyObject *tup = PyTuple_New(lst.GetCount()); | |
f6bcfd97 | 658 | for(size_t i=0; i<lst.GetCount(); i++) { |
cf694132 RD |
659 | PyTuple_SetItem(tup, i, PyInt_FromLong(lst[i])); |
660 | } | |
661 | return tup; | |
662 | } | |
663 | } | |
664 | ||
900d9886 | 665 | |
eec92d76 | 666 | void InsertItems(int LCOUNT, wxString* choices, int pos); |
2f90df85 | 667 | |
0adbc166 | 668 | bool IsSelected(const int n); |
7bf85405 | 669 | bool Selected(const int n); |
eec92d76 | 670 | void Set(int LCOUNT, wxString* choices); |
7bf85405 RD |
671 | void SetFirstItem(int n); |
672 | %name(SetFirstItemStr)void SetFirstItem(const wxString& string); | |
673 | void SetSelection(int n, bool select = TRUE); | |
674 | void SetString(int n, const wxString& string); | |
675 | void SetStringSelection(const wxString& string, bool select = TRUE); | |
676 | }; | |
677 | ||
678 | ||
9c039d08 RD |
679 | //---------------------------------------------------------------------- |
680 | ||
9c039d08 RD |
681 | class wxCheckListBox : public wxListBox { |
682 | public: | |
683 | wxCheckListBox(wxWindow *parent, wxWindowID id, | |
b68dc582 RD |
684 | const wxPoint& pos = wxDefaultPosition, |
685 | const wxSize& size = wxDefaultSize, | |
9c039d08 | 686 | int LCOUNT = 0, |
eec92d76 | 687 | wxString* choices = NULL, |
9c039d08 | 688 | long style = 0, |
b68dc582 | 689 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 690 | const wxString& name = wxPyListBoxNameStr); |
09f3d4e6 RD |
691 | %name(wxPreCheckListBox)wxCheckListBox(); |
692 | ||
693 | bool Create(wxWindow *parent, wxWindowID id, | |
694 | const wxPoint& pos = wxDefaultPosition, | |
695 | const wxSize& size = wxDefaultSize, | |
696 | int LCOUNT = 0, | |
697 | wxString* choices = NULL, | |
698 | long style = 0, | |
699 | const wxValidator& validator = wxDefaultValidator, | |
137b5242 | 700 | const wxString& name = wxPyListBoxNameStr); |
9c039d08 | 701 | |
0122b7e3 | 702 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 703 | %pragma(python) addtomethod = "wxPreCheckListBox:val._setOORInfo(val)" |
9c039d08 RD |
704 | |
705 | bool IsChecked(int uiIndex); | |
694759cf | 706 | void Check(int uiIndex, int bCheck = TRUE); |
eec92d76 | 707 | void InsertItems(int LCOUNT, wxString* choices, int pos); |
9c039d08 | 708 | |
e6056257 | 709 | #ifndef __WXMAC__ |
9c039d08 | 710 | int GetItemHeight(); |
e6056257 | 711 | #endif |
3b3ab7f6 RD |
712 | |
713 | // return the index of the item at this position or wxNOT_FOUND | |
714 | int HitTest(const wxPoint& pt) const; | |
715 | %name(HitTestXY)int HitTest(wxCoord x, wxCoord y) const; | |
716 | ||
9c039d08 | 717 | }; |
9c039d08 | 718 | |
7bf85405 RD |
719 | //---------------------------------------------------------------------- |
720 | ||
d56cebe7 RD |
721 | |
722 | class wxTextAttr | |
723 | { | |
724 | public: | |
725 | // ctors | |
726 | wxTextAttr(const wxColour& colText = wxNullColour, | |
727 | const wxColour& colBack = wxNullColour, | |
728 | const wxFont& font = wxNullFont); | |
729 | ~wxTextAttr(); | |
730 | ||
731 | // setters | |
732 | void SetTextColour(const wxColour& colText); | |
733 | void SetBackgroundColour(const wxColour& colBack); | |
734 | void SetFont(const wxFont& font); | |
735 | ||
736 | // accessors | |
737 | bool HasTextColour() const; | |
738 | bool HasBackgroundColour() const; | |
739 | bool HasFont() const; | |
740 | ||
c5943253 RD |
741 | wxColour GetTextColour() const; |
742 | wxColour GetBackgroundColour() const; | |
743 | wxFont GetFont() const; | |
98624b49 RD |
744 | |
745 | // returns false if we have any attributes set, true otherwise | |
746 | bool IsDefault(); | |
2f4e9287 RD |
747 | |
748 | // return the attribute having the valid font and colours: it uses the | |
749 | // attributes set in attr and falls back first to attrDefault and then to | |
750 | // the text control font/colours for those attributes which are not set | |
751 | static wxTextAttr Combine(const wxTextAttr& attr, | |
752 | const wxTextAttr& attrDef, | |
753 | const wxTextCtrl *text); | |
d56cebe7 RD |
754 | }; |
755 | ||
756 | ||
757 | ||
7bf85405 RD |
758 | class wxTextCtrl : public wxControl { |
759 | public: | |
137b5242 RD |
760 | wxTextCtrl(wxWindow* parent, wxWindowID id, |
761 | const wxString& value = wxPyEmptyString, | |
b68dc582 RD |
762 | const wxPoint& pos = wxDefaultPosition, |
763 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 764 | long style = 0, |
b68dc582 | 765 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 766 | const wxString& name = wxPyTextCtrlNameStr); |
09f3d4e6 RD |
767 | %name(wxPreTextCtrl)wxTextCtrl(); |
768 | ||
137b5242 RD |
769 | bool Create(wxWindow* parent, wxWindowID id, |
770 | const wxString& value = wxPyEmptyString, | |
09f3d4e6 RD |
771 | const wxPoint& pos = wxDefaultPosition, |
772 | const wxSize& size = wxDefaultSize, | |
773 | long style = 0, | |
774 | const wxValidator& validator = wxDefaultValidator, | |
137b5242 | 775 | const wxString& name = wxPyTextCtrlNameStr); |
7bf85405 | 776 | |
0122b7e3 | 777 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 778 | %pragma(python) addtomethod = "wxPreTextCtrl:val._setOORInfo(val)" |
9c039d08 | 779 | |
98624b49 RD |
780 | |
781 | wxString GetValue() const; | |
782 | void SetValue(const wxString& value); | |
783 | ||
68320e40 RD |
784 | wxString GetRange(long from, long to); |
785 | ||
98624b49 RD |
786 | int GetLineLength(long lineNo) const; |
787 | wxString GetLineText(long lineNo) const; | |
788 | int GetNumberOfLines() const; | |
789 | ||
790 | bool IsModified() const; | |
791 | bool IsEditable() const; | |
792 | ||
793 | // If the return values from and to are the same, there is no selection. | |
794 | void GetSelection(long* OUTPUT, long* OUTPUT) const; | |
b78b83ec | 795 | wxString GetStringSelection(); |
98624b49 | 796 | |
7bf85405 | 797 | void Clear(); |
7bf85405 | 798 | void Replace(long from, long to, const wxString& value); |
98624b49 RD |
799 | void Remove(long from, long to); |
800 | ||
801 | // load/save the controls contents from/to the file | |
802 | bool LoadFile(const wxString& file); | |
137b5242 | 803 | bool SaveFile(const wxString& file = wxPyEmptyString); |
98624b49 RD |
804 | |
805 | // clears the dirty flag | |
806 | void DiscardEdits(); | |
807 | ||
808 | // set the max number of characters which may be entered in a single line | |
809 | // text control | |
810 | void SetMaxLength(unsigned long len); | |
811 | ||
812 | // writing text inserts it at the current position, appending always | |
813 | // inserts it at the end | |
7bf85405 | 814 | void WriteText(const wxString& text); |
cf694132 | 815 | void AppendText(const wxString& text); |
b1462dfa | 816 | |
db0ff83e RD |
817 | // insert the character which would have resulted from this key event, |
818 | // return TRUE if anything has been inserted | |
819 | bool EmulateKeyPress(const wxKeyEvent& event); | |
820 | ||
98624b49 RD |
821 | // text control under some platforms supports the text styles: these |
822 | // methods allow to apply the given text style to the given selection or to | |
823 | // set/get the style which will be used for all appended text | |
d56cebe7 RD |
824 | bool SetStyle(long start, long end, const wxTextAttr& style); |
825 | bool SetDefaultStyle(const wxTextAttr& style); | |
826 | const wxTextAttr& GetDefaultStyle() const; | |
827 | ||
98624b49 RD |
828 | // translate between the position (which is just an index in the text ctrl |
829 | // considering all its contents as a single strings) and (x, y) coordinates | |
830 | // which represent column and line. | |
831 | long XYToPosition(long x, long y) const; | |
68320e40 RD |
832 | void PositionToXY(long pos, long *OUTPUT, long *OUTPUT) const; |
833 | ||
834 | //bool PositionToXY(long pos, long *OUTPUT, long *OUTPUT) const; | |
835 | // TODO: check return value, raise exception. | |
98624b49 RD |
836 | |
837 | void ShowPosition(long pos); | |
838 | ||
839 | // Clipboard operations | |
840 | void Copy(); | |
841 | void Cut(); | |
842 | void Paste(); | |
843 | ||
844 | bool CanCopy() const; | |
845 | bool CanCut() const; | |
846 | bool CanPaste() const; | |
847 | ||
848 | // Undo/redo | |
849 | void Undo(); | |
850 | void Redo(); | |
851 | ||
852 | bool CanUndo() const; | |
853 | bool CanRedo() const; | |
854 | ||
855 | // Insertion point | |
856 | void SetInsertionPoint(long pos); | |
857 | void SetInsertionPointEnd(); | |
858 | long GetInsertionPoint() const; | |
859 | long GetLastPosition() const; | |
860 | ||
861 | void SetSelection(long from, long to); | |
862 | void SelectAll(); | |
863 | void SetEditable(bool editable); | |
00b6c4e3 | 864 | |
64c06a50 RD |
865 | bool IsSingleLine(); |
866 | bool IsMultiLine(); | |
867 | ||
868 | ||
b1462dfa RD |
869 | %addmethods { |
870 | void write(const wxString& text) { | |
d56cebe7 | 871 | self->AppendText(text); |
b1462dfa RD |
872 | } |
873 | } | |
2f4e9287 RD |
874 | |
875 | // TODO: replace this when the method is really added to wxTextCtrl | |
876 | %addmethods { | |
877 | wxString GetString(long from, long to) { | |
64c06a50 | 878 | return self->GetValue().Mid(from, to - from); |
2f4e9287 RD |
879 | } |
880 | } | |
7bf85405 RD |
881 | }; |
882 | ||
883 | //---------------------------------------------------------------------- | |
884 | ||
885 | class wxScrollBar : public wxControl { | |
886 | public: | |
887 | wxScrollBar(wxWindow* parent, wxWindowID id = -1, | |
b68dc582 RD |
888 | const wxPoint& pos = wxDefaultPosition, |
889 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 890 | long style = wxSB_HORIZONTAL, |
b68dc582 | 891 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 892 | const wxString& name = wxPyScrollBarNameStr); |
09f3d4e6 RD |
893 | %name(wxPreScrollBar)wxScrollBar(); |
894 | ||
895 | bool Create(wxWindow* parent, wxWindowID id = -1, | |
896 | const wxPoint& pos = wxDefaultPosition, | |
897 | const wxSize& size = wxDefaultSize, | |
898 | long style = wxSB_HORIZONTAL, | |
899 | const wxValidator& validator = wxDefaultValidator, | |
137b5242 | 900 | const wxString& name = wxPyScrollBarNameStr); |
7bf85405 | 901 | |
0122b7e3 | 902 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 903 | %pragma(python) addtomethod = "wxPreScrollBar:val._setOORInfo(val)" |
9c039d08 | 904 | |
7bf85405 RD |
905 | int GetRange(); |
906 | int GetPageSize(); | |
b8b8dda7 | 907 | int GetThumbPosition(); |
7bf85405 | 908 | int GetThumbSize(); |
26b9cf27 | 909 | %name(GetThumbLength) int GetThumbSize(); // to match the docs |
ebf4302c RD |
910 | |
911 | bool IsVertical(); | |
912 | ||
b8b8dda7 | 913 | void SetThumbPosition(int viewStart); |
7bf85405 RD |
914 | void SetScrollbar(int position, int thumbSize, |
915 | int range, int pageSize, | |
916 | bool refresh = TRUE); | |
917 | }; | |
918 | ||
919 | //---------------------------------------------------------------------- | |
920 | ||
921 | class wxSpinButton : public wxControl { | |
922 | public: | |
923 | wxSpinButton(wxWindow* parent, wxWindowID id = -1, | |
b68dc582 RD |
924 | const wxPoint& pos = wxDefaultPosition, |
925 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 926 | long style = wxSP_HORIZONTAL, |
137b5242 | 927 | const wxString& name = wxPySPIN_BUTTON_NAME); |
09f3d4e6 RD |
928 | %name(wxPreSpinButton)wxSpinButton(); |
929 | ||
930 | bool Create(wxWindow* parent, wxWindowID id = -1, | |
931 | const wxPoint& pos = wxDefaultPosition, | |
932 | const wxSize& size = wxDefaultSize, | |
933 | long style = wxSP_HORIZONTAL, | |
137b5242 | 934 | const wxString& name = wxPySPIN_BUTTON_NAME); |
7bf85405 | 935 | |
0122b7e3 | 936 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 937 | %pragma(python) addtomethod = "wxPreSpinButton:val._setOORInfo(val)" |
0122b7e3 | 938 | |
7bf85405 RD |
939 | int GetMax(); |
940 | int GetMin(); | |
941 | int GetValue(); | |
942 | void SetRange(int min, int max); | |
943 | void SetValue(int value); | |
944 | }; | |
945 | ||
946 | //---------------------------------------------------------------------- | |
947 | ||
948 | class wxStaticBitmap : public wxControl { | |
949 | public: | |
950 | wxStaticBitmap(wxWindow* parent, wxWindowID id, | |
951 | const wxBitmap& bitmap, | |
b68dc582 RD |
952 | const wxPoint& pos = wxDefaultPosition, |
953 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 954 | long style = 0, |
137b5242 | 955 | const wxString& name = wxPyStaticBitmapNameStr); |
09f3d4e6 RD |
956 | %name(wxPreStaticBitmap)wxStaticBitmap(); |
957 | ||
958 | bool Create(wxWindow* parent, wxWindowID id, | |
959 | const wxBitmap& bitmap, | |
960 | const wxPoint& pos = wxDefaultPosition, | |
961 | const wxSize& size = wxDefaultSize, | |
962 | long style = 0, | |
137b5242 | 963 | const wxString& name = wxPyStaticBitmapNameStr); |
7bf85405 | 964 | |
0122b7e3 | 965 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 966 | %pragma(python) addtomethod = "wxPreStaticBitmap:val._setOORInfo(val)" |
9c039d08 | 967 | |
c5943253 | 968 | wxBitmap GetBitmap(); |
7bf85405 | 969 | void SetBitmap(const wxBitmap& bitmap); |
8bf5d46e | 970 | void SetIcon(const wxIcon& icon); |
7bf85405 RD |
971 | }; |
972 | ||
973 | //---------------------------------------------------------------------- | |
974 | ||
975 | class wxRadioBox : public wxControl { | |
976 | public: | |
977 | wxRadioBox(wxWindow* parent, wxWindowID id, | |
978 | const wxString& label, | |
b68dc582 RD |
979 | const wxPoint& point = wxDefaultPosition, |
980 | const wxSize& size = wxDefaultSize, | |
eec92d76 | 981 | int LCOUNT = 0, wxString* choices = NULL, |
7bf85405 RD |
982 | int majorDimension = 0, |
983 | long style = wxRA_HORIZONTAL, | |
b68dc582 | 984 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 985 | const wxString& name = wxPyRadioBoxNameStr); |
09f3d4e6 RD |
986 | %name(wxPreRadioBox)wxRadioBox(); |
987 | ||
988 | bool Create(wxWindow* parent, wxWindowID id, | |
989 | const wxString& label, | |
990 | const wxPoint& point = wxDefaultPosition, | |
991 | const wxSize& size = wxDefaultSize, | |
992 | int LCOUNT = 0, wxString* choices = NULL, | |
993 | int majorDimension = 0, | |
994 | long style = wxRA_HORIZONTAL, | |
995 | const wxValidator& validator = wxDefaultValidator, | |
137b5242 | 996 | const wxString& name = wxPyRadioBoxNameStr); |
7bf85405 | 997 | |
0122b7e3 | 998 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 999 | %pragma(python) addtomethod = "wxPreRadioBox:val._setOORInfo(val)" |
9c039d08 | 1000 | |
0699c864 RD |
1001 | void Enable(bool enable); |
1002 | %name(EnableItem)void Enable(int n, bool enable); | |
7bf85405 | 1003 | int FindString(const wxString& string); |
bb0054cd | 1004 | |
7bf85405 | 1005 | wxString GetString(int n); |
2c8a649d | 1006 | |
e6056257 RD |
1007 | #ifdef __WXGTK__ |
1008 | %name(GetItemLabel)wxString GetLabel( int item ); | |
1009 | %name(SetItemLabel)void SetLabel( int item, const wxString& label ); | |
1010 | #else | |
0adbc166 RD |
1011 | void SetString(int n, const wxString& label); |
1012 | %pragma(python) addtoclass = " | |
1013 | GetItemLabel = GetString | |
1014 | SetItemLabel = SetString | |
1015 | " | |
2c8a649d RD |
1016 | int GetColumnCount(); |
1017 | int GetRowCount(); | |
2c8a649d RD |
1018 | #endif |
1019 | ||
0adbc166 | 1020 | int GetSelection(); |
7bf85405 | 1021 | wxString GetStringSelection(); |
0adbc166 RD |
1022 | int GetCount(); |
1023 | %pragma(python) addtoclass = "Number = GetCount" | |
1024 | ||
7bf85405 RD |
1025 | void SetSelection(int n); |
1026 | void SetStringSelection(const wxString& string); | |
1027 | void Show(bool show); | |
1028 | %name(ShowItem)void Show(int item, bool show); | |
1029 | }; | |
1030 | ||
1031 | //---------------------------------------------------------------------- | |
1032 | ||
1033 | class wxRadioButton : public wxControl { | |
1034 | public: | |
1035 | wxRadioButton(wxWindow* parent, wxWindowID id, | |
1036 | const wxString& label, | |
b68dc582 RD |
1037 | const wxPoint& pos = wxDefaultPosition, |
1038 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 1039 | long style = 0, |
b68dc582 | 1040 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 1041 | const wxString& name = wxPyRadioButtonNameStr); |
09f3d4e6 RD |
1042 | %name(wxPreRadioButton)wxRadioButton(); |
1043 | ||
1044 | bool Create(wxWindow* parent, wxWindowID id, | |
1045 | const wxString& label, | |
1046 | const wxPoint& pos = wxDefaultPosition, | |
1047 | const wxSize& size = wxDefaultSize, | |
1048 | long style = 0, | |
1049 | const wxValidator& validator = wxDefaultValidator, | |
137b5242 | 1050 | const wxString& name = wxPyRadioButtonNameStr); |
7bf85405 | 1051 | |
0122b7e3 | 1052 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 1053 | %pragma(python) addtomethod = "wxPreRadioButton:val._setOORInfo(val)" |
9c039d08 | 1054 | |
7bf85405 RD |
1055 | bool GetValue(); |
1056 | void SetValue(bool value); | |
1057 | }; | |
1058 | ||
1059 | //---------------------------------------------------------------------- | |
1060 | ||
1061 | class wxSlider : public wxControl { | |
1062 | public: | |
1063 | wxSlider(wxWindow* parent, wxWindowID id, | |
1064 | int value, int minValue, int maxValue, | |
b68dc582 RD |
1065 | const wxPoint& point = wxDefaultPosition, |
1066 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 1067 | long style = wxSL_HORIZONTAL, |
b68dc582 | 1068 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 1069 | const wxString& name = wxPySliderNameStr); |
09f3d4e6 RD |
1070 | %name(wxPreSlider)wxSlider(); |
1071 | ||
1072 | bool Create(wxWindow* parent, wxWindowID id, | |
1073 | int value, int minValue, int maxValue, | |
1074 | const wxPoint& point = wxDefaultPosition, | |
1075 | const wxSize& size = wxDefaultSize, | |
1076 | long style = wxSL_HORIZONTAL, | |
1077 | const wxValidator& validator = wxDefaultValidator, | |
137b5242 | 1078 | const wxString& name = wxPySliderNameStr); |
7bf85405 | 1079 | |
0122b7e3 | 1080 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 1081 | %pragma(python) addtomethod = "wxPreSlider:val._setOORInfo(val)" |
9c039d08 | 1082 | |
7bf85405 RD |
1083 | void ClearSel(); |
1084 | void ClearTicks(); | |
1085 | int GetLineSize(); | |
1086 | int GetMax(); | |
1087 | int GetMin(); | |
1088 | int GetPageSize(); | |
1089 | int GetSelEnd(); | |
1090 | int GetSelStart(); | |
1091 | int GetThumbLength(); | |
1092 | int GetTickFreq(); | |
1093 | int GetValue(); | |
1094 | void SetRange(int minValue, int maxValue); | |
1095 | void SetTickFreq(int n, int pos); | |
1096 | void SetLineSize(int lineSize); | |
1097 | void SetPageSize(int pageSize); | |
1098 | void SetSelection(int startPos, int endPos); | |
1099 | void SetThumbLength(int len); | |
1100 | void SetTick(int tickPos); | |
1101 | void SetValue(int value); | |
1102 | }; | |
1103 | ||
1104 | ||
1105 | //---------------------------------------------------------------------- | |
1106 | ||
f6bcfd97 BP |
1107 | class wxSpinCtrl : public wxSpinButton { |
1108 | public: | |
1109 | wxSpinCtrl(wxWindow *parent, | |
1110 | wxWindowID id = -1, | |
137b5242 | 1111 | const wxString& value = wxPyEmptyString, |
b68dc582 RD |
1112 | const wxPoint& pos = wxDefaultPosition, |
1113 | const wxSize& size = wxDefaultSize, | |
f6bcfd97 BP |
1114 | long style = wxSP_ARROW_KEYS, |
1115 | int min = 0, int max = 100, int initial = 0, | |
137b5242 | 1116 | const wxString& name = wxPySpinCtrlNameStr); |
09f3d4e6 RD |
1117 | %name(wxPreSpinCtrl)wxSpinCtrl(); |
1118 | ||
1119 | bool Create(wxWindow *parent, | |
1120 | wxWindowID id = -1, | |
137b5242 | 1121 | const wxString& value = wxPyEmptyString, |
09f3d4e6 RD |
1122 | const wxPoint& pos = wxDefaultPosition, |
1123 | const wxSize& size = wxDefaultSize, | |
1124 | long style = wxSP_ARROW_KEYS, | |
1125 | int min = 0, int max = 100, int initial = 0, | |
137b5242 | 1126 | const wxString& name = wxPySpinCtrlNameStr); |
f6bcfd97 | 1127 | |
0122b7e3 | 1128 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 1129 | %pragma(python) addtomethod = "wxPreSpinCtrl:val._setOORInfo(val)" |
f6bcfd97 | 1130 | |
c368d904 RD |
1131 | int GetMax(); |
1132 | int GetMin(); | |
1133 | int GetValue(); | |
1134 | void SetRange(int min, int max); | |
1135 | void SetValue(int value); | |
1136 | ||
f6bcfd97 BP |
1137 | }; |
1138 | ||
1139 | ||
1140 | //---------------------------------------------------------------------- | |
1141 | ||
e6056257 | 1142 | #ifndef __WXMAC__ |
d1679124 RD |
1143 | enum { wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, }; |
1144 | ||
1145 | class wxToggleButton : public wxControl { | |
1146 | public: | |
1147 | wxToggleButton(wxWindow *parent, | |
1148 | wxWindowID id, | |
1149 | const wxString& label, | |
1150 | const wxPoint& pos = wxDefaultPosition, | |
1151 | const wxSize& size = wxDefaultSize, | |
1152 | long style = 0, | |
1153 | const wxValidator& validator = wxDefaultValidator, | |
137b5242 | 1154 | const wxString& name = wxPyCheckBoxNameStr); |
09f3d4e6 RD |
1155 | %name(wxPreToggleButton)wxToggleButton(); |
1156 | ||
1157 | bool Create(wxWindow *parent, | |
1158 | wxWindowID id, | |
1159 | const wxString& label, | |
1160 | const wxPoint& pos = wxDefaultPosition, | |
1161 | const wxSize& size = wxDefaultSize, | |
1162 | long style = 0, | |
1163 | const wxValidator& validator = wxDefaultValidator, | |
137b5242 | 1164 | const wxString& name = wxPyCheckBoxNameStr); |
d1679124 | 1165 | |
0122b7e3 | 1166 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 1167 | %pragma(python) addtomethod = "wxPreToggleButton:val._setOORInfo(val)" |
0122b7e3 | 1168 | |
d1679124 RD |
1169 | void SetValue(bool value); |
1170 | bool GetValue() const ; | |
1171 | void SetLabel(const wxString& label); | |
1172 | ||
1173 | }; | |
1174 | ||
e6056257 | 1175 | #endif |
68320e40 | 1176 | |
d1679124 RD |
1177 | //---------------------------------------------------------------------- |
1178 | //---------------------------------------------------------------------- | |
1179 | //---------------------------------------------------------------------- | |
1180 | ||
c368d904 RD |
1181 | |
1182 |