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