From: Robin Dunn Date: Fri, 23 Jan 2004 21:02:06 +0000 (+0000) Subject: wxMenu::Append (and similar) now return a pointer to the wxMenuItem X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/fe4a107dda9021ed2cdbeda0fcb2d7c02bbfa963?hp=1ba7e7b79f25db2d12c0e672e25b901313618af8 wxMenu::Append (and similar) now return a pointer to the wxMenuItem that was added. Checked on MSW, GTK, and Mac, other port authors please double check changes. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25343 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/cocoa/menu.h b/include/wx/cocoa/menu.h index 8a75b38687..6a834fa9a3 100644 --- a/include/wx/cocoa/menu.h +++ b/include/wx/cocoa/menu.h @@ -46,9 +46,9 @@ protected: // ------------------------------------------------------------------------ protected: // implement base class virtuals - virtual bool DoAppend(wxMenuItem *item); - virtual bool DoInsert(size_t pos, wxMenuItem *item); - virtual wxMenuItem *DoRemove(wxMenuItem *item); + virtual wxMenuItem* DoAppend(wxMenuItem *item); + virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); + virtual wxMenuItem* DoRemove(wxMenuItem *item); #if wxUSE_ACCEL // add/remove accel for the given menu item diff --git a/src/cocoa/menu.mm b/src/cocoa/menu.mm index ae88841c86..d8ed61c0a7 100644 --- a/src/cocoa/menu.mm +++ b/src/cocoa/menu.mm @@ -53,22 +53,22 @@ wxMenu::~wxMenu() [m_cocoaNSMenu release]; } -bool wxMenu::DoAppend(wxMenuItem *item) +wxMenuItem* wxMenu::DoAppend(wxMenuItem *item) { wxAutoNSAutoreleasePool pool; if(!wxMenuBase::DoAppend(item)) - return false; + return NULL; [m_cocoaNSMenu addItem: item->GetNSMenuItem()]; - return true; + return item; } -bool wxMenu::DoInsert(unsigned long pos, wxMenuItem *item) +wxMenuItem* wxMenu::DoInsert(unsigned long pos, wxMenuItem *item) { wxAutoNSAutoreleasePool pool; if(!wxMenuBase::DoInsert(pos,item)) - return false; + return NULL; [m_cocoaNSMenu insertItem:item->GetNSMenuItem() atIndex:pos]; - return true; + return item; } wxMenuItem* wxMenu::DoRemove(wxMenuItem *item)