home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-Developer.iso / NextLibrary / Frameworks / AppKit.framework / Versions / B / Headers / NSWindow.h < prev    next >
Text File  |  1996-11-25  |  13KB  |  387 lines

  1. /*
  2.     NSWindow.h
  3.     Application Kit
  4.     Copyright (c) 1994-1996, NeXT Software, Inc.
  5.     All rights reserved.
  6. */
  7.  
  8. #import <AppKit/NSResponder.h>
  9. #import <AppKit/NSScreen.h>
  10. #import <AppKit/NSGraphics.h>
  11. #import <AppKit/NSDragging.h>
  12. #import <AppKit/NSColor.h>
  13. #import <AppKit/AppKitDefines.h>
  14. #import <Foundation/NSHashTable.h>
  15. @class NSText;
  16. @class NSCursor;
  17. @class NSView;
  18. @class NSButtonCell;
  19.  
  20. enum {
  21.     NSBorderlessWindowMask        = 0,
  22.     NSTitledWindowMask            = 1 << 0,
  23.     NSClosableWindowMask        = 1 << 1,
  24.     NSMiniaturizableWindowMask        = 1 << 2,
  25.     NSResizableWindowMask        = 1 << 3
  26. };
  27.  
  28. #ifndef STRICT_OPENSTEP
  29. /* used with NSRunLoop's performSelector:target:argument:order:modes: */
  30. enum {
  31.     NSDisplayWindowRunLoopOrdering    = 600000,
  32.     NSResetCursorRectsRunLoopOrdering    = 700000
  33. };
  34. #endif
  35.  
  36. APPKIT_EXTERN NSSize NSIconSize;
  37. APPKIT_EXTERN NSSize NSTokenSize;
  38.  
  39. enum {
  40.     NSNormalWindowLevel            = 0,
  41.     NSFloatingWindowLevel        = 3,
  42.     NSDockWindowLevel            = 5,
  43.     NSSubmenuWindowLevel        = 10,
  44.     NSMainMenuWindowLevel        = 20
  45. };
  46.  
  47. typedef enum _NSSelectionDirection {
  48.     NSDirectSelection = 0,
  49.     NSSelectingNext,
  50.     NSSelectingPrevious
  51. } NSSelectionDirection;
  52.  
  53. @class NSEvent;
  54.  
  55. @interface NSWindow : NSResponder
  56. {
  57.     NSRect              _frame;
  58.     id                  _contentView;
  59.     id                  _delegate;
  60.     NSResponder        *_firstResponder;
  61.     NSView        *_lastLeftHit;
  62.     NSView        *_lastRightHit;
  63.     id                  _counterpart;
  64.     id                  _fieldEditor;
  65.     int                 _winEventMask;
  66.     int                 _windowNum;
  67.     int            _level;
  68.     NSColor        *_backgroundColor;
  69.     id                  _borderView;
  70.     unsigned char    _postingDisabled;
  71.     unsigned char    _styleMask;
  72.     unsigned char    _flushDisabled;
  73.     unsigned char    _reservedWindow1;
  74.     void        *_cursorRects;
  75.     NSHashTable        *_trectTable;
  76.     NSImage        *_miniIcon;
  77.     int            _lastResizeTime;
  78.     NSMutableSet    *_dragTypes;
  79.     NSString        *_representedFilename;
  80.     NSSize        *_sizeLimits;
  81.     NSString        *_frameSaveName;
  82.     NSSet        *_regDragTypes;
  83.     struct __wFlags {
  84.         unsigned int        backing:2;
  85.         unsigned int        visible:1;
  86.         unsigned int        isMainWindow:1;
  87.         unsigned int        isKeyWindow:1;
  88.         unsigned int        hidesOnDeactivate:1;
  89.         unsigned int        dontFreeWhenClosed:1;
  90.         unsigned int        oneShot:1;
  91.         unsigned int        deferred:1;
  92.         unsigned int        cursorRectsDisabled:1;
  93.         unsigned int        haveFreeCursorRects:1;
  94.         unsigned int        validCursorRects:1;
  95.         unsigned int        docEdited:1;
  96.         unsigned int        dynamicDepthLimit:1;
  97.         unsigned int        worksWhenModal:1;
  98.         unsigned int        limitedBecomeKey:1;
  99.         unsigned int        needsFlush:1;
  100.         unsigned int        viewsNeedDisplay:1;
  101.         unsigned int        ignoredFirstMouse:1;
  102.         unsigned int        repostedFirstMouse:1;
  103.         unsigned int        windowDying:1;
  104.         unsigned int        tempHidden:1;
  105.         unsigned int        floatingPanel:1;
  106.         unsigned int        wantsToBeOnMainScreen:1;
  107.         unsigned int        optimizedDrawingOk:1;
  108.         unsigned int        optimizeDrawing:1;
  109.         unsigned int        titleIsRepresentedFilename:1;
  110.         unsigned int        excludedFromWindowsMenu:1;
  111.         unsigned int        depthLimit:4;
  112.         unsigned int        delegateReturnsValidRequestor:1;
  113.         unsigned int        lmouseupPending:1;
  114.         unsigned int        rmouseupPending:1;
  115.         unsigned int        wantsToDestroyRealWindow:1;
  116.         unsigned int        wantsToRegDragTypes:1;
  117.         unsigned int        titleNeedsDisplay:1;
  118.         unsigned int        avoidsActivation:1;
  119.         unsigned int        frameSavedUsingTitle:1;
  120.         unsigned int        didRegDragTypes:1;
  121.         unsigned int        delayedOneShot:1;
  122.         unsigned int        postedNeedsDisplayNote:1;
  123.         unsigned int        postedInvalidCursorRectsNote:1;
  124.         unsigned int        initialFirstResponderTempSet:1;
  125.         unsigned int        autodisplay:1;
  126.         unsigned int        tossedFirstEvent:1;
  127.         unsigned int        isImageCache:1;
  128.         unsigned int        interfaceStyle:3;
  129.         unsigned int        keyViewSelectionDirection:2;
  130.         unsigned int        defaultButtonCellKETemporarilyDisabled:1;
  131.         unsigned int        defaultButtonCellKEDisabled:1;
  132.         unsigned int        menuHasBeenSet:1;
  133.         unsigned int        wantsToBeModal:1;
  134.         unsigned int        showingModalFrame:1;
  135.         unsigned int        isTerminating:1;
  136.         unsigned int        win32MouseActivationInProgress:1;
  137.         unsigned int        _reserved:4;
  138.     }                   _wFlags;
  139.     id            _defaultButtonCell;
  140.     NSView         *_initialFirstResponder;
  141.     unsigned int    _reservedWindow2;
  142. }
  143.  
  144. + (NSRect)frameRectForContentRect:(NSRect)cRect styleMask:(unsigned int)aStyle;
  145. + (NSRect)contentRectForFrameRect:(NSRect)fRect styleMask:(unsigned int)aStyle;
  146. + (float)minFrameWidthWithTitle:(NSString *)aTitle styleMask:(unsigned int)aStyle;
  147. + (NSWindowDepth)defaultDepthLimit;
  148.  
  149.  
  150. - (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag;
  151. - (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag screen:(NSScreen *)screen;
  152.  
  153. - (NSString *)title;
  154. - (void)setTitle:(NSString *)aString;
  155. - (NSString *)representedFilename;
  156. - (void)setRepresentedFilename:(NSString *)aString;
  157. - (void)setTitleWithRepresentedFilename:(NSString *)filename;
  158. - (void)setExcludedFromWindowsMenu:(BOOL)flag;
  159. - (BOOL)isExcludedFromWindowsMenu;
  160. - (void)setContentView:(NSView *)aView;
  161. - (id)contentView;
  162. - (void)setDelegate:(id)anObject;
  163. - (id)delegate;
  164. - (int)windowNumber;
  165. - (unsigned int)styleMask;
  166. - (NSText *)fieldEditor:(BOOL)createFlag forObject:(id)anObject;
  167. - (void)endEditingFor:(id)anObject;
  168.  
  169. - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen;
  170. - (void)setFrame:(NSRect)frameRect display:(BOOL)flag;
  171. - (void)setContentSize:(NSSize)aSize;
  172. - (void)setFrameOrigin:(NSPoint)aPoint;
  173. - (void)setFrameTopLeftPoint:(NSPoint)aPoint;
  174. - (NSPoint)cascadeTopLeftFromPoint:(NSPoint)topLeftPoint;
  175. - (NSRect)frame;
  176.  
  177. - (void)setResizeIncrements:(NSSize)increments;
  178. - (NSSize)resizeIncrements;
  179. - (void)setAspectRatio:(NSSize)ratio;
  180. - (NSSize)aspectRatio;
  181.  
  182. - (void)useOptimizedDrawing:(BOOL)flag;
  183. - (void)disableFlushWindow;
  184. - (void)enableFlushWindow;
  185. - (BOOL)isFlushWindowDisabled;
  186. - (void)flushWindow;
  187. - (void)flushWindowIfNeeded;
  188. - (void)setViewsNeedDisplay:(BOOL)flag;
  189. - (BOOL)viewsNeedDisplay;
  190. - (void)displayIfNeeded;
  191. - (void)display;
  192. - (void)setAutodisplay:(BOOL)flag;
  193. - (BOOL)isAutodisplay;
  194.  
  195. - (void)update;
  196. - (BOOL)makeFirstResponder:(NSResponder *)aResponder;
  197. - (NSResponder *)firstResponder;
  198. - (int)resizeFlags;
  199. - (void)keyDown:(NSEvent *)theEvent;
  200. - (void)close;
  201. - (void)setReleasedWhenClosed:(BOOL)flag;
  202. - (BOOL)isReleasedWhenClosed;
  203. - (void)miniaturize:(id)sender;
  204. - (void)deminiaturize:(id)sender;
  205. - (BOOL)isMiniaturized;
  206. - (BOOL)tryToPerform:(SEL)anAction with:(id)anObject;
  207. - (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType;
  208. - (void)setBackgroundColor:(NSColor *)color;
  209. - (NSColor *)backgroundColor;
  210.  
  211. - (void)setHidesOnDeactivate:(BOOL)flag;
  212. - (BOOL)hidesOnDeactivate;
  213. - (void)center;
  214. - (void)makeKeyAndOrderFront:(id)sender;
  215. - (void)orderFront:(id)sender;
  216. - (void)orderBack:(id)sender;
  217. - (void)orderOut:(id)sender;
  218. - (void)orderWindow:(NSWindowOrderingMode)place relativeTo:(int)otherWin;
  219. - (void)orderFrontRegardless;
  220.  
  221. - (void)setMiniwindowImage:(NSImage *)image;
  222. - (void)setMiniwindowTitle:(NSString *)title;
  223. - (NSImage *)miniwindowImage;
  224. - (NSString *)miniwindowTitle;
  225.  
  226. - (void)setDocumentEdited:(BOOL)flag;
  227. - (BOOL)isDocumentEdited;
  228. - (BOOL)isVisible;
  229. - (BOOL)isKeyWindow;
  230. - (BOOL)isMainWindow;
  231. - (BOOL)canBecomeKeyWindow;
  232. - (BOOL)canBecomeMainWindow;
  233. - (void)makeKeyWindow;
  234. - (void)makeMainWindow;
  235. - (void)becomeKeyWindow;
  236. - (void)resignKeyWindow;
  237. - (void)becomeMainWindow;
  238. - (void)resignMainWindow;
  239.  
  240. - (BOOL)worksWhenModal;
  241. - (NSPoint)convertBaseToScreen:(NSPoint)aPoint;
  242. - (NSPoint)convertScreenToBase:(NSPoint)aPoint;
  243. - (void)performClose:(id)sender;
  244. - (void)performMiniaturize:(id)sender;
  245. - (int)gState;
  246. - (void)setOneShot:(BOOL)flag;
  247. - (BOOL)isOneShot;
  248. - (NSData *)dataWithEPSInsideRect:(NSRect)rect;
  249. - (void)print:(id)sender;
  250.  
  251. #ifndef STRICT_OPENSTEP
  252. #ifndef WIN32
  253. - (void)fax:(id)sender;
  254. #endif /* WIN32 */
  255. #endif /* STRICT_OPENSTEP */
  256.  
  257. - (void)disableCursorRects;
  258. - (void)enableCursorRects;
  259. - (void)discardCursorRects;
  260. - (BOOL)areCursorRectsEnabled;
  261. - (void)invalidateCursorRectsForView:(NSView *)aView;
  262. - (void)resetCursorRects;
  263.  
  264. - (void)setBackingType:(NSBackingStoreType)bufferingType;
  265. - (NSBackingStoreType)backingType;
  266. - (void)setLevel:(int)newLevel;
  267. - (int)level;
  268. - (void)setDepthLimit:(NSWindowDepth)limit;
  269. - (NSWindowDepth)depthLimit;
  270. - (void)setDynamicDepthLimit:(BOOL)flag;
  271. - (BOOL)hasDynamicDepthLimit;
  272. - (NSScreen *)screen;
  273. - (NSScreen *)deepestScreen;
  274. - (BOOL)canStoreColor;
  275.  
  276. - (NSString *)stringWithSavedFrame;
  277. - (void)setFrameFromString:(NSString *)string;
  278. - (void)saveFrameUsingName:(NSString *)name;
  279. - (BOOL)setFrameUsingName:(NSString *)name;
  280. - (BOOL)setFrameAutosaveName:(NSString *)name;
  281. - (NSString *)frameAutosaveName;
  282. + (void)removeFrameUsingName:(NSString *)name;
  283.  
  284. - (void)cacheImageInRect:(NSRect)aRect;
  285. - (void)restoreCachedImage;
  286. - (void)discardCachedImage;
  287.  
  288. - (NSSize)minSize;
  289. - (NSSize)maxSize;
  290. - (void)setMinSize:(NSSize)size;
  291. - (void)setMaxSize:(NSSize)size;
  292. - (NSEvent *)nextEventMatchingMask:(unsigned int)mask;
  293. - (NSEvent *)nextEventMatchingMask:(unsigned int)mask untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue:(BOOL)deqFlag;
  294. - (void)discardEventsMatchingMask:(unsigned int)mask beforeEvent:(NSEvent *)lastEvent;
  295. - (void)postEvent:(NSEvent *)event atStart:(BOOL)flag;
  296. - (NSEvent *)currentEvent;
  297. - (void)setAcceptsMouseMovedEvents:(BOOL)flag;
  298. - (BOOL)acceptsMouseMovedEvents;
  299. - (NSDictionary *)deviceDescription;
  300. - (void)sendEvent:(NSEvent *)theEvent;
  301. - (NSPoint)mouseLocationOutsideOfEventStream;
  302.  
  303. #ifndef STRICT_OPENSTEP
  304. + (void)menuChanged:(NSMenu *)menu;
  305. #endif
  306.  
  307. @end
  308.  
  309. #ifndef STRICT_OPENSTEP
  310. @interface NSWindow(NSKeyboardUI)
  311. - (void)setInitialFirstResponder:(NSView *)view;
  312. - (NSView *)initialFirstResponder;
  313. - (void)selectNextKeyView:(id)sender;
  314. - (void)selectPreviousKeyView:(id)sender;
  315. - (void)selectKeyViewFollowingView:(NSView *)aView;
  316. - (void)selectKeyViewPrecedingView:(NSView *)aView;
  317. - (NSSelectionDirection)keyViewSelectionDirection;
  318. - (void)setDefaultButtonCell:(NSButtonCell *)defButt;
  319. - (NSButtonCell *)defaultButtonCell;
  320. - (void)disableKeyEquivalentForDefaultButtonCell;
  321. - (void)enableKeyEquivalentForDefaultButtonCell;
  322. @end
  323. #endif
  324.  
  325. @interface NSWindow(NSDrag)
  326. - (void)dragImage:(NSImage *)anImage at:(NSPoint)baseLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag;
  327.  
  328. - (void)registerForDraggedTypes:(NSArray *)newTypes;
  329. - (void)unregisterDraggedTypes;
  330. @end
  331.  
  332. #ifndef STRICT_OPENSTEP
  333. #ifdef WIN32
  334. @interface NSWindow (NSWindowsExtensions)
  335. - (void * /*HWND*/)windowHandle;
  336. @end
  337. #endif
  338. #endif
  339.  
  340. @interface NSObject(NSWindowNotifications)
  341. - (void)windowDidResize:(NSNotification *)notification;
  342. - (void)windowDidExpose:(NSNotification *)notification;
  343. #ifndef STRICT_OPENSTEP
  344. - (void)windowWillMove:(NSNotification *)notification;
  345. #endif
  346. - (void)windowDidMove:(NSNotification *)notification;
  347. - (void)windowDidBecomeKey:(NSNotification *)notification;
  348. - (void)windowDidResignKey:(NSNotification *)notification;
  349. - (void)windowDidBecomeMain:(NSNotification *)notification;
  350. - (void)windowDidResignMain:(NSNotification *)notification;
  351. - (void)windowWillClose:(NSNotification *)notification;
  352. #ifndef STRICT_OPENSTEP
  353. - (void)windowWillMiniaturize:(NSNotification *)notification;
  354. #endif
  355. - (void)windowDidMiniaturize:(NSNotification *)notification;
  356. - (void)windowDidDeminiaturize:(NSNotification *)notification;
  357. - (void)windowDidUpdate:(NSNotification *)notification;
  358. - (void)windowDidChangeScreen:(NSNotification *)notification;
  359. @end
  360.  
  361. @interface NSObject(NSWindowDelegate)
  362. - (BOOL)windowShouldClose:(id)sender;
  363. - (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client;
  364. #ifndef STRICT_OPENSTEP
  365. - (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize;
  366. #endif
  367. @end
  368.  
  369.  
  370. /* Notifications */
  371. APPKIT_EXTERN NSString *NSWindowDidBecomeKeyNotification;
  372. APPKIT_EXTERN NSString *NSWindowDidBecomeMainNotification;
  373. APPKIT_EXTERN NSString *NSWindowDidChangeScreenNotification;
  374. APPKIT_EXTERN NSString *NSWindowDidDeminiaturizeNotification;
  375. APPKIT_EXTERN NSString *NSWindowDidExposeNotification;            // userInfo key:  @"NSExposedRect"
  376. APPKIT_EXTERN NSString *NSWindowDidMiniaturizeNotification;
  377. APPKIT_EXTERN NSString *NSWindowDidMoveNotification;
  378. APPKIT_EXTERN NSString *NSWindowDidResignKeyNotification;
  379. APPKIT_EXTERN NSString *NSWindowDidResignMainNotification;
  380. APPKIT_EXTERN NSString *NSWindowDidResizeNotification;
  381. APPKIT_EXTERN NSString *NSWindowDidUpdateNotification;
  382. APPKIT_EXTERN NSString *NSWindowWillCloseNotification;
  383. #ifndef STRICT_OPENSTEP
  384. APPKIT_EXTERN NSString *NSWindowWillMiniaturizeNotification;
  385. APPKIT_EXTERN NSString *NSWindowWillMoveNotification;
  386. #endif
  387.