#endif // WX_PRECOMP
#include "wx/cocoa/NSMenu.h"
-//#include "wx/cocoa/ObjcPose.h"
#import <Foundation/NSNotification.h>
-#import <AppKit/NSMenu.h>
+#include "wx/cocoa/objc/NSMenu.h"
-#if 0 // There is no reason to pose for NSMenu at this time.
// ============================================================================
-// @class wxPoserNSMenu
+// @class WXNSMenu
// ============================================================================
-@interface wxPoserNSMenu : NSMenu
-{
-}
-@end // wxPoserNSMenu
+@implementation WXNSMenu : NSMenu
-WX_IMPLEMENT_POSER(wxPoserNSMenu);
-@implementation wxPoserNSMenu : NSMenu
+- (void)dealloc
+{
+ wxCocoaNSMenu *menu = wxCocoaNSMenu::GetFromCocoa(self);
+ if(menu)
+ menu->Cocoa_dealloc();
+ [super dealloc];
+}
-@end // wxPoserNSMenu
-#endif // 0
+@end // WXNSMenu
+WX_IMPLEMENT_GET_OBJC_CLASS(WXNSMenu,NSMenu)
// ============================================================================
// @class wxNSMenuNotificationObserver
{
}
-struct objc_object *wxCocoaNSMenu::sm_cocoaObserver = [[wxNSMenuNotificationObserver alloc] init];
-
- (void)menuDidAddItem: (NSNotification *)notification;
- (void)menuDidChangeItem: (NSNotification *)notification;
- (void)menuDidRemoveItem: (NSNotification *)notification;
- (void)menuDidSendAction: (NSNotification *)notification;
- (void)menuWillSendAction: (NSNotification *)notification;
@end // interface wxNSMenuNotificationObserver
+WX_DECLARE_GET_OBJC_CLASS(wxNSMenuNotificationObserver,NSObject)
@implementation wxNSMenuNotificationObserver : NSObject
}
@end // implementation wxNSMenuNotificationObserver
+WX_IMPLEMENT_GET_OBJC_CLASS(wxNSMenuNotificationObserver,NSObject)
// ========================================================================
// wxCocoaNSMenu
// ========================================================================
WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSMenu)
+struct objc_object *wxCocoaNSMenu::sm_cocoaObserver = [[WX_GET_OBJC_CLASS(wxNSMenuNotificationObserver) alloc] init];
+
void wxCocoaNSMenu::AssociateNSMenu(WX_NSMenu cocoaNSMenu, unsigned int flags)
{
if(cocoaNSMenu)