1//---------------------------------------------------------------------------
2// This file is generated by wxPython's SIP generator.  Do not edit by hand.
3//
4// Copyright: (c) 2018 by Total Control Software
5// License:   wxWindows License
6//
7// This file will be included by _core.sip
8//
9//---------------------------------------------------------------------------
10
11//---------------------------------------------------------------------------
12
13class wxMenu : wxEvtHandler
14{
15    %Docstring
16        Menu()
17        Menu(style)
18        Menu(title, style=0)
19
20        A menu is a popup (or pull down) list of items, one of which may be
21        selected before the menu goes away (clicking elsewhere dismisses the
22        menu).
23    %End
24    %TypeHeaderCode
25        #include <wx/menu.h>
26    %End
27
28public:
29    wxMenu();
30    %PreMethodCode
31        if (!wxPyCheckForApp()) return NULL;
32    %End
33
34    wxMenu(
35        long style
36    );
37    %PreMethodCode
38        if (!wxPyCheckForApp()) return NULL;
39    %End
40
41    wxMenu(
42        const wxString & title,
43        long style = 0
44    );
45    %PreMethodCode
46        if (!wxPyCheckForApp()) return NULL;
47    %End
48
49    ~wxMenu();
50
51    wxMenuItemList & GetMenuItems()   /NoCopy/;
52    %Docstring
53        GetMenuItems() -> MenuItemList
54
55        Returns the list of items in the menu.
56    %End
57
58    wxMenuItem * Append(
59        int id,
60        const wxString & item = wxEmptyString,
61        const wxString & helpString = wxEmptyString,
62        wxItemKind kind = wxITEM_NORMAL
63    );
64    %Docstring
65        Append(id, item=EmptyString, helpString=EmptyString, kind=ITEM_NORMAL) -> MenuItem
66        Append(id, item, subMenu, helpString=EmptyString) -> MenuItem
67        Append(menuItem) -> MenuItem
68
69        Adds a menu item.
70    %End
71
72    wxMenuItem * Append(
73        int id,
74        const wxString & item,
75        wxMenu * subMenu   /Transfer/,
76        const wxString & helpString = wxEmptyString
77    )   /Deprecated/;
78
79    wxMenuItem * Append(
80        wxMenuItem * menuItem   /Transfer/
81    );
82
83    wxMenuItem * AppendCheckItem(
84        int id,
85        const wxString & item,
86        const wxString & help = wxEmptyString
87    );
88    %Docstring
89        AppendCheckItem(id, item, help=EmptyString) -> MenuItem
90
91        Adds a checkable item to the end of the menu.
92    %End
93
94    wxMenuItem * AppendRadioItem(
95        int id,
96        const wxString & item,
97        const wxString & help = wxEmptyString
98    );
99    %Docstring
100        AppendRadioItem(id, item, help=EmptyString) -> MenuItem
101
102        Adds a radio item to the end of the menu.
103    %End
104
105    wxMenuItem * AppendSeparator();
106    %Docstring
107        AppendSeparator() -> MenuItem
108
109        Adds a separator to the end of the menu.
110    %End
111
112    wxMenuItem * AppendSubMenu(
113        wxMenu * submenu   /Transfer/,
114        const wxString & text,
115        const wxString & help = wxEmptyString
116    );
117    %Docstring
118        AppendSubMenu(submenu, text, help=EmptyString) -> MenuItem
119
120        Adds the given submenu to this menu.
121    %End
122
123    void Break();
124    %Docstring
125        Break()
126
127        Inserts a break in a menu, causing the next appended item to appear in
128        a new column.
129    %End
130
131    void Check(
132        int id,
133        bool check
134    );
135    %Docstring
136        Check(id, check)
137
138        Checks or unchecks the menu item.
139    %End
140
141    bool Delete(
142        int id
143    );
144    %Docstring
145        Delete(id) -> bool
146        Delete(item) -> bool
147
148        Deletes the menu item from the menu.
149    %End
150
151    bool Delete(
152        wxMenuItem * item
153    );
154
155    bool Destroy(
156        int id
157    )   /PyName=DestroyItem/;
158    %Docstring
159        DestroyItem(id) -> bool
160        DestroyItem(item) -> bool
161
162        Deletes the menu item from the menu.
163    %End
164
165    bool Destroy(
166        wxMenuItem * item
167    )   /PyName=DestroyItem/;
168
169    void Enable(
170        int id,
171        bool enable
172    );
173    %Docstring
174        Enable(id, enable)
175
176        Enables or disables (greys out) a menu item.
177    %End
178
179    wxMenuItem * FindChildItem(
180        int id,
181        size_t * pos   /Out/ = NULL
182    ) const;
183    %Docstring
184        FindChildItem(id) -> (MenuItem, pos)
185
186        Finds the menu item object associated with the given menu item
187        identifier and, optionally, the position of the item in the menu.
188    %End
189
190    int FindItem(
191        const wxString & itemString
192    ) const;
193    %Docstring
194        FindItem(itemString) -> int
195        FindItem(id) -> (MenuItem, menu)
196
197        Finds the menu id for a menu item string.
198    %End
199
200    wxMenuItem * FindItem(
201        int id,
202        wxMenu ** menu   /Out/ = NULL
203    ) const;
204
205    wxMenuItem * FindItemByPosition(
206        size_t position
207    ) const;
208    %Docstring
209        FindItemByPosition(position) -> MenuItem
210
211        Returns the wxMenuItem given a position in the menu.
212    %End
213
214    wxString GetHelpString(
215        int id
216    ) const;
217    %Docstring
218        GetHelpString(id) -> String
219
220        Returns the help string associated with a menu item.
221    %End
222
223    wxString GetLabel(
224        int id
225    ) const;
226    %Docstring
227        GetLabel(id) -> String
228
229        Returns a menu item label.
230    %End
231
232    wxString GetLabelText(
233        int id
234    ) const;
235    %Docstring
236        GetLabelText(id) -> String
237
238        Returns a menu item label, without any of the original mnemonics and
239        accelerators.
240    %End
241
242    size_t GetMenuItemCount() const;
243    %Docstring
244        GetMenuItemCount() -> size_t
245
246        Returns the number of items in the menu.
247    %End
248
249    const wxString & GetTitle() const;
250    %Docstring
251        GetTitle() -> String
252
253        Returns the title of the menu.
254    %End
255
256    wxMenuItem * Insert(
257        size_t pos,
258        wxMenuItem * menuItem   /Transfer/
259    );
260    %Docstring
261        Insert(pos, menuItem) -> MenuItem
262        Insert(pos, id, item=EmptyString, helpString=EmptyString, kind=ITEM_NORMAL) -> MenuItem
263        Insert(pos, id, text, submenu, help=EmptyString) -> MenuItem
264
265        Inserts the given item before the position pos.
266    %End
267
268    wxMenuItem * Insert(
269        size_t pos,
270        int id,
271        const wxString & item = wxEmptyString,
272        const wxString & helpString = wxEmptyString,
273        wxItemKind kind = wxITEM_NORMAL
274    );
275
276    wxMenuItem * Insert(
277        size_t pos,
278        int id,
279        const wxString & text,
280        wxMenu * submenu   /Transfer/,
281        const wxString & help = wxEmptyString
282    );
283
284    wxMenuItem * InsertCheckItem(
285        size_t pos,
286        int id,
287        const wxString & item,
288        const wxString & helpString = wxEmptyString
289    );
290    %Docstring
291        InsertCheckItem(pos, id, item, helpString=EmptyString) -> MenuItem
292
293        Inserts a checkable item at the given position.
294    %End
295
296    wxMenuItem * InsertRadioItem(
297        size_t pos,
298        int id,
299        const wxString & item,
300        const wxString & helpString = wxEmptyString
301    );
302    %Docstring
303        InsertRadioItem(pos, id, item, helpString=EmptyString) -> MenuItem
304
305        Inserts a radio item at the given position.
306    %End
307
308    wxMenuItem * InsertSeparator(
309        size_t pos
310    );
311    %Docstring
312        InsertSeparator(pos) -> MenuItem
313
314        Inserts a separator at the given position.
315    %End
316
317    bool IsChecked(
318        int id
319    ) const;
320    %Docstring
321        IsChecked(id) -> bool
322
323        Determines whether a menu item is checked.
324    %End
325
326    bool IsEnabled(
327        int id
328    ) const;
329    %Docstring
330        IsEnabled(id) -> bool
331
332        Determines whether a menu item is enabled.
333    %End
334
335    wxMenuItem * Prepend(
336        wxMenuItem * menuItem   /Transfer/
337    );
338    %Docstring
339        Prepend(menuItem) -> MenuItem
340        Prepend(id, item=EmptyString, helpString=EmptyString, kind=ITEM_NORMAL) -> MenuItem
341        Prepend(id, text, subMenu, help=EmptyString) -> MenuItem
342
343        Inserts the given item at position 0, i.e. before all the other
344        existing items.
345    %End
346
347    wxMenuItem * Prepend(
348        int id,
349        const wxString & item = wxEmptyString,
350        const wxString & helpString = wxEmptyString,
351        wxItemKind kind = wxITEM_NORMAL
352    );
353
354    wxMenuItem * Prepend(
355        int id,
356        const wxString & text,
357        wxMenu * subMenu   /Transfer/,
358        const wxString & help = wxEmptyString
359    );
360
361    wxMenuItem * PrependCheckItem(
362        int id,
363        const wxString & item,
364        const wxString & helpString = wxEmptyString
365    );
366    %Docstring
367        PrependCheckItem(id, item, helpString=EmptyString) -> MenuItem
368
369        Inserts a checkable item at position 0.
370    %End
371
372    wxMenuItem * PrependRadioItem(
373        int id,
374        const wxString & item,
375        const wxString & helpString = wxEmptyString
376    );
377    %Docstring
378        PrependRadioItem(id, item, helpString=EmptyString) -> MenuItem
379
380        Inserts a radio item at position 0.
381    %End
382
383    wxMenuItem * PrependSeparator();
384    %Docstring
385        PrependSeparator() -> MenuItem
386
387        Inserts a separator at position 0.
388    %End
389
390    wxMenuItem * Remove(
391        int id
392    )   /TransferBack/;
393    %Docstring
394        Remove(id) -> MenuItem
395        Remove(item) -> MenuItem
396
397        Removes the menu item from the menu but doesn't delete the associated
398        C++ object.
399    %End
400
401    wxMenuItem * Remove(
402        wxMenuItem * item
403    )   /TransferBack/;
404
405    void SetHelpString(
406        int id,
407        const wxString & helpString
408    );
409    %Docstring
410        SetHelpString(id, helpString)
411
412        Sets an item's help string.
413    %End
414
415    void SetLabel(
416        int id,
417        const wxString & label
418    );
419    %Docstring
420        SetLabel(id, label)
421
422        Sets the label of a menu item.
423    %End
424
425    void SetTitle(
426        const wxString & title
427    );
428    %Docstring
429        SetTitle(title)
430
431        Sets the title of the menu.
432    %End
433
434    void UpdateUI(
435        wxEvtHandler * source = NULL
436    );
437    %Docstring
438        UpdateUI(source=None)
439
440        Sends events to source (or owning window if NULL) to update the menu
441        UI.
442    %End
443
444    void SetInvokingWindow(
445        wxWindow * win
446    );
447    %Docstring
448        SetInvokingWindow(win)
449    %End
450
451    wxWindow * GetInvokingWindow() const;
452    %Docstring
453        GetInvokingWindow() -> Window
454    %End
455
456    wxWindow * GetWindow() const;
457    %Docstring
458        GetWindow() -> Window
459    %End
460
461    long GetStyle() const;
462    %Docstring
463        GetStyle() -> long
464    %End
465
466    void SetParent(
467        wxMenu * parent
468    );
469    %Docstring
470        SetParent(parent)
471    %End
472
473    wxMenu * GetParent() const;
474    %Docstring
475        GetParent() -> Menu
476    %End
477
478    void Attach(
479        wxMenuBar * menubar
480    );
481    %Docstring
482        Attach(menubar)
483    %End
484
485    void Detach();
486    %Docstring
487        Detach()
488    %End
489
490    bool IsAttached() const;
491    %Docstring
492        IsAttached() -> bool
493    %End
494
495    wxMenuItem* FindItemById(int id) const;
496    %Docstring
497        FindItemById(id) -> MenuItem
498
499        FindItemById(id) -> MenuItem
500
501        Finds the menu item object associated with the given menu item
502        identifier.
503    %End
504    %MethodCode
505        PyErr_Clear();
506        Py_BEGIN_ALLOW_THREADS
507        sipRes = _wxMenu_FindItemById(sipCpp, id);
508        Py_END_ALLOW_THREADS
509        if (PyErr_Occurred()) sipIsErr = 1;
510    %End
511    %TypeCode
512    wxMenuItem* _wxMenu_FindItemById(const wxMenu* self, int id)
513    {
514        return self->FindItem(id);
515    }
516    %End
517
518    public:
519
520
521    %Property(name=InvokingWindow, get=GetInvokingWindow, set=SetInvokingWindow)
522    %Property(name=MenuItemCount, get=GetMenuItemCount)
523    %Property(name=MenuItems, get=GetMenuItems)
524    %Property(name=Parent, get=GetParent, set=SetParent)
525    %Property(name=Style, get=GetStyle)
526    %Property(name=Title, get=GetTitle, set=SetTitle)
527    %Property(name=Window, get=GetWindow)
528};  // end of class wxMenu
529
530
531%Extract(id=pycode_core)
532def _Menu_AppendMenu(self, id, item, subMenu, help=""):
533    return self.Append(id, item, subMenu, help)
534Menu.AppendMenu = wx.deprecated(_Menu_AppendMenu, "Use Append instead.")
535del _Menu_AppendMenu
536%End
537
538%Extract(id=pycode_core)
539def _Menu_AppendItem(self, menuItem):
540    return self.Append(menuItem)
541Menu.AppendItem = wx.deprecated(_Menu_AppendItem, "Use Append instead.")
542del _Menu_AppendItem
543%End
544
545%Extract(id=pycode_core)
546def _Menu_InsertMenu(self, pos, id, item, subMenu, help=""):
547    return self.Insert(pos, id, item, subMenu, help)
548Menu.InsertMenu = wx.deprecated(_Menu_InsertMenu, "Use Insert instead.")
549del _Menu_InsertMenu
550%End
551
552%Extract(id=pycode_core)
553def _Menu_InsertItem(self, pos, menuItem):
554    return self.Insert(pos, menuItem)
555Menu.InsertItem = wx.deprecated(_Menu_InsertItem, "Use Insert instead.")
556del _Menu_InsertItem
557%End
558
559%Extract(id=pycode_core)
560def _Menu_PrependMenu(self, id, item, subMenu, help=""):
561    return self.Prepend(id, item, subMenu, help)
562Menu.PrependMenu = wx.deprecated(_Menu_PrependMenu, "Use Prepend instead.")
563del _Menu_PrependMenu
564%End
565
566%Extract(id=pycode_core)
567def _Menu_PrependItem(self, menuItem):
568    return self.Prepend(menuItem)
569Menu.PrependItem = wx.deprecated(_Menu_PrependItem, "Use Prepend instead.")
570del _Menu_PrependItem
571%End
572
573%Extract(id=pycode_core)
574def _Menu_RemoveMenu(self, id, item, subMenu, help=""):
575    return self.Remove(id, item, subMenu, help)
576Menu.RemoveMenu = wx.deprecated(_Menu_RemoveMenu, "Use Remove instead.")
577del _Menu_RemoveMenu
578%End
579
580%Extract(id=pycode_core)
581def _Menu_RemoveItem(self, menuItem):
582    return self.Remove(menuItem)
583Menu.RemoveItem = wx.deprecated(_Menu_RemoveItem, "Use Remove instead.")
584del _Menu_RemoveItem
585%End
586
587class wxMenuBar : wxWindow
588{
589    %Docstring
590        MenuBar(style=0)
591
592        A menu bar is a series of menus accessible from the top of a frame.
593    %End
594    %TypeHeaderCode
595        #include <wx/menu.h>
596    %End
597
598public:
599    wxMenuBar(
600        long style = 0
601    );
602    %PreMethodCode
603        if (!wxPyCheckForApp()) return NULL;
604    %End
605
606    ~wxMenuBar();
607
608    bool Append(
609        wxMenu * menu   /Transfer/,
610        const wxString & title
611    );
612    %Docstring
613        Append(menu, title) -> bool
614
615        Adds the item to the end of the menu bar.
616    %End
617
618    void Check(
619        int id,
620        bool check
621    );
622    %Docstring
623        Check(id, check)
624
625        Checks or unchecks a menu item.
626    %End
627
628    void Enable(
629        int id,
630        bool enable
631    );
632    %Docstring
633        Enable(id, enable)
634
635        Enables or disables (greys out) a menu item.
636    %End
637
638    bool IsEnabledTop(
639        size_t pos
640    ) const;
641    %Docstring
642        IsEnabledTop(pos) -> bool
643
644        Returns true if the menu with the given index is enabled.
645    %End
646
647    void EnableTop(
648        size_t pos,
649        bool enable
650    );
651    %Docstring
652        EnableTop(pos, enable)
653
654        Enables or disables a whole menu.
655    %End
656
657    wxMenuItem * FindItem(
658        int id,
659        wxMenu ** menu   /Out/ = NULL
660    ) const;
661    %Docstring
662        FindItem(id) -> (MenuItem, menu)
663
664        Finds the menu item object associated with the given menu item
665        identifier.
666    %End
667
668    int FindMenu(
669        const wxString & title
670    ) const;
671    %Docstring
672        FindMenu(title) -> int
673
674        Returns the index of the menu with the given title or wxNOT_FOUND if
675        no such menu exists in this menubar.
676    %End
677
678    int FindMenuItem(
679        const wxString & menuString,
680        const wxString & itemString
681    ) const;
682    %Docstring
683        FindMenuItem(menuString, itemString) -> int
684
685        Finds the menu item id for a menu name/menu item string pair.
686    %End
687
688    wxString GetHelpString(
689        int id
690    ) const;
691    %Docstring
692        GetHelpString(id) -> String
693
694        Gets the help string associated with the menu item identifier.
695    %End
696
697    wxString GetLabel(
698        int id
699    ) const;
700    %Docstring
701        GetLabel(id) -> String
702
703        Gets the label associated with a menu item.
704    %End
705
706    wxString GetLabelTop(
707        size_t pos
708    ) const   /Deprecated/;
709    %Docstring
710        GetLabelTop(pos) -> String
711
712        Returns the label of a top-level menu.
713    %End
714
715    wxMenu * GetMenu(
716        size_t menuIndex
717    ) const;
718    %Docstring
719        GetMenu(menuIndex) -> Menu
720
721        Returns the menu at menuIndex (zero-based).
722    %End
723
724    size_t GetMenuCount() const;
725    %Docstring
726        GetMenuCount() -> size_t
727
728        Returns the number of menus in this menubar.
729    %End
730
731    wxString GetMenuLabel(
732        size_t pos
733    ) const;
734    %Docstring
735        GetMenuLabel(pos) -> String
736
737        Returns the label of a top-level menu.
738    %End
739
740    wxString GetMenuLabelText(
741        size_t pos
742    ) const;
743    %Docstring
744        GetMenuLabelText(pos) -> String
745
746        Returns the label of a top-level menu.
747    %End
748
749    bool Insert(
750        size_t pos,
751        wxMenu * menu   /Transfer/,
752        const wxString & title
753    );
754    %Docstring
755        Insert(pos, menu, title) -> bool
756
757        Inserts the menu at the given position into the menu bar.
758    %End
759
760    bool IsChecked(
761        int id
762    ) const;
763    %Docstring
764        IsChecked(id) -> bool
765
766        Determines whether an item is checked.
767    %End
768
769    bool IsEnabled(
770        int id
771    ) const;
772    %Docstring
773        IsEnabled(id) -> bool
774
775        Determines whether an item is enabled.
776    %End
777
778    void Refresh(
779        bool eraseBackground = true,
780        const wxRect * rect = NULL
781    );
782    %Docstring
783        Refresh(eraseBackground=True, rect=None)
784
785        Redraw the menu bar.
786    %End
787
788    wxMenu * Remove(
789        size_t pos
790    )   /TransferBack/;
791    %Docstring
792        Remove(pos) -> Menu
793
794        Removes the menu from the menu bar and returns the menu object - the
795        caller is responsible for deleting it.
796    %End
797
798    wxMenu * Replace(
799        size_t pos,
800        wxMenu * menu   /Transfer/,
801        const wxString & title
802    )   /TransferBack/;
803    %Docstring
804        Replace(pos, menu, title) -> Menu
805
806        Replaces the menu at the given position with another one.
807    %End
808
809    void SetHelpString(
810        int id,
811        const wxString & helpString
812    );
813    %Docstring
814        SetHelpString(id, helpString)
815
816        Sets the help string associated with a menu item.
817    %End
818
819    void SetLabel(
820        int id,
821        const wxString & label
822    );
823    %Docstring
824        SetLabel(id, label)
825
826        Sets the label of a menu item.
827    %End
828
829    void SetLabelTop(
830        size_t pos,
831        const wxString & label
832    )   /Deprecated/;
833    %Docstring
834        SetLabelTop(pos, label)
835
836        Sets the label of a top-level menu.
837    %End
838
839    void SetMenuLabel(
840        size_t pos,
841        const wxString & label
842    );
843    %Docstring
844        SetMenuLabel(pos, label)
845
846        Sets the label of a top-level menu.
847    %End
848
849    wxMenu * OSXGetAppleMenu() const;
850    %Docstring
851        OSXGetAppleMenu() -> Menu
852
853        Returns the Apple menu.
854    %End
855    %MethodCode
856        PyErr_Clear();
857        Py_BEGIN_ALLOW_THREADS
858        sipRes = _wxMenuBar_OSXGetAppleMenu(sipCpp);
859        Py_END_ALLOW_THREADS
860        if (PyErr_Occurred()) sipIsErr = 1;
861    %End
862    %TypeCode
863    wxMenu * _wxMenuBar_OSXGetAppleMenu(const wxMenuBar* self)
864    {
865        #ifdef __WXMAC__
866            return self->OSXGetAppleMenu();
867        #else
868            return NULL;
869        #endif
870    }
871    %End
872
873    wxFrame * GetFrame() const;
874    %Docstring
875        GetFrame() -> Frame
876    %End
877
878    bool IsAttached() const;
879    %Docstring
880        IsAttached() -> bool
881    %End
882
883    void Attach(
884        wxFrame * frame
885    );
886    %Docstring
887        Attach(frame)
888    %End
889
890    void Detach();
891    %Docstring
892        Detach()
893    %End
894
895    static
896    void MacSetCommonMenuBar(
897        wxMenuBar * menubar
898    );
899    %Docstring
900        MacSetCommonMenuBar(menubar)
901
902        Enables you to set the global menubar on Mac, that is, the menubar
903        displayed when the app is running without any frames open.
904    %End
905    %MethodCode
906        PyErr_Clear();
907        Py_BEGIN_ALLOW_THREADS
908        _wxMenuBar_MacSetCommonMenuBar(menubar);
909        Py_END_ALLOW_THREADS
910        if (PyErr_Occurred()) sipIsErr = 1;
911    %End
912    %TypeCode
913    void _wxMenuBar_MacSetCommonMenuBar(wxMenuBar *menubar)
914    {
915        #ifdef __WXMAC__
916            wxMenuBar::MacSetCommonMenuBar(menubar);
917        #endif
918    }
919    %End
920
921    static
922    wxMenuBar * MacGetCommonMenuBar();
923    %Docstring
924        MacGetCommonMenuBar() -> MenuBar
925
926        Enables you to get the global menubar on Mac, that is, the menubar
927        displayed when the app is running without any frames open.
928    %End
929    %MethodCode
930        PyErr_Clear();
931        Py_BEGIN_ALLOW_THREADS
932        sipRes = _wxMenuBar_MacGetCommonMenuBar();
933        Py_END_ALLOW_THREADS
934        if (PyErr_Occurred()) sipIsErr = 1;
935    %End
936    %TypeCode
937    wxMenuBar * _wxMenuBar_MacGetCommonMenuBar()
938    {
939        #ifdef __WXMAC__
940            return wxMenuBar::MacGetCommonMenuBar();
941        #else
942            return NULL;
943        #endif
944    }
945    %End
946
947    wxMenuItem* FindItemById(int id) const;
948    %Docstring
949        FindItemById(id) -> MenuItem
950
951        FindItemById(id) -> MenuItem
952
953        Finds the menu item object associated with the given menu item
954        identifier.
955    %End
956    %MethodCode
957        PyErr_Clear();
958        Py_BEGIN_ALLOW_THREADS
959        sipRes = _wxMenuBar_FindItemById(sipCpp, id);
960        Py_END_ALLOW_THREADS
961        if (PyErr_Occurred()) sipIsErr = 1;
962    %End
963    %TypeCode
964    wxMenuItem* _wxMenuBar_FindItemById(const wxMenuBar* self, int id)
965    {
966        return self->FindItem(id);
967    }
968    %End
969
970};  // end of class wxMenuBar
971
972
973%Extract(id=pycode_core)
974def _MenuBar_GetMenus(self):
975    """
976    GetMenus() -> (menu, label)
977
978    Return a list of (menu, label) items for the menus in the :class:`MenuBar`.
979    """
980    return [(self.GetMenu(i), self.GetLabelTop(i)) for i in range(self.GetMenuCount())]
981MenuBar.GetMenus = _MenuBar_GetMenus
982del _MenuBar_GetMenus
983%End
984
985%Extract(id=pycode_core)
986def _MenuBar_SetMenus(self, items):
987    """
988    SetMenus()
989
990    Clear and add new menus to the :class:`MenuBar` from a list of (menu, label) items.
991    """
992    for i in range(self.GetMenuCount()-1, -1, -1):
993        self.Remove(i)
994    for m, l in items:
995        self.Append(m, l)
996MenuBar.SetMenus = _MenuBar_SetMenus
997del _MenuBar_SetMenus
998%End
999
1000%Extract(id=pycode_core)
1001MenuBar.Menus = property(MenuBar.GetMenus, MenuBar.SetMenus)
1002%End
1003
1004class wxMenuList_iterator /Abstract/
1005{
1006    // the C++ implementation of this class
1007    %TypeHeaderCode
1008
1009        class wxMenuList_iterator {
1010        public:
1011            wxMenuList_iterator(wxMenuList::compatibility_iterator start)
1012                : m_node(start) {}
1013
1014            wxMenu* __next__() {
1015                wxMenu* obj = NULL;
1016                if (m_node) {
1017                    obj = (wxMenu*) m_node->GetData();
1018                    m_node = m_node->GetNext();
1019                }
1020                else {
1021                    PyErr_SetString(PyExc_StopIteration, "");
1022                }
1023                return (wxMenu*)obj;
1024            }
1025        private:
1026            wxMenuList::compatibility_iterator m_node;
1027        };
1028    %End
1029public:
1030    wxMenu* __next__();
1031    %MethodCode
1032        sipRes = sipCpp->__next__();
1033        if (PyErr_Occurred())
1034            return NULL;
1035    %End
1036};
1037
1038class wxMenuList
1039{
1040    %TypeHeaderCode
1041
1042    %End
1043public:
1044    SIP_SSIZE_T __len__();
1045    %MethodCode
1046        sipRes = sipCpp->size();
1047    %End
1048
1049    wxMenu* __getitem__(long index);
1050    %MethodCode
1051        if (0 > index)
1052            index += sipCpp->size();
1053
1054        if (index < sipCpp->size() && (0 <= index)) {
1055            wxMenuList::compatibility_iterator node = sipCpp->Item(index);
1056            if (node)
1057                sipRes = (wxMenu*)node->GetData();
1058        }
1059        else {
1060            wxPyErr_SetString(PyExc_IndexError, "sequence index out of range");
1061            sipError = sipErrorFail;
1062        }
1063    %End
1064
1065    int __contains__(const wxMenu* obj);
1066    %MethodCode
1067        wxMenuList::compatibility_iterator node;
1068        node = sipCpp->Find((wxMenu*)obj);
1069        sipRes = node != NULL;
1070    %End
1071
1072    wxMenuList_iterator* __iter__() /Factory/;
1073    %MethodCode
1074        sipRes =  new wxMenuList_iterator(sipCpp->GetFirst());
1075    %End
1076
1077    // TODO:  add support for index(value, [start, [stop]])
1078    int index(wxMenu* obj);
1079    %MethodCode
1080        int idx = sipCpp->IndexOf((wxMenu*)obj);
1081        if (idx == wxNOT_FOUND) {
1082            sipError = sipErrorFail;
1083            wxPyErr_SetString(PyExc_ValueError,
1084                              "sequence.index(x): x not in sequence");
1085        }
1086        sipRes = idx;
1087    %End
1088
1089
1090};
1091
1092%Extract(id=pycode_core)
1093def _MenuList___repr__(self):
1094    return "MenuList: " + repr(list(self))
1095MenuList.__repr__ = _MenuList___repr__
1096del _MenuList___repr__
1097%End
1098
1099
1100
1101//---------------------------------------------------------------------------
1102
1103