X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1b8c7ba607a15a2ff8a04448138df9ffff7df6c5..9ce001802c71e3728dbe6ef0542af730a10c0454:/wxPython/src/_menu.i?ds=sidebyside diff --git a/wxPython/src/_menu.i b/wxPython/src/_menu.i index 9e9d7e7f4b..b57f7bd6e7 100644 --- a/wxPython/src/_menu.i +++ b/wxPython/src/_menu.i @@ -133,8 +133,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 +251,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); @@ -266,7 +268,7 @@ public: %Rename(FindItemById, virtual wxMenuItem*, FindItem(int id /*, wxMenu **menu = NULL*/) const); // find menu by its caption, return wxNOT_FOUND on failure - int FindMenu(const wxString& title) const; + int FindMenu(const wxString& title); // all these functions just use FindItem() and then call an appropriate @@ -279,7 +281,8 @@ public: void Check(int id, bool check); bool IsChecked(int id) const; bool IsEnabled(int id) const; - + // TODO: bool IsEnabled() const; + void SetLabel(int id, const wxString &label); wxString GetLabel(int id) const; @@ -298,6 +301,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 }; //--------------------------------------------------------------------------- @@ -363,7 +376,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); @@ -387,14 +402,29 @@ public: void SetOwnerDrawn(bool ownerDrawn = true); void ResetOwnerDrawn(); #else - // just to keep the global renamers in sync %extend { + void SetFont(const wxFont& font) {} + wxFont GetFont() { return wxNullFont; } + void SetTextColour(const wxColour& colText) {} + wxColour GetTextColour() { return wxNullColour; } + void SetBackgroundColour(const wxColour& colBack) {} + wxColour GetBackgroundColour() { return wxNullColour; } + + void SetBitmaps(const wxBitmap& bmpChecked, + const wxBitmap& bmpUnchecked = wxNullBitmap) + { self->SetBitmap( bmpChecked ); } + + void SetDisabledBitmap( const wxBitmap& bmpDisabled ) {} + const wxBitmap& GetDisabledBitmap() const { return wxNullBitmap; } + + void SetMarginWidth(int nWidth) {} + int GetMarginWidth() { return 0; } static int GetDefaultMarginWidth() { return 0; } + bool IsOwnerDrawn() { return false; } + void SetOwnerDrawn(bool ownerDrawn = true) {} + void ResetOwnerDrawn() {} } #endif - - void SetBitmap(const wxBitmap& bitmap); - const wxBitmap& GetBitmap(); }; //---------------------------------------------------------------------------