From 3312496dcc0c6af091defb616d24ea1763df235a Mon Sep 17 00:00:00 2001 From: David Elliott Date: Fri, 15 Oct 2004 02:55:15 +0000 Subject: [PATCH] Allow the dealloc message to be caught git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29866 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/cocoa/NSMenu.h | 1 + src/cocoa/NSMenu.mm | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/wx/cocoa/NSMenu.h b/include/wx/cocoa/NSMenu.h index 4d5df93f2a..146b9d66b7 100644 --- a/include/wx/cocoa/NSMenu.h +++ b/include/wx/cocoa/NSMenu.h @@ -34,6 +34,7 @@ public: , OBSERVE_DidSendAction = 0x08 , OBSERVE_WillSendAction = 0x10 }; + virtual void Cocoa_dealloc() {} virtual void CocoaNotification_menuDidAddItem(WX_NSNotification notification) {} virtual void CocoaNotification_menuDidChangeItem(WX_NSNotification notification) {} virtual void CocoaNotification_menuDidRemoveItem(WX_NSNotification notification) {} diff --git a/src/cocoa/NSMenu.mm b/src/cocoa/NSMenu.mm index 43108ad7d6..c71a2d2e9b 100644 --- a/src/cocoa/NSMenu.mm +++ b/src/cocoa/NSMenu.mm @@ -16,12 +16,11 @@ #endif // WX_PRECOMP #include "wx/cocoa/NSMenu.h" -//#include "wx/cocoa/ObjcPose.h" +#include "wx/cocoa/ObjcPose.h" #import #import -#if 0 // There is no reason to pose for NSMenu at this time. // ============================================================================ // @class wxPoserNSMenu // ============================================================================ @@ -29,13 +28,21 @@ { } +- (void)dealloc; + @end // wxPoserNSMenu WX_IMPLEMENT_POSER(wxPoserNSMenu); @implementation wxPoserNSMenu : NSMenu +- (void)dealloc +{ + wxCocoaNSMenu *menu = wxCocoaNSMenu::GetFromCocoa(self); + if(menu) + menu->Cocoa_dealloc(); +} + @end // wxPoserNSMenu -#endif // 0 // ============================================================================ // @class wxNSMenuNotificationObserver -- 2.45.2