Fix compile warning on mac.

This commit is contained in:
John Maguire 2011-02-04 15:25:05 +00:00
parent 8a5455dc7e
commit 4fb6f92ad4
3 changed files with 25 additions and 17 deletions

22
src/core/mac_delegate.h Normal file
View File

@ -0,0 +1,22 @@
#import <AppKit/NSApplication.h>
#include "config.h"
class PlatformInterface;
#ifdef SNOW_LEOPARD
@interface AppDelegate :NSObject <NSApplicationDelegate> {
#else
@interface AppDelegate :NSObject {
#endif
PlatformInterface* application_handler_;
NSMenu* dock_menu_;
}
- (id) initWithHandler: (PlatformInterface*)handler;
// NSApplicationDelegate
- (BOOL) applicationShouldHandleReopen: (NSApplication*)app hasVisibleWindows:(BOOL)flag;
- (NSMenu*) applicationDockMenu: (NSApplication*)sender;
- (void) setDockMenu: (NSMenu*)menu;
@end

View File

@ -34,6 +34,7 @@
#include "config.h"
#include "globalshortcuts.h"
#include "mac_delegate.h"
#include "mac_startup.h"
#include "macglobalshortcutbackend.h"
#include "utilities.h"
@ -66,22 +67,6 @@
- (void) mediaKeyEvent: (int)key state: (BOOL)state repeat: (BOOL)repeat;
@end
#ifdef SNOW_LEOPARD
@interface AppDelegate :NSObject <NSApplicationDelegate> {
#else
@interface AppDelegate :NSObject {
#endif
PlatformInterface* application_handler_;
NSMenu* dock_menu_;
}
- (id) initWithHandler: (PlatformInterface*)handler;
// NSApplicationDelegate
- (BOOL) applicationShouldHandleReopen: (NSApplication*)app hasVisibleWindows:(BOOL)flag;
- (NSMenu*) applicationDockMenu: (NSApplication*)sender;
- (void) setDockMenu: (NSMenu*)menu;
@end
@implementation AppDelegate
- (id) init {

View File

@ -17,6 +17,7 @@
#include "macsystemtrayicon.h"
#include "core/mac_delegate.h"
#include "core/song.h"
#include <QAction>
@ -83,7 +84,7 @@ class MacSystemTrayIconPrivate : boost::noncopyable {
// Don't look now.
// This must be called after our custom NSApplicationDelegate has been set.
[[NSApp delegate] setDockMenu:dock_menu_];
[(AppDelegate*)([NSApp delegate]) setDockMenu:dock_menu_];
ClearNowPlaying();
}