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