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