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