]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/_menu.i
Add AddStretchSpacer and friends
[wxWidgets.git] / wxPython / src / _menu.i
index 2dbc925ea550902c1935effeed47098530e14a94..d1122ce95a2116a8b1e78fa07f1742f0bec4f676 100644 (file)
@@ -33,7 +33,7 @@ public:
     
     // append any kind of item (normal/check/radio/separator)
     wxMenuItem* Append(int id,
-                       const wxString& text,
+                       const wxString& text = wxPyEmptyString,
                        const wxString& help = wxPyEmptyString,
                        wxItemKind kind = wxITEM_NORMAL);
 
@@ -55,6 +55,9 @@ public:
                                            wxMenu *submenu,
                                            const wxString& help = wxPyEmptyString));
 
+    wxMenuItem* AppendSubMenu(wxMenu *submenu,
+                              const wxString& text,
+                              const wxString& help = wxPyEmptyString);
 
     %disownarg(wxMenuItem*);
     // the most generic form of Append() - append anything
@@ -73,7 +76,7 @@ public:
     // insert an item before given position
     wxMenuItem* Insert(size_t pos,
                        int id,
-                       const wxString& text,
+                       const wxString& text = wxPyEmptyString,
                        const wxString& help = wxPyEmptyString,
                        wxItemKind kind = wxITEM_NORMAL);
 
@@ -101,7 +104,7 @@ public:
 
     // prepend any item to the menu
     wxMenuItem* Prepend(int id,
-                        const wxString& text,
+                        const wxString& text = wxPyEmptyString,
                         const wxString& help = wxPyEmptyString,
                         wxItemKind kind = wxITEM_NORMAL);
 
@@ -306,6 +309,9 @@ public:
     // called before deleting the menubar normally
     virtual void Detach();
 
+    // update all menu item states in all menus
+    virtual void UpdateMenus();
+
 #ifdef __WXMAC__
     static void SetAutoWindowMenu( bool enable );
     static bool GetAutoWindowMenu();
@@ -315,6 +321,22 @@ public:
         static bool GetAutoWindowMenu() { return false; }
     }
 #endif
+
+    %pythoncode {
+        def GetMenus(self):
+            """Return a list of (menu, label) items for the menus in the MenuBar. """
+            return [(self.GetMenu(i), self.GetLabelTop(i)) 
+                    for i in range(self.GetMenuCount())]
+            
+        def SetMenus(self, items):
+            """Clear and add new menus to the MenuBar from a list of (menu, label) items. """
+            for i in range(self.GetMenuCount()-1, -1, -1):
+                self.Remove(i)
+            for m, l in items:
+                self.Append(m, l)
+    }
+    %property(Menus, GetMenus, SetMenus);
+    
 };
 
 //---------------------------------------------------------------------------