// Created: 2003/09/04
// RCS-ID: $Id$
// Copyright: (c) 2003 David Elliott
-// Licence: wxWindows licence
+// Licence: wxWidgets licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
#include "wx/cocoa/mbarman.h"
#include "wx/cocoa/autorelease.h"
+#include "wx/cocoa/objc/objc_uniquifying.h"
#import <Foundation/NSString.h>
#import <Foundation/NSNotification.h>
#import <AppKit/NSApplication.h>
#import <AppKit/NSWindow.h>
+#define wxUSE_FSCRIPT 0
+#if wxUSE_FSCRIPT
+ #import <FScript/FScriptMenuItem.h>
+#endif
+
+// Declare setAppleMenu: in an NSApplication category since Tiger and later
+// releases support it but don't declare it as it's considered deprecated.
+@interface NSApplication(wxDeprecatedMethodsWeWantToUse)
+- (void)setAppleMenu:(NSMenu *)menu;
+@end
+
// ============================================================================
// wxMenuBarManagerObserver
// ============================================================================
- (void)windowWillClose: (NSNotification *)notification;
#endif // 0
@end // interface wxMenuBarManagerObserver : NSObject
+WX_DECLARE_GET_OBJC_CLASS(wxMenuBarManagerObserver,NSObject)
@implementation wxMenuBarManagerObserver : NSObject
- (id)init
#endif // 0
@end // implementation wxMenuBarManagerObserver : NSObject
+WX_IMPLEMENT_GET_OBJC_CLASS(wxMenuBarManagerObserver,NSObject)
// ============================================================================
// wxMenuBarManager
// ============================================================================
wxMenuBarManager *wxMenuBarManager::sm_mbarmanInstance = NULL;
+static void AddFScriptItem(NSMenu *menu)
+#if wxUSE_FSCRIPT
+{
+ NSMenuItem *item = [[FScriptMenuItem alloc] init];
+ [menu addItem: item];
+ [item release];
+}
+#else
+{}
+#endif
+
wxMenuBarManager::wxMenuBarManager()
{
- m_observer = [[wxMenuBarManagerObserver alloc]
+ m_observer = [[WX_GET_OBJC_CLASS(wxMenuBarManagerObserver) alloc]
initWithWxMenuBarManager:this];
[[NSNotificationCenter defaultCenter] addObserver:m_observer
selector:@selector(windowDidBecomeKey:)
/**/[m_menuApp addItemWithTitle:@"Preferences..." action:nil keyEquivalent:@""];
/**/[m_menuApp addItem: [NSMenuItem separatorItem]];
+/**/AddFScriptItem(m_menuApp);
/**/menuitem = [[NSMenuItem alloc] initWithTitle: @"Services" action:nil keyEquivalent:@""];
[menuitem setSubmenu:m_menuServices];
[m_menuApp addItem: menuitem];