Subversion Repositories eduke32

Rev

Rev 4644 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4644 Rev 4646
Line 3... Line 3...
3
       Non-NIB-Code & other changes: Max Horn <max@quendi.de>
3
       Non-NIB-Code & other changes: Max Horn <max@quendi.de>
4
4
5
    Feel free to customize this file to suit your needs
5
    Feel free to customize this file to suit your needs
6
*/
6
*/
7
7
-
 
8
#import <Foundation/Foundation.h>
-
 
9
#import <AppKit/AppKit.h>
-
 
10
8
#include "sdl_inc.h"
11
#include "sdl_inc.h"
-
 
12
#include "SDLMain.h"
9
13
10
#include <sys/param.h> /* for MAXPATHLEN */
14
#include <sys/param.h> /* for MAXPATHLEN */
11
#include <unistd.h>
15
#include <unistd.h>
12
16
13
/* For some reason, Apple removed setAppleMenu from the headers in 10.4,
17
/* For some reason, Apple removed setAppleMenu from the headers in 10.4,
Line 69... Line 73...
69
@interface NSApplication (SDLApplication)
73
@interface NSApplication (SDLApplication)
70
@end
74
@end
71
75
72
@implementation NSApplication (SDLApplication)
76
@implementation NSApplication (SDLApplication)
73
/* Invoked from the Quit menu item */
77
/* Invoked from the Quit menu item */
74
- (void)terminate:(id)sender
78
- (void)terminateCall:(id)sender
75
{
79
{
76
    /* Post a SDL_QUIT event */
80
    /* Post a SDL_QUIT event */
77
    SDL_Event event;
81
    SDL_Event event;
78
    event.type = SDL_QUIT;
82
    event.type = SDL_QUIT;
79
    SDL_PushEvent(&event);
83
    SDL_PushEvent(&event);
80
}
84
}
81
@end
85
@end
82
86
-
 
87
@interface SDLMain (NSObject)
-
 
88
@end
-
 
89
83
/* The main class of the application, the application's delegate */
90
/* The main class of the application, the application's delegate */
84
@implementation SDLMain
91
@implementation SDLMain (NSObject)
85
92
86
/* Set the working directory to the .app's parent directory */
93
/* Set the working directory to the .app's parent directory */
87
- (void) setupWorkingDirectory:(BOOL)shouldChdir
94
- (void) setupWorkingDirectory:(BOOL)shouldChdir
88
{
95
{
89
    if (shouldChdir)
96
    if (shouldChdir)
Line 151... Line 158...
151
    [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
158
    [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
152
159
153
    [appleMenu addItem:[NSMenuItem separatorItem]];
160
    [appleMenu addItem:[NSMenuItem separatorItem]];
154
161
155
    title = [@"Quit " stringByAppendingString:appName];
162
    title = [@"Quit " stringByAppendingString:appName];
156
    [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
163
    [appleMenu addItemWithTitle:title action:@selector(terminateCall:) keyEquivalent:@"q"];
157
164
158
165
159
    /* Put menu into the menubar */
166
    /* Put menu into the menubar */
160
    menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
167
    menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
161
    [menuItem setSubmenu:appleMenu];
168
    [menuItem setSubmenu:appleMenu];
Line 378... Line 385...
378
#else
385
#else
379
    CustomApplicationMain (argc, argv);
386
    CustomApplicationMain (argc, argv);
380
#endif
387
#endif
381
    return 0;
388
    return 0;
382
}
389
}
383
-