Name

NSApplication — Mac OS X 10.0

Synopsis

This is one of the three classes that define the overall architecture of the Application Kit, as well as the general behavior of Cocoa applications. The other two classes are NSView and NSResponder. Every AppKit-based application has an instance of NSApplication that is accessible through the global variable NSApp.

@interface NSApplication : NSResponder
                                  // Accessor Methods
   - (void)setMainMenu:(NSMenu *)aMenu;
   - (NSMenu *)mainMenu;
   - (void)setDelegate:(id)anObject;
   - (id)delegate;
   - (void)setWindowsNeedUpdate:(BOOL)needUpdate;
   - (void)setAppleMenu:(NSMenu *)menu;
   - (void)setApplicationIconImage:(NSImage *)image;
   - (NSImage *)applicationIconImage;
   - (void)setWindowsMenu:(NSMenu *)aMenu;
   - (NSMenu *)windowsMenu;
   - (void)setServicesMenu:(NSMenu *)aMenu;
   - (NSMenu *)servicesMenu;
   - (void)setServicesProvider:(id)provider;
   - (id)servicesProvider;
                                  // Class Methods
   + (void)detachDrawingThread:(SEL)selector 
                                 toTarget:(id)target 
                                 withObject:(id)argument;
   + (NSApplication *)sharedApplication;
                                  // Instance Methods
   - (NSModalSession)beginModalSessionForWindow:(NSWindow *)theWindow;
   - (void)activateContextHelpMode:(id)sender;
   - (void)abortModal;
   - (void)activateIgnoringOtherApps:(BOOL)flag;
   - (void)addWindowsItem:(NSWindow *)win 
                                 title:(NSString *)aString 
                                 filename:(BOOL)isFilename;
   - (void)arrangeInFront:(id)sender;
   - (NSModalSession)beginModalSessionForWindow:(NSWindow *)theWindow
                                 relativeToWindow:(NSWindow *)docWindow;
   - (void)beginSheet:(NSWindow *)sheet 
                                 modalForWindow:(NSWindow *)docWindow 
                                 modalDelegate:(id)modalDelegate
                                 didEndSelector:(SEL)didEndSelector  
                                 contextInfo:(void *)contextInfo;
   - (void)cancelUserAttentionRequest:(int)request;
   - (void)changeColor:(id)sender;
   - (void)changeWindowsItem:(NSWindow *)win 
                                 title:(NSString *)aString 
                                 filename:(BOOL)isFilename;
   - (NSGraphicsContext*)context;
   - (NSEvent *)currentEvent;
   - (void)deactivate;
   - (void)discardEventsMatchingMask:(unsigned int)mask  
                                 beforeEvent:(NSEvent *)lastEvent;
   - (void)endModalSession:(NSModalSession)session;
   - (void)endSheet:(NSWindow *)sheet;
   - (void)endSheet:(NSWindow *)sheet  
                                 returnCode:(int)returnCode;
   - (void)finishLaunching;
   - (void)hide:(id)sender;
   - (void)hideOtherApplications:(id)sender;
   - (BOOL)isActive;
   - (BOOL)isHidden;
   - (BOOL)isRunning;
   - (NSWindow *)keyWindow;
   - (NSWindow *)mainWindow;
   - (NSWindow *)makeWindowsPerform:(SEL)aSelector 
                                 inOrder:(BOOL)flag;
   - (void)miniaturizeAll:(id)sender;
   - (NSWindow *)modalWindow;
   - (NSEvent *)nextEventMatchingMask:(unsigned int)mask 
                                 untilDate:(NSDate *)expiration 
                                 inMode:(NSString *)mode
                                 dequeue:(BOOL)deqFlag;
   - (void)orderFrontColorPanel:(id)sender;
   - (void)orderFrontStandardAboutPanel:(id)sender;
   - (void)orderFrontStandardAboutPanelWithOptions:(NSDictionary *)optionsDictionary;
   - (void)postEvent:(NSEvent *)event 
                                 atStart:(BOOL)flag;
   - (void)preventWindowOrdering;
   - (void)registerServicesMenuSendTypes:(NSArray *)sendTypes 
                                 returnTypes:(NSArray *)returnTypes;
   - (void)removeWindowsItem:(NSWindow *)win;
   - (void)replyToApplicationShouldTerminate:(BOOL)shouldTerminate;
   - (void)reportException:(NSException *)theException;
   - (int)requestUserAttention:(NSRequestUserAttentionType)requestType;
   - (void)run;
   - (int)runModalForWindow:(NSWindow *)theWindow;
   - (int)runModalForWindow:(NSWindow *)theWindow 
                                 relativeToWindow:(NSWindow *)docWindow;
   - (int)runModalSession:(NSModalSession)session;
   - (void)runPageLayout:(id)sender;
   - (BOOL)sendAction:(SEL)theAction 
                                 to:(id)theTarget 
                                 from:(id)sender;
   - (void)sendEvent:(NSEvent *)theEvent;
   - (void)showHelp:(id)sender;
   - (void)stop:(id)sender;
   - (void)stopModal;
   - (void)stopModalWithCode:(int)returnCode;
   - (id)targetForAction:(SEL)theAction;
   - (id)targetForAction:(SEL)theAction 
                                 to:(id)theTarget 
                                 from:(id)sender;
   - (void)terminate:(id)sender;
   - (BOOL)tryToPerform:(SEL)anAction 
                                 with:(id)anObject;
   - (void)unhide:(id)sender;
   - (void)unhideAllApplications:(id)sender;
   - (void)unhideWithoutActivation;
   - (void)updateWindows;
   - (void)updateWindowsItem:(NSWindow *)win;
   - (id)validRequestorForSendType:(NSString *)sendType
                                 returnType:(NSString *)returnType;
   - (NSWindow *)windowWithWindowNumber:(int)windowNum;
   - (NSArray *)windows;
                                 // Methods Implemented by the Delegate
   - (BOOL)application:(NSApplication *)sender 
                                 delegateHandlesKey:(NSString *)key;
   - (BOOL)application:(NSApplication *)sender 
                                 openFile:(NSString *)filename;
   - (BOOL)application:(NSApplication *)sender 
                                 openTempFile:(NSString *)filename;
   - (BOOL)application:(NSApplication *)sender 
                                 printFile:(NSString *)filename;
   - (BOOL)application:(id)sender 
                                 openFileWithoutUI:(NSString *)filename;
   - (void)applicationDidBecomeActive:(NSNotification *)notification;
   - (void)applicationDidChangeScreenParameters:(NSNotification *)notification;
   - (void)applicationDidFinishLaunching:(NSNotification *)notification;
   - (void)applicationDidHide:(NSNotification *)notification;
   - (void)applicationDidResignActive:(NSNotification *)notification;
   - (void)applicationDidUnhide:(NSNotification *)notification;
   - (void)applicationDidUpdate:(NSNotification *)notification;
   - (NSMenu *)applicationDockMenu:(NSApplication *)sender;
   - (BOOL)applicationOpenUntitledFile:(NSApplication *)sender;
   - (BOOL)applicationShouldHandleReopen:(NSApplication *)sender 
                                 hasVisibleWindows:(BOOL)flag;
   - (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender;
   - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
   - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender;
   - (void)applicationWillBecomeActive:(NSNotification *)notification;
   - (void)applicationWillFinishLaunching:(NSNotification *)notification;
   - (void)applicationWillHide:(NSNotification *)notification;
   - (void)applicationWillResignActive:(NSNotification *)notification;
   - (void)applicationWillTerminate:(NSNotification *)notification;
   - (void)applicationWillUnhide:(NSNotification *)notification;
   - (void)applicationWillUpdate:(NSNotification *)notification;
                                 // Notifications
                                 NSApplicationDidBecomeActiveNotification;
                                 NSApplicationDidChangeScreenParametersNotification;
                                 NSApplicationDidFinishLaunchingNotification;
                                 NSApplicationDidHideNotification;
                                 NSApplicationDidResignActiveNotification;
                                 NSApplicationDidUnhideNotification;
                                 NSApplicationDidUpdateNotification;
                                 NSApplicationWillBecomeActiveNotification;
                                 NSApplicationWillFinishLaunchingNotification;
                                 NSApplicationWillHideNotification;
                                 NSApplicationWillResignActiveNotification;
                                 NSApplicationWillTerminateNotification;
                                 NSApplicationWillUnhideNotification;
                                 NSApplicationWillUpdateNotification;