Changeset - r13199:f3616256bed2
[Not reviewed]
master
0 1 0
michi_cc - 15 years ago 2009-10-04 21:39:08
michi_cc@openttd.org
(svn r17716) -Codechange: [OSX] Invoke a (semi-)private Objective-C method in a way that does not rely on the SDK version.
1 file changed with 4 insertions and 9 deletions:
0 comments (0 inline, 0 general)
src/video/cocoa/cocoa_v.mm
Show inline comments
 
@@ -41,19 +41,12 @@
 
 * There are certain limitations because the file is objective C++.
 
 * gdb has limitations.
 
 * C++ and objective C code can't be joined in all cases (classes stuff).
 
 * Read http://developer.apple.com/releasenotes/Cocoa/Objective-C++.html for more information.
 
 */
 

	
 
/* Disables a warning. This is needed since the method exists but has been dropped from the header, supposedly as of 10.4. */
 
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
 
@interface NSApplication(NSAppleMenu)
 
- (void)setAppleMenu:(NSMenu *)menu;
 
@end
 
#endif
 

	
 

	
 
@interface OTTDMain : NSObject
 
@end
 

	
 

	
 
static NSAutoreleasePool *_ottd_autorelease_pool;
 
@@ -113,14 +106,16 @@ static void setApplicationMenu()
 

	
 
	/* Put menu into the menubar */
 
	menuItem = [ [ NSMenuItem alloc ] initWithTitle:@"" action:nil keyEquivalent:@"" ];
 
	[ menuItem setSubmenu:appleMenu ];
 
	[ [ NSApp mainMenu ] addItem:menuItem ];
 

	
 
	/* Tell the application object that this is now the application menu */
 
	[ NSApp setAppleMenu:appleMenu ];
 
	/* Tell the application object that this is now the application menu.
 
	 * This interesting Objective-C construct is used because not all SDK
 
	 * versions define this method publicly. */
 
	[ NSApp performSelector:@selector(setAppleMenu:) withObject:appleMenu ];
 

	
 
	/* Finally give up our references to the objects */
 
	[ appleMenu release ];
 
	[ menuItem release ];
 
}
 

	
0 comments (0 inline, 0 general)