home *** CD-ROM | disk | FTP | other *** search
/ Openstep 4.2 (Developer) / Openstep Developer 4.2.iso / NextDeveloper / OpenStepConversion / IntermediateFrameworks5 / AppKit.framework / Headers / NSApplication.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-28  |  7.1 KB  |  219 lines

  1. /*
  2.     Application.h
  3.     Application Kit, Release 2.0
  4.     Copyright (c) 1988, 1989, 1990, NeXT, Inc.  All rights reserved. 
  5. */
  6.  
  7. #import "NSResponder.h"
  8. @class NSDataLinkManager;
  9. @class NSApplication;
  10. @class Speaker;
  11. @class NSWindow;
  12. @class NSPasteboard;
  13. @class NSEvent;
  14. @class Listener;
  15. @class NSMenu;
  16. @class NSWorkspace;
  17. @class NSDPSContext;
  18. @class NSImage;
  19.  
  20. /* Modes passed to NSRunLoop */
  21. extern NSString *NSModalPanelRunLoopMode;
  22. extern NSString *NSEventTrackingRunLoopMode;
  23.  
  24. /* Pre-defined return values for runModalFor: and runModalSession:. The system also reserves all values below these. */
  25. enum {
  26.     NSRunStoppedResponse            = (-1000),
  27.     NSRunAbortedResponse            = (-1001),
  28.     NSRunContinuesResponse            = (-1002)
  29. };
  30.  
  31. extern id NSApp;
  32.  
  33. /* Information used by the system during modal sessions */
  34. typedef struct _NSModalSession *NSModalSession;
  35.  
  36. @interface NSApplication : NSResponder
  37. {
  38.     NSString            *appName;
  39.     NSEvent *currentEvent;
  40.     id                  windowList;
  41.     id                  keyWindow;
  42.     id                  mainWindow;
  43.     id                  delegate;
  44.     int                *hiddenList;
  45.     int                 hiddenCount;
  46.     NSString           *hostName;
  47.     id            context;
  48.     int                 contextNum;
  49.     id                  appListener;
  50.     id                  appSpeaker;
  51.     port_t              replyPort;
  52.     NSSize              screenSize;
  53.     short               running;
  54.     struct __appFlags {
  55.     unsigned int        hidden:1;
  56.     unsigned int        autoupdate:1;
  57.     unsigned int        active:1;
  58.     unsigned int        _hasBeenRun:1;
  59.     unsigned int        _RESERVED:7;
  60.     unsigned int        _doingUnhide:1;
  61.     unsigned int        _delegateReturnsValidRequestor:1;
  62.     unsigned int        _deactPending:1;
  63.     unsigned int        _invalidState:1;
  64.     unsigned int        _invalidEvent:1;
  65.     }                   appFlags;
  66.     id                  _reservedApp4;
  67.     id                  _focusStack;
  68.     id                  _freelist;
  69.     id                  _pboard;
  70.     id                  _mainMenu;
  71.     id                  _appIcon;
  72.     id                  _nameTable;
  73.     id                  _printInfo;
  74.     unsigned int        _reservedApp1;
  75.     unsigned int        _reservedApp2;
  76.     unsigned int        _reservedApp3;
  77. }
  78.  
  79. + (NSWorkspace *)workspace;
  80.  
  81. + sharedApplication;
  82.  
  83. - setDelegate:anObject;
  84. - delegate;
  85. - (NSDPSContext *)context;
  86. - hide:sender;
  87. - unhide:sender;
  88. - unhideWithoutActivation;
  89. - windowWithWindowNumber:(int)windowNum;
  90. - mainWindow;
  91. - keyWindow;
  92. - (BOOL)isActive;
  93. - (BOOL)isHidden;
  94. - (BOOL)isRunning;
  95. - deactivateSelf;
  96. - (int)activateIgnoringOtherApps:(BOOL)flag;
  97. - (void)run;
  98. - (int)runModalFor:theWindow;
  99. - stop:sender;
  100. - stopModal;
  101. - stopModalWithCode:(int)returnCode;
  102. - (void)abortModal;
  103. - (NSModalSession)beginModalSessionForWindow:theWindow;
  104. - (int)runModalSession:(NSModalSession)session;
  105. - endModalSession:(NSModalSession)session;
  106. - terminate:sender;
  107.  
  108. - (NSEvent *)nextEventMatchingMask:(unsigned int)mask untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue:(BOOL)deqFlag;
  109. - (void)discardEventsMatchingMask:(unsigned int)mask beforeEvent:(NSEvent *)lastEvent;
  110. - (void)postEvent:(NSEvent *)event atStart:(BOOL)flag;
  111. - (NSEvent *)currentEvent;
  112.  
  113. - sendEvent:(NSEvent *)theEvent;
  114. - preventWindowOrdering;
  115. - makeWindowsPerform:(SEL)aSelector inOrder:(BOOL)flag;
  116. - (NSArray *)windows;
  117. - updateWindows;
  118. - (BOOL)sendAction:(SEL)theAction to:theTarget from:sender;
  119. - calcTargetForAction:(SEL)theAction;
  120. - (BOOL)tryToPerform:(SEL)anAction with:anObject;
  121. - setMainMenu:aMenu;
  122. - mainMenu;
  123. - (void)setApplicationIconImage:(NSImage *)image;
  124. - (NSImage *)applicationIconImage;
  125.  
  126. - validRequestorForSendType:(NSString *)sendType andReturnType:(NSString *)returnType;
  127.  
  128. - (void)reportException:(NSException *)theException;
  129.  
  130. @end
  131.  
  132. @interface NSApplication(WindowsMenu)
  133. - windowsMenu;
  134. - setWindowsMenu:(id)menu;
  135. - arrangeInFront:sender;
  136. - removeWindowsItem:(id)win;
  137. - addWindowsItem:(id)win title:(NSString *)aString filename:(BOOL)isFilename;
  138. - changeWindowsItem:(id)win title:(NSString *)aString filename:(BOOL)isFilename;
  139. - updateWindowsItem:(id)win;
  140. - miniaturizeAll:sender;
  141. @end
  142.  
  143.  
  144. @interface NSObject(NSApplicationNotification)
  145. - applicationWillInitialize:(NSNotification *)notification;
  146. - applicationDidInitialize:(NSNotification *)notification;
  147. - applicationWillHide:(NSNotification *)notification;
  148. - applicationDidHide:(NSNotification *)notification;
  149. - applicationDidUnhide:(NSNotification *)notification;
  150. - applicationWillBecomeActive:(NSNotification *)notification;
  151. - applicationDidBecomeActive:(NSNotification *)notification;
  152. - applicationWillResignActive:(NSNotification *)notification;
  153. - applicationDidResignActive:(NSNotification *)notification;
  154. - applicationWillUpdate:(NSNotification *)notification;
  155. - applicationDidUpdate:(NSNotification *)notification;
  156. @end
  157.  
  158. @interface NSObject(ApplicationDelegate)
  159. - applicationShouldTerminate:sender;
  160. - (int)application:sender openFile:(NSString *)filename;
  161. - (int)application:sender openTempFile:(NSString *)filename;
  162. - (BOOL)application:sender openFileWithoutUI:(NSString *)filename;
  163. @end
  164.  
  165. @interface NSApplication(ServicesMenu)
  166. - servicesMenu;
  167. - setServicesMenu:aMenu;
  168. - registerServicesMenuSendTypes:(NSArray *)sendTypes andReturnTypes:(NSArray *)returnTypes;
  169. @end
  170.  
  171. @interface NSApplication(NXAlphaImport) 
  172. - setIgnoresAlpha:(BOOL)flag;
  173. - (BOOL)doesImportAlpha;
  174. @end
  175.  
  176. @interface NSObject(NXServicesRequests)
  177. - (BOOL)writeSelectionToPasteboard:pboard types:(NSArray *)types;
  178. - readSelectionFromPasteboard:pboard;
  179. @end
  180.  
  181. @interface NSApplication(NSServicesHandling)
  182. - (void)setServicesProvider:(id)provider;
  183. - (id)servicesProvider;
  184. @end
  185.  
  186. /*
  187.  * Functions to enable/disable Services Menu items.  These should usually
  188.  * only be called by service PROVIDERS (since they are the only ones who
  189.  * know the name of the services, requestors don't).  The itemName in the
  190.  * two functions below is the language-independent "Menu Item:" entry in
  191.  * the __services section (which all provided services must have).  The
  192.  * set function returns whether it was successful.
  193.  * NXUpdateDynamicServices() causes the services information for the
  194.  * system to be updated.  This will only be necessary if your program
  195.  * adds dynamic services to the system (i.e. services not found in macho
  196.  * segments of executables).
  197.  */
  198.  
  199. extern BOOL NSShowsServicesMenuItem(NSString * itemName);
  200. extern int NSSetShowsServicesMenuItem(NSString * itemName, BOOL enabled);
  201. extern void NSUpdateDynamicServices(void);
  202. extern BOOL NSPerformService(NSString *itemName, NSPasteboard *pboard);
  203.  
  204. /* Notifications */
  205. extern NSString *NSApplicationDidBecomeActiveNotification;
  206. extern NSString *NSApplicationDidHideNotification;
  207. extern NSString *NSApplicationDidFinishLaunchingNotification;
  208. extern NSString *NSApplicationDidResignActiveNotification;
  209. extern NSString *NSApplicationDidUnhideNotification;
  210. extern NSString *NSApplicationDidUpdateNotification;
  211. extern NSString *NSApplicationWillBecomeActiveNotification;
  212. extern NSString *NSApplicationWillHideNotification;
  213. extern NSString *NSApplicationWillFinishLaunchingNotification;
  214. extern NSString *NSApplicationWillResignActiveNotification;
  215. extern NSString *NSApplicationWillUnhideNotification;
  216. extern NSString *NSApplicationWillUpdateNotification;
  217. extern NSString *NSApplicationWillTerminateNotification;
  218.  
  219.