62 @interface NSString (ReplaceSubString) |
62 @interface NSString (ReplaceSubString) |
63 - (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString; |
63 - (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString; |
64 @end |
64 @end |
65 #endif |
65 #endif |
66 |
66 |
67 @interface NSApplication (SDLApplication) |
67 @interface SDLApplication : NSApplication |
68 @end |
68 @end |
69 |
69 |
70 @implementation NSApplication (SDLApplication) |
70 @implementation SDLApplication |
71 /* Invoked from the Quit menu item */ |
71 /* Invoked from the Quit menu item */ |
72 - (void)terminate:(id)sender |
72 - (void)terminate:(id)sender |
73 { |
73 { |
74 /* Post a SDL_QUIT event */ |
74 /* Post a SDL_QUIT event */ |
75 SDL_Event event; |
75 SDL_Event event; |
117 if (aRange.length != 0) |
117 if (aRange.length != 0) |
118 [menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]]; |
118 [menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]]; |
119 if ([menuItem hasSubmenu]) |
119 if ([menuItem hasSubmenu]) |
120 [self fixMenu:[menuItem submenu] withAppName:appName]; |
120 [self fixMenu:[menuItem submenu] withAppName:appName]; |
121 } |
121 } |
|
122 [ aMenu sizeToFit ]; |
122 } |
123 } |
123 |
124 |
124 #else |
125 #else |
125 |
126 |
126 static void setApplicationMenu(void) |
127 static void setApplicationMenu(void) |
199 { |
200 { |
200 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
201 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
201 SDLMain *sdlMain; |
202 SDLMain *sdlMain; |
202 |
203 |
203 /* Ensure the application object is initialised */ |
204 /* Ensure the application object is initialised */ |
204 [NSApplication sharedApplication]; |
205 [SDLApplication sharedApplication]; |
205 |
206 |
206 #ifdef SDL_USE_CPS |
207 #ifdef SDL_USE_CPS |
207 { |
208 { |
208 CPSProcessSerNum PSN; |
209 CPSProcessSerNum PSN; |
209 /* Tell the dock about us */ |
210 /* Tell the dock about us */ |
210 if (!CPSGetCurrentProcess(&PSN)) |
211 if (!CPSGetCurrentProcess(&PSN)) |
211 if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) |
212 if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) |
212 if (!CPSSetFrontProcess(&PSN)) |
213 if (!CPSSetFrontProcess(&PSN)) |
213 [NSApplication sharedApplication]; |
214 [SDLApplication sharedApplication]; |
214 } |
215 } |
215 #endif /* SDL_USE_CPS */ |
216 #endif /* SDL_USE_CPS */ |
216 |
217 |
217 /* Set up the menubar */ |
218 /* Set up the menubar */ |
218 [NSApp setMainMenu:[[NSMenu alloc] init]]; |
219 [NSApp setMainMenu:[[NSMenu alloc] init]]; |