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