]>
Commit | Line | Data |
---|---|---|
7bf85405 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: windows.i | |
3 | // Purpose: SWIG definitions of various window classes | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 6/24/97 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 1998 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | ||
03e9bead RD |
14 | %module windows |
15 | ||
16 | %{ | |
7bf85405 | 17 | #include "helpers.h" |
7bf85405 RD |
18 | #include <wx/menuitem.h> |
19 | %} | |
20 | ||
21 | //---------------------------------------------------------------------- | |
22 | ||
23 | %include typemaps.i | |
24 | %include my_typemaps.i | |
25 | ||
26 | // Import some definitions of other classes, etc. | |
27 | %import _defs.i | |
28 | %import misc.i | |
29 | %import gdi.i | |
b1462dfa | 30 | %import clip_dnd.i |
efc5f224 | 31 | |
2f90df85 | 32 | %pragma(python) code = "import wx" |
7bf85405 RD |
33 | |
34 | //--------------------------------------------------------------------------- | |
35 | ||
36 | class wxEvtHandler { | |
37 | public: | |
cf694132 | 38 | bool ProcessEvent(wxEvent& event); |
f6bcfd97 | 39 | void AddPendingEvent(wxEvent& event); |
2f90df85 RD |
40 | //bool SearchEventTable(wxEventTable& table, wxEvent& event); |
41 | ||
42 | bool GetEvtHandlerEnabled(); | |
43 | void SetEvtHandlerEnabled(bool enabled); | |
44 | ||
45 | wxEvtHandler* GetNextHandler(); | |
46 | wxEvtHandler* GetPreviousHandler(); | |
47 | void SetNextHandler(wxEvtHandler* handler); | |
48 | void SetPreviousHandler(wxEvtHandler* handler); | |
49 | ||
50 | ||
7bf85405 RD |
51 | %addmethods { |
52 | void Connect( int id, int lastId, int eventType, PyObject* func) { | |
53 | if (PyCallable_Check(func)) { | |
54 | self->Connect(id, lastId, eventType, | |
853b255a | 55 | (wxObjectEventFunction) &wxPyCallback::EventThunker, |
7bf85405 RD |
56 | new wxPyCallback(func)); |
57 | } | |
58 | } | |
6999b0d8 RD |
59 | |
60 | bool Disconnect(int id, int lastId = -1, | |
61 | wxEventType eventType = wxEVT_NULL) { | |
62 | return self->Disconnect(id, lastId, eventType, | |
63 | (wxObjectEventFunction) | |
64 | &wxPyCallback::EventThunker); | |
65 | } | |
66 | ||
7bf85405 | 67 | } |
f6bcfd97 BP |
68 | |
69 | %pragma(python) addtoclass = " | |
70 | _prop_list_ = {} | |
71 | " | |
72 | ||
73 | // %pragma(python) addtoclass = " | |
74 | // def __getattr__(self, name): | |
75 | // pl = self._prop_list_ | |
76 | // if pl.has_key(name): | |
77 | // getFunc, setFunc = pl[name] | |
78 | // if getFunc: | |
79 | // return getattr(self, getFunc)() | |
80 | // else: | |
81 | // raise TypeError, '%s property is write-only' % name | |
82 | // raise AttributeError, name | |
83 | ||
84 | // def __setattr__(self, name, value): | |
85 | // pl = self._prop_list_ | |
86 | // if pl.has_key(name): | |
87 | // getFunc, setFunc = pl[name] | |
88 | // if setFunc: | |
89 | // return getattr(self, setFunc)(value) | |
90 | // else: | |
91 | // raise TypeError, '%s property is read-only' % name | |
92 | // self.__dict__[name] = value | |
93 | // " | |
7bf85405 RD |
94 | }; |
95 | ||
96 | ||
2f90df85 RD |
97 | //---------------------------------------------------------------------- |
98 | ||
99 | class wxValidator : public wxEvtHandler { | |
100 | public: | |
101 | wxValidator(); | |
102 | //~wxValidator(); | |
103 | ||
104 | wxValidator* Clone(); | |
105 | wxWindow* GetWindow(); | |
106 | void SetWindow(wxWindow* window); | |
f6bcfd97 BP |
107 | |
108 | // Properties list | |
109 | %pragma(python) addtoclass = " | |
110 | _prop_list_ = { | |
111 | 'window' : ('GetWindow', 'SetWindow'), | |
112 | } | |
113 | _prop_list_.update(wxEvtHandler._prop_list_) | |
114 | " | |
2f90df85 RD |
115 | }; |
116 | ||
117 | %inline %{ | |
118 | bool wxValidator_IsSilent() { | |
119 | return wxValidator::IsSilent(); | |
120 | } | |
121 | ||
122 | void wxValidator_SetBellOnError(int doIt = TRUE) { | |
123 | wxValidator::SetBellOnError(doIt); | |
124 | } | |
125 | %} | |
126 | ||
127 | //---------------------------------------------------------------------- | |
128 | %{ | |
129 | class wxPyValidator : public wxValidator { | |
130 | DECLARE_DYNAMIC_CLASS(wxPyValidator); | |
131 | public: | |
132 | wxPyValidator() { | |
133 | } | |
134 | // wxPyValidator(const wxPyValidator& other); | |
135 | ||
136 | ~wxPyValidator() { | |
137 | } | |
138 | ||
139 | wxObject* wxPyValidator::Clone() const { | |
694759cf RD |
140 | wxPyValidator* ptr = NULL; |
141 | wxPyValidator* self = (wxPyValidator*)this; | |
142 | ||
143 | bool doSave = wxPyRestoreThread(); | |
144 | if (self->m_myInst.findCallback("Clone")) { | |
145 | PyObject* ro; | |
146 | ro = self->m_myInst.callCallbackObj(Py_BuildValue("()")); | |
f6bcfd97 BP |
147 | if (ro) { |
148 | SWIG_GetPtrObj(ro, (void **)&ptr, "_wxPyValidator_p"); | |
149 | Py_DECREF(ro); | |
150 | } | |
694759cf RD |
151 | } |
152 | // This is very dangerous!!! But is the only way I could find | |
153 | // to squash a memory leak. Currently it is okay, but if the | |
154 | // validator architecture in wxWindows ever changes, problems | |
155 | // could arise. | |
156 | delete self; | |
157 | ||
158 | wxPySaveThread(doSave); | |
159 | return ptr; | |
2f90df85 | 160 | } |
2f90df85 RD |
161 | |
162 | DEC_PYCALLBACK_BOOL_WXWIN(Validate); | |
163 | DEC_PYCALLBACK_BOOL_(TransferToWindow); | |
164 | DEC_PYCALLBACK_BOOL_(TransferFromWindow); | |
165 | ||
166 | PYPRIVATE; | |
167 | // PyObject* m_data; | |
168 | }; | |
169 | ||
170 | IMP_PYCALLBACK_BOOL_WXWIN(wxPyValidator, wxValidator, Validate); | |
171 | IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferToWindow); | |
172 | IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferFromWindow); | |
173 | ||
174 | IMPLEMENT_DYNAMIC_CLASS(wxPyValidator, wxValidator); | |
175 | ||
176 | %} | |
177 | ||
178 | class wxPyValidator : public wxValidator { | |
179 | public: | |
180 | wxPyValidator(); | |
181 | // ~wxPyValidator(); | |
182 | ||
9b3d3bc4 | 183 | %addmethods { void Destroy() { delete self; } } |
2f90df85 | 184 | |
f6bcfd97 BP |
185 | void _setSelf(PyObject* self, PyObject* _class, int incref=TRUE); |
186 | %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyValidator, 0)" | |
2f90df85 RD |
187 | |
188 | }; | |
189 | ||
7bf85405 RD |
190 | //---------------------------------------------------------------------- |
191 | ||
efc5f224 | 192 | %apply int * INOUT { int* x, int* y }; |
7bf85405 RD |
193 | |
194 | class wxWindow : public wxEvtHandler { | |
195 | public: | |
196 | ||
197 | wxWindow(wxWindow* parent, const wxWindowID id, | |
198 | const wxPoint& pos = wxPyDefaultPosition, | |
199 | const wxSize& size = wxPyDefaultSize, | |
200 | long style = 0, | |
201 | char* name = "panel"); | |
202 | ||
f6bcfd97 | 203 | %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" |
7bf85405 RD |
204 | |
205 | void CaptureMouse(); | |
8bf5d46e RD |
206 | void Center(int direction = wxBOTH); |
207 | void Centre(int direction = wxBOTH); | |
208 | void CentreOnParent(int direction = wxBOTH ); | |
209 | void CenterOnParent(int direction = wxBOTH ); | |
efc5f224 RD |
210 | |
211 | // (uses apply'ed INOUT typemap, see above) | |
212 | %name(ClientToScreenXY)void ClientToScreen(int* x, int* y); | |
af309447 | 213 | wxPoint ClientToScreen(const wxPoint& pt); |
efc5f224 | 214 | |
7bf85405 RD |
215 | bool Close(int force = FALSE); |
216 | bool Destroy(); | |
217 | void DestroyChildren(); | |
853b255a | 218 | #ifdef __WXMSW__ |
7bf85405 | 219 | void DragAcceptFiles(bool accept); |
853b255a | 220 | #endif |
7bf85405 RD |
221 | void Enable(bool enable); |
222 | //bool FakePopupMenu(wxMenu* menu, int x, int y); | |
af309447 | 223 | %name(FindWindowById) wxWindow* FindWindow(long id); |
714e6a9e | 224 | %name(FindWindowByName) wxWindow* FindWindow(const wxString& name); |
7bf85405 RD |
225 | void Fit(); |
226 | wxColour GetBackgroundColour(); | |
d426c97e RD |
227 | |
228 | //wxList& GetChildren(); | |
229 | %addmethods { | |
230 | PyObject* GetChildren() { | |
231 | wxWindowList& list = self->GetChildren(); | |
232 | return wxPy_ConvertList(&list, "wxWindow"); | |
233 | } | |
234 | } | |
235 | ||
7bf85405 RD |
236 | int GetCharHeight(); |
237 | int GetCharWidth(); | |
b8b8dda7 RD |
238 | %name(GetClientSizeTuple) void GetClientSize(int *OUTPUT, int *OUTPUT); |
239 | wxSize GetClientSize(); | |
7bf85405 | 240 | wxLayoutConstraints * GetConstraints(); |
3ab72185 | 241 | wxEvtHandler* GetEventHandler(); |
105e45b9 | 242 | |
b8b8dda7 | 243 | wxFont& GetFont(); |
7bf85405 RD |
244 | wxColour GetForegroundColour(); |
245 | wxWindow * GetGrandParent(); | |
2abc0a0f RD |
246 | %addmethods { |
247 | long GetHandle() { | |
54b96882 | 248 | return wxPyGetWinHandle(self); //(long)self->GetHandle(); |
2abc0a0f RD |
249 | } |
250 | } | |
7bf85405 | 251 | int GetId(); |
853b255a | 252 | wxString GetLabel(); |
bb0054cd | 253 | void SetLabel(const wxString& label); |
853b255a | 254 | wxString GetName(); |
7bf85405 | 255 | wxWindow * GetParent(); |
b8b8dda7 RD |
256 | %name(GetPositionTuple) void GetPosition(int *OUTPUT, int *OUTPUT); |
257 | wxPoint GetPosition(); | |
258 | wxRect GetRect(); | |
7bf85405 RD |
259 | int GetScrollThumb(int orientation); |
260 | int GetScrollPos(int orientation); | |
261 | int GetScrollRange(int orientation); | |
b8b8dda7 RD |
262 | %name(GetSizeTuple) void GetSize(int *OUTPUT, int *OUTPUT); |
263 | wxSize GetSize(); | |
af309447 RD |
264 | void GetTextExtent(const wxString& string, int *OUTPUT, int *OUTPUT); |
265 | %name(GetFullTextExtent)void GetTextExtent(const wxString& string, | |
266 | int *OUTPUT, int *OUTPUT, int *OUTPUT, int* OUTPUT, | |
267 | const wxFont* font = NULL); //, bool use16 = FALSE) | |
853b255a | 268 | wxString GetTitle(); |
8bf5d46e | 269 | wxRegion GetUpdateRegion(); |
7bf85405 | 270 | long GetWindowStyleFlag(); |
f6bcfd97 BP |
271 | void SetWindowStyleFlag(long style); |
272 | void SetWindowStyle(long style); | |
bb0054cd | 273 | bool Hide(); |
7bf85405 RD |
274 | void InitDialog(); |
275 | bool IsEnabled(); | |
1b55cabf RD |
276 | bool IsExposed( int x, int y, int w=0, int h=0 ); |
277 | %name(IsExposedPoint) bool IsExposed( const wxPoint& pt ); | |
278 | %name(IsExposedRect) bool IsExposed( const wxRect& rect ); | |
7bf85405 RD |
279 | bool IsRetained(); |
280 | bool IsShown(); | |
bb0054cd | 281 | bool IsTopLevel(); |
7bf85405 RD |
282 | void Layout(); |
283 | bool LoadFromResource(wxWindow* parent, const wxString& resourceName, const wxResourceTable* resourceTable = NULL); | |
284 | void Lower(); | |
285 | void MakeModal(bool flag); | |
af309447 RD |
286 | %name(MoveXY)void Move(int x, int y); |
287 | void Move(const wxPoint& point); | |
7bf85405 | 288 | |
3ab72185 RD |
289 | wxEvtHandler* PopEventHandler(bool deleteHandler = FALSE); |
290 | void PushEventHandler(wxEvtHandler* handler); | |
7bf85405 | 291 | |
8bf5d46e RD |
292 | %name(PopupMenuXY)bool PopupMenu(wxMenu *menu, int x, int y); |
293 | bool PopupMenu(wxMenu *menu, const wxPoint& pos); | |
294 | ||
7bf85405 RD |
295 | void Raise(); |
296 | void Refresh(bool eraseBackground = TRUE, const wxRect* rect = NULL); | |
297 | void ReleaseMouse(); | |
b7e72427 | 298 | void RemoveChild(wxWindow* child); |
bb0054cd RD |
299 | bool Reparent( wxWindow* newParent ); |
300 | ||
efc5f224 RD |
301 | // (uses apply'ed INOUT typemap, see above) |
302 | %name(ScreenToClientXY)void ScreenToClient(int *x, int *y); | |
af309447 RD |
303 | wxPoint ScreenToClient(const wxPoint& pt); |
304 | ||
7bf85405 | 305 | void ScrollWindow(int dx, int dy, const wxRect* rect = NULL); |
b8b8dda7 | 306 | void SetAcceleratorTable(const wxAcceleratorTable& accel); |
7bf85405 | 307 | void SetAutoLayout(bool autoLayout); |
1dec68aa | 308 | bool GetAutoLayout(); |
7bf85405 RD |
309 | void SetBackgroundColour(const wxColour& colour); |
310 | void SetConstraints(wxLayoutConstraints *constraints); | |
2f90df85 | 311 | void UnsetConstraints(wxLayoutConstraints *constraints); |
7bf85405 | 312 | void SetFocus(); |
2f90df85 | 313 | bool AcceptsFocus(); |
7bf85405 RD |
314 | void SetFont(const wxFont& font); |
315 | void SetForegroundColour(const wxColour& colour); | |
316 | void SetId(int id); | |
317 | void SetName(const wxString& name); | |
eb715945 | 318 | void SetScrollbar(int orientation, int position, int thumbSize, int range, int refresh = TRUE); |
7bf85405 RD |
319 | void SetScrollPos(int orientation, int pos, bool refresh = TRUE); |
320 | ||
7bf85405 RD |
321 | %name(SetDimensions) void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO); |
322 | %addmethods { | |
323 | void SetSize(const wxSize& size) { | |
b7e72427 | 324 | self->SetSize(size); |
7bf85405 RD |
325 | } |
326 | ||
327 | void SetPosition(const wxPoint& pos) { | |
b7e72427 | 328 | self->Move(pos); |
7bf85405 RD |
329 | } |
330 | } | |
331 | ||
332 | void SetSizeHints(int minW=-1, int minH=-1, int maxW=-1, int maxH=-1, int incW=-1, int incH=-1); | |
af309447 RD |
333 | %name(SetClientSizeWH)void SetClientSize(int width, int height); |
334 | void SetClientSize(const wxSize& size); | |
7bf85405 | 335 | //void SetPalette(wxPalette* palette); |
7bf85405 | 336 | void SetCursor(const wxCursor&cursor); |
3ab72185 | 337 | void SetEventHandler(wxEvtHandler* handler); |
7bf85405 RD |
338 | void SetTitle(const wxString& title); |
339 | bool Show(bool show); | |
340 | bool TransferDataFromWindow(); | |
341 | bool TransferDataToWindow(); | |
342 | bool Validate(); | |
343 | void WarpPointer(int x, int y); | |
344 | ||
b8b8dda7 RD |
345 | %name(ConvertDialogPointToPixels) wxPoint ConvertDialogToPixels(const wxPoint& pt); |
346 | %name(ConvertDialogSizeToPixels) wxSize ConvertDialogToPixels(const wxSize& sz); | |
347 | ||
cf694132 RD |
348 | %name(DLG_PNT) wxPoint ConvertDialogToPixels(const wxPoint& pt); |
349 | %name(DLG_SZE) wxSize ConvertDialogToPixels(const wxSize& sz); | |
350 | ||
b8b8dda7 RD |
351 | %name(ConvertPixelPointToDialog) wxPoint ConvertPixelsToDialog(const wxPoint& pt); |
352 | %name(ConvertPixelSizeToDialog) wxSize ConvertPixelsToDialog(const wxSize& sz); | |
353 | ||
af309447 RD |
354 | %name(SetToolTipString)void SetToolTip(const wxString &tip); |
355 | void SetToolTip(wxToolTip *tooltip); | |
356 | wxToolTip* GetToolTip(); | |
2f90df85 RD |
357 | |
358 | void SetSizer(wxSizer* sizer); | |
f6bcfd97 BP |
359 | wxSizer* GetSizer(); |
360 | ||
2f90df85 RD |
361 | wxValidator* GetValidator(); |
362 | void SetValidator(const wxValidator& validator); | |
363 | ||
b1462dfa RD |
364 | void SetDropTarget(wxDropTarget* target); |
365 | wxDropTarget* GetDropTarget(); | |
366 | %pragma(python) addtomethod = "SetDropTarget:_args[0].thisown = 0" | |
694759cf RD |
367 | |
368 | wxSize GetBestSize(); | |
a1df7a95 RD |
369 | |
370 | void SetCaret(wxCaret *caret); | |
371 | wxCaret *GetCaret(); | |
372 | %pragma(python) addtoclass = "# replaces broken shadow method | |
373 | def GetCaret(self, *_args, **_kwargs): | |
374 | from misc2 import wxCaretPtr | |
375 | val = apply(windowsc.wxWindow_GetCaret,(self,) + _args, _kwargs) | |
376 | if val: val = wxCaretPtr(val) | |
377 | return val | |
f6bcfd97 BP |
378 | " |
379 | ||
380 | ||
381 | // Properties list | |
382 | %pragma(python) addtoclass = " | |
383 | _prop_list_ = { | |
384 | 'size' : ('GetSize', 'SetSize'), | |
385 | 'enabled' : ('IsEnabled', 'Enable'), | |
386 | 'background' : ('GetBackgroundColour', 'SetBackgroundColour'), | |
387 | 'foreground' : ('GetForegroundColour', 'SetForegroundColour'), | |
388 | 'children' : ('GetChildren', None), | |
389 | 'charHeight' : ('GetCharHeight', None), | |
390 | 'charWidth' : ('GetCharWidth', None), | |
391 | 'clientSize' : ('GetClientSize', 'SetClientSize'), | |
392 | 'font' : ('GetFont', 'SetFont'), | |
393 | 'grandParent' : ('GetGrandParent', None), | |
394 | 'handle' : ('GetHandle', None), | |
395 | 'label' : ('GetLabel', 'SetLabel'), | |
396 | 'name' : ('GetName', 'SetName'), | |
397 | 'parent' : ('GetParent', None), | |
398 | 'position' : ('GetPosition', 'SetPosition'), | |
399 | 'title' : ('GetTitle', 'SetTitle'), | |
400 | 'style' : ('GetWindowStyleFlag', 'SetWindowStyleFlag'), | |
401 | 'visible' : ('IsShown', 'Show'), | |
402 | 'toolTip' : ('GetToolTip', 'SetToolTip'), | |
403 | 'sizer' : ('GetSizer', 'SetSizer'), | |
404 | 'validator' : ('GetValidator', 'SetValidator'), | |
405 | 'dropTarget' : ('GetDropTarget', 'SetDropTarget'), | |
406 | 'caret' : ('GetCaret', 'SetCaret'), | |
407 | 'autoLayout' : ('GetAutoLayout', 'SetAutoLayout'), | |
408 | 'constraints' : ('GetConstraints', 'SetConstraints'), | |
409 | ||
410 | } | |
411 | _prop_list_.update(wxEvtHandler._prop_list_) | |
412 | " | |
7bf85405 RD |
413 | }; |
414 | ||
efc5f224 RD |
415 | //%clear int* x, int* y; |
416 | ||
417 | ||
418 | ||
b8b8dda7 | 419 | %pragma(python) code = " |
bb0054cd RD |
420 | def wxDLG_PNT(win, point_or_x, y=None): |
421 | if y is None: | |
422 | return win.ConvertDialogPointToPixels(point_or_x) | |
423 | else: | |
424 | return win.ConvertDialogPointToPixels(wxPoint(point_or_x, y)) | |
425 | ||
426 | def wxDLG_SZE(win, size_width, height=None): | |
427 | if height is None: | |
428 | return win.ConvertDialogSizeToPixels(size_width) | |
429 | else: | |
430 | return win.ConvertDialogSizeToPixels(wxSize(size_width, height)) | |
b8b8dda7 | 431 | " |
7bf85405 | 432 | |
853b255a | 433 | #ifdef __WXMSW__ |
7bf85405 RD |
434 | %inline %{ |
435 | wxWindow* wxWindow_FindFocus() { | |
436 | return wxWindow::FindFocus(); | |
437 | } | |
438 | %} | |
af309447 RD |
439 | |
440 | ||
441 | %inline %{ | |
442 | wxWindow* wxWindow_FromHWND(unsigned long hWnd) { | |
443 | wxWindow* win = new wxWindow; | |
444 | win->SetHWND(hWnd); | |
445 | win->SubclassWin(hWnd); | |
446 | return win; | |
447 | } | |
448 | %} | |
853b255a | 449 | #endif |
7bf85405 | 450 | |
a1df7a95 RD |
451 | %inline %{ |
452 | int wxWindow_NewControlId() { | |
453 | return wxWindow::NewControlId(); | |
454 | } | |
455 | int wxWindow_NextControlId(int id) { | |
456 | return wxWindow::NextControlId(id); | |
457 | } | |
458 | int wxWindow_PrevControlId(int id) { | |
459 | return wxWindow::PrevControlId(id); | |
460 | } | |
461 | %} | |
7bf85405 | 462 | |
efc5f224 | 463 | |
7bf85405 RD |
464 | //--------------------------------------------------------------------------- |
465 | ||
466 | class wxPanel : public wxWindow { | |
467 | public: | |
468 | wxPanel(wxWindow* parent, | |
469 | const wxWindowID id, | |
470 | const wxPoint& pos = wxPyDefaultPosition, | |
471 | const wxSize& size = wxPyDefaultSize, | |
472 | long style = wxTAB_TRAVERSAL, | |
473 | const char* name = "panel"); | |
474 | ||
f6bcfd97 | 475 | %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" |
9c039d08 | 476 | |
7bf85405 | 477 | void InitDialog(); |
bb0054cd RD |
478 | wxButton* GetDefaultItem(); |
479 | void SetDefaultItem(wxButton *btn); | |
480 | ||
3ab72185 | 481 | // fix some SWIG trouble... |
bb0054cd RD |
482 | %pragma(python) addtoclass = " |
483 | def GetDefaultItem(self): | |
484 | import controls | |
485 | val = windowsc.wxPanel_GetDefaultItem(self.this) | |
486 | val = controls.wxButtonPtr(val) | |
487 | return val | |
488 | " | |
7bf85405 RD |
489 | }; |
490 | ||
491 | //--------------------------------------------------------------------------- | |
492 | ||
493 | class wxDialog : public wxPanel { | |
494 | public: | |
495 | wxDialog(wxWindow* parent, | |
496 | const wxWindowID id, | |
497 | const wxString& title, | |
498 | const wxPoint& pos = wxPyDefaultPosition, | |
499 | const wxSize& size = wxPyDefaultSize, | |
500 | long style = wxDEFAULT_DIALOG_STYLE, | |
501 | const char* name = "dialogBox"); | |
502 | ||
f6bcfd97 | 503 | %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)" |
9c039d08 | 504 | |
7bf85405 RD |
505 | void Centre(int direction = wxBOTH); |
506 | void EndModal(int retCode); | |
507 | wxString GetTitle(); | |
508 | void Iconize(bool iconize); | |
509 | bool IsIconized(); | |
7bf85405 | 510 | void SetModal(bool flag); |
853b255a | 511 | bool IsModal(); |
7bf85405 RD |
512 | void SetTitle(const wxString& title); |
513 | bool Show(bool show); | |
514 | int ShowModal(); | |
4cd9591a RD |
515 | |
516 | int GetReturnCode(); | |
517 | void SetReturnCode(int retCode); | |
7bf85405 RD |
518 | }; |
519 | ||
520 | //--------------------------------------------------------------------------- | |
521 | ||
bb0054cd | 522 | class wxScrolledWindow : public wxPanel { |
7bf85405 RD |
523 | public: |
524 | wxScrolledWindow(wxWindow* parent, | |
525 | const wxWindowID id = -1, | |
526 | const wxPoint& pos = wxPyDefaultPosition, | |
527 | const wxSize& size = wxPyDefaultSize, | |
528 | long style = wxHSCROLL | wxVSCROLL, | |
529 | char* name = "scrolledWindow"); | |
530 | ||
f6bcfd97 BP |
531 | %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" |
532 | %pragma(python) addtomethod = "__init__:#wx._StdOnScrollCallbacks(self)" | |
9c039d08 | 533 | |
7bf85405 | 534 | void EnableScrolling(bool xScrolling, bool yScrolling); |
b7e72427 | 535 | int GetScrollPageSize(int orient); |
7bf85405 | 536 | void GetScrollPixelsPerUnit(int* OUTPUT, int* OUTPUT); |
b7e72427 | 537 | wxWindow* GetTargetWindow(); |
7bf85405 RD |
538 | void GetVirtualSize(int* OUTPUT, int* OUTPUT); |
539 | bool IsRetained(); | |
540 | void PrepareDC(wxDC& dc); | |
541 | void Scroll(int x, int y); | |
542 | void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, | |
543 | int noUnitsX, int noUnitsY, | |
f6bcfd97 | 544 | int xPos = 0, int yPos = 0, int noRefresh=FALSE); |
b7e72427 | 545 | void SetScrollPageSize(int orient, int pageSize); |
eb715945 | 546 | void SetTargetWindow(wxWindow* window); |
4c9993c3 | 547 | void GetViewStart(int* OUTPUT, int* OUTPUT); |
7bf85405 | 548 | void ViewStart(int* OUTPUT, int* OUTPUT); |
9d8bd15f RD |
549 | |
550 | void CalcScrolledPosition( int x, int y, int *OUTPUT, int *OUTPUT); | |
551 | void CalcUnscrolledPosition( int x, int y, int *OUTPUT, int *OUTPUT); | |
552 | ||
7bf85405 RD |
553 | }; |
554 | ||
555 | //---------------------------------------------------------------------- | |
556 | ||
557 | ||
558 | class wxMenu : public wxEvtHandler { | |
559 | public: | |
8bf5d46e | 560 | wxMenu(const wxString& title = wxPyEmptyStr, long style = 0); |
7bf85405 RD |
561 | |
562 | void Append(int id, const wxString& item, | |
563 | const wxString& helpString = wxPyEmptyStr, | |
564 | int checkable = FALSE); | |
565 | %name(AppendMenu)void Append(int id, const wxString& item, wxMenu *subMenu, | |
566 | const wxString& helpString = wxPyEmptyStr); | |
af309447 RD |
567 | %name(AppendItem)void Append(const wxMenuItem* item); |
568 | ||
7bf85405 RD |
569 | void AppendSeparator(); |
570 | void Break(); | |
571 | void Check(int id, bool flag); | |
b1462dfa | 572 | bool IsChecked(int id); |
7bf85405 | 573 | void Enable(int id, bool enable); |
b1462dfa RD |
574 | bool IsEnabled(int id); |
575 | ||
7bf85405 | 576 | int FindItem(const wxString& itemString); |
b1462dfa RD |
577 | %name(FindItemById)wxMenuItem* FindItem(int id/*, wxMenu **menu = NULL*/); |
578 | ||
7bf85405 | 579 | wxString GetTitle(); |
7bf85405 | 580 | void SetTitle(const wxString& title); |
b1462dfa | 581 | |
714e6a9e | 582 | wxString GetLabel(int id); |
853b255a | 583 | void SetLabel(int id, const wxString& label); |
b1462dfa RD |
584 | |
585 | wxString GetHelpString(int id); | |
586 | void SetHelpString(int id, const wxString& helpString); | |
8bf5d46e | 587 | void UpdateUI(wxEvtHandler* source = NULL); |
efc5f224 | 588 | |
b1462dfa RD |
589 | bool Delete(int id); |
590 | %name(DeleteItem)bool Delete(wxMenuItem *item); | |
591 | bool Insert(size_t pos, wxMenuItem *item); | |
592 | wxMenuItem *Remove(int id); | |
593 | %name(RemoveItem) wxMenuItem *Remove(wxMenuItem *item); | |
594 | ||
efc5f224 | 595 | %addmethods { |
eb715945 | 596 | void Destroy() { delete self; } |
efc5f224 | 597 | } |
b1462dfa RD |
598 | %name(DestroyId)bool Destroy(int id); |
599 | %name(DestroyItem)bool Destroy(wxMenuItem *item); | |
efc5f224 | 600 | |
b1462dfa RD |
601 | size_t GetMenuItemCount(); |
602 | //wxMenuItemList& GetMenuItems(); | |
603 | %addmethods { | |
604 | PyObject* GetMenuItems() { | |
605 | wxMenuItemList& list = self->GetMenuItems(); | |
606 | return wxPy_ConvertList(&list, "wxMenuItem"); | |
607 | } | |
608 | } | |
7bf85405 | 609 | |
b1462dfa RD |
610 | void SetEventHandler(wxEvtHandler *handler); |
611 | wxEvtHandler *GetEventHandler(); | |
612 | ||
613 | void SetInvokingWindow(wxWindow *win); | |
614 | wxWindow *GetInvokingWindow(); | |
615 | ||
616 | long GetStyle(); | |
617 | ||
618 | bool IsAttached(); | |
619 | ||
620 | void SetParent(wxMenu *parent); | |
621 | wxMenu *GetParent(); | |
622 | }; | |
7bf85405 | 623 | |
7bf85405 RD |
624 | |
625 | //---------------------------------------------------------------------- | |
626 | ||
b1462dfa | 627 | class wxMenuBar : public wxWindow { |
7bf85405 RD |
628 | public: |
629 | wxMenuBar(); | |
630 | ||
b1462dfa RD |
631 | bool Append(wxMenu *menu, const wxString& title); |
632 | bool Insert(size_t pos, wxMenu *menu, const wxString& title); | |
633 | size_t GetMenuCount(); | |
634 | wxMenu *GetMenu(size_t pos); | |
635 | wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title); | |
636 | wxMenu *Remove(size_t pos); | |
637 | void EnableTop(size_t pos, bool enable); | |
638 | void SetLabelTop(size_t pos, const wxString& label); | |
639 | wxString GetLabelTop(size_t pos); | |
640 | int FindMenuItem(const wxString& menuString, const wxString& itemString); | |
641 | %name(FindItemById)wxMenuItem* FindItem(int id/*, wxMenu **menu = NULL*/); | |
7bf85405 | 642 | void Enable(int id, bool enable); |
b1462dfa | 643 | void Check(int id, bool check); |
2abc0a0f RD |
644 | bool IsChecked(int id); |
645 | bool IsEnabled(int id); | |
b1462dfa RD |
646 | |
647 | void SetLabel(int id, const wxString &label); | |
7bf85405 | 648 | wxString GetLabel(int id); |
b1462dfa | 649 | |
7bf85405 | 650 | void SetHelpString(int id, const wxString& helpString); |
b1462dfa | 651 | wxString GetHelpString(int id); |
2abc0a0f | 652 | |
7bf85405 RD |
653 | }; |
654 | ||
655 | ||
656 | //---------------------------------------------------------------------- | |
657 | ||
658 | class wxMenuItem { | |
659 | public: | |
4c9993c3 | 660 | wxMenuItem(wxMenu* parentMenu=NULL, int id=wxID_SEPARATOR, |
cf694132 | 661 | const wxString& text = wxPyEmptyStr, |
b1462dfa RD |
662 | const wxString& help = wxPyEmptyStr, |
663 | bool isCheckable = FALSE, wxMenu* subMenu = NULL); | |
cf694132 | 664 | |
b1462dfa RD |
665 | |
666 | wxMenu *GetMenu(); | |
2abc0a0f | 667 | void SetId(int id); |
b1462dfa RD |
668 | int GetId(); |
669 | bool IsSeparator(); | |
2abc0a0f | 670 | void SetText(const wxString& str); |
b1462dfa | 671 | wxString GetLabel(); |
2abc0a0f | 672 | const wxString& GetText(); |
2abc0a0f | 673 | void SetCheckable(bool checkable); |
b1462dfa RD |
674 | bool IsCheckable(); |
675 | bool IsSubMenu(); | |
2abc0a0f | 676 | void SetSubMenu(wxMenu *menu); |
b1462dfa RD |
677 | wxMenu *GetSubMenu(); |
678 | void Enable(bool enable = TRUE); | |
679 | bool IsEnabled(); | |
680 | void Check(bool check = TRUE); | |
681 | bool IsChecked(); | |
682 | void Toggle(); | |
683 | void SetHelp(const wxString& str); | |
684 | const wxString& GetHelp(); | |
685 | wxAcceleratorEntry *GetAccel(); | |
686 | void SetAccel(wxAcceleratorEntry *accel); | |
687 | ||
7bf85405 RD |
688 | }; |
689 | ||
690 | //--------------------------------------------------------------------------- | |
7bf85405 RD |
691 | |
692 | ||
694759cf | 693 |