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