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