MACOSX: Fix application menu i18n compilation for Mac OSX 10.4+

This commit is contained in:
CeRiAl 2011-07-12 00:47:02 +02:00
parent b00586df82
commit 5a42f2901f

View File

@ -22,11 +22,21 @@
#if defined(MACOSX)
// Disable symbol overrides so that we can use system headers.
#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "backends/platform/sdl/macosx/appMenu_osx.h"
#include "common/translation.h"
#include <Cocoa/Cocoa.h>
// Apple removed setAppleMenu from the header files in 10.4,
// but as the method still exists we declare it ourselves here.
// Yes, this works :)
@interface NSApplication(MissingFunction)
- (void)setAppleMenu:(NSMenu *)menu;
@end
void replaceApplicationMenuItems() {
// Code mainly copied and adapted from SDLmain.m
@ -43,7 +53,7 @@ void replaceApplicationMenuItems() {
appleMenu = [[NSMenu alloc] initWithTitle:@""];
// Get current encoding
NSStringEncoding *stringEncoding = CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding((CFStringRef)[NSString stringWithCString:(TransMan.getCurrentCharset()).c_str() encoding:NSASCIIStringEncoding]));
NSStringEncoding stringEncoding = CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding((CFStringRef)[NSString stringWithCString:(TransMan.getCurrentCharset()).c_str() encoding:NSASCIIStringEncoding]));
// Add "About ScummVM" menu item
[appleMenu addItemWithTitle:[NSString stringWithCString:_("About ScummVM") encoding:stringEncoding] action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];