X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/be9b4caaea3c473fac197eefaffaf30af47ba256..955e46d25d6ac0f9fa55ec9fe11f0c21da3a494d:/wxPython/src/_menu.i diff --git a/wxPython/src/_menu.i b/wxPython/src/_menu.i index 38fe89cae5..0e3b113553 100644 --- a/wxPython/src/_menu.i +++ b/wxPython/src/_menu.i @@ -55,16 +55,24 @@ 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 %Rename(AppendItem, wxMenuItem*, Append(wxMenuItem *item)); + // insert an item before given position + %Rename(InsertItem, wxMenuItem*, Insert(size_t pos, wxMenuItem *item)); + // prepend an item to the menu + %Rename(PrependItem, wxMenuItem*, Prepend(wxMenuItem *item)); + %cleardisown(wxMenuItem*); + // insert a break in the menu (only works when appending the items, not // inserting them) virtual void Break(); - // insert an item before given position - %Rename(InsertItem, wxMenuItem*, Insert(size_t pos, wxMenuItem *item)); - // insert an item before given position wxMenuItem* Insert(size_t pos, int id, @@ -94,9 +102,6 @@ public: wxMenu *submenu, const wxString& help = wxPyEmptyString)); - // prepend an item to the menu - %Rename(PrependItem, wxMenuItem*, Prepend(wxMenuItem *item)); - // prepend any item to the menu wxMenuItem* Prepend(int id, const wxString& text, @@ -122,9 +127,11 @@ public: wxMenu *submenu, const wxString& help = wxPyEmptyString)); + // detach an item from the menu, but don't delete it so that it can be // added back later (but if it's not, the caller is responsible for // deleting it!) + %newobject Remove; wxMenuItem *Remove(int id); %Rename(RemoveItem, wxMenuItem*, Remove(wxMenuItem *item)); @@ -133,8 +140,10 @@ public: bool Delete(int id); %Rename(DeleteItem, bool, Delete(wxMenuItem *item)); - // delete the item from menu and destroy it (if it's a submenu) + %pythonAppend Destroy "args[0].thisown = 0" %extend { void Destroy() { delete self; } } + + // delete the item from menu and destroy it (if it's a submenu) %Rename(DestroyId, bool, Destroy(int id)); %Rename(DestroyItem, bool, Destroy(wxMenuItem *item)); @@ -249,7 +258,7 @@ public: virtual void EnableTop(size_t pos, bool enable); // is the menu enabled? - virtual bool IsEnabledTop(size_t WXUNUSED(pos)) const { return true; } + virtual bool IsEnabledTop(size_t pos) const; // get or change the label of the menu at given position virtual void SetLabelTop(size_t pos, const wxString& label); @@ -299,6 +308,16 @@ public: // called before deleting the menubar normally virtual void Detach(); + +#ifdef __WXMAC__ + static void SetAutoWindowMenu( bool enable ); + static bool GetAutoWindowMenu(); +#else + %extend { + static void SetAutoWindowMenu( bool enable ) {} + static bool GetAutoWindowMenu() { return false; } + } +#endif }; //--------------------------------------------------------------------------- @@ -311,6 +330,7 @@ public: const wxString& help = wxPyEmptyString, wxItemKind kind = wxITEM_NORMAL, wxMenu* subMenu = NULL); + ~wxMenuItem(); // the menu we're in wxMenu *GetMenu() const; @@ -364,7 +384,9 @@ public: // SetText() virtual void SetAccel(wxAcceleratorEntry *accel); - + void SetBitmap(const wxBitmap& bitmap); + const wxBitmap& GetBitmap(); + // wxOwnerDrawn methods #ifdef __WXMSW__ void SetFont(const wxFont& font); @@ -395,8 +417,10 @@ public: wxColour GetTextColour() { return wxNullColour; } void SetBackgroundColour(const wxColour& colBack) {} wxColour GetBackgroundColour() { return wxNullColour; } + void SetBitmaps(const wxBitmap& bmpChecked, - const wxBitmap& bmpUnchecked = wxNullBitmap) {} + const wxBitmap& bmpUnchecked = wxNullBitmap) + { self->SetBitmap( bmpChecked ); } void SetDisabledBitmap( const wxBitmap& bmpDisabled ) {} const wxBitmap& GetDisabledBitmap() const { return wxNullBitmap; } @@ -409,9 +433,6 @@ public: void ResetOwnerDrawn() {} } #endif - - void SetBitmap(const wxBitmap& bitmap); - const wxBitmap& GetBitmap(); }; //---------------------------------------------------------------------------