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