home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / OpenStepConversion / IntermediateFrameworks4 / AppKit.framework / Headers / NSWindow.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-12  |  9.4 KB  |  311 lines

  1. /*
  2.     Window.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. #import "NSScreen.h"
  9. #import "drag.h"
  10. #import "NSColor.h"
  11. #import "NSGraphics.h"
  12. @class NSText;
  13. @class NSCursor;
  14. @class NSView;
  15.  
  16. enum {
  17.     NSBorderlessWindowMask        = 0,
  18.     NSTitledWindowMask            = 1 << 0,
  19.     NSClosableWindowMask        = 1 << 1,
  20.     NSMiniaturizableWindowMask        = 1 << 2,
  21.     NSResizableWindowMask        = 1 << 3
  22. };
  23.  
  24. extern NSSize NSIconSize;
  25. extern NSSize NSTokenSize;
  26.  
  27. enum {
  28.     NSNormalWindowLevel            = 0,
  29.     NSFloatingWindowLevel        = 3,
  30.     NSDockWindowLevel            = 5,
  31.     NSSubmenuWindowLevel        = 10,
  32.     NSMainMenuWindowLevel        = 20
  33. };
  34.  
  35. @class NSEvent;
  36.  
  37. @interface NSWindow : NSResponder
  38. {
  39.     NSRect              frame;
  40.     id                  contentView;
  41.     id                  delegate;
  42.     id                  firstResponder;
  43.     id                  lastLeftHit;
  44.     id                  lastRightHit;
  45.     id                  counterpart;
  46.     id                  fieldEditor;
  47.     int                 winEventMask;
  48.     int                 windowNum;
  49.     NSColor        *_backgroundColor;
  50.     struct _wFlags {
  51. #ifdef __BIG_ENDIAN__
  52.     unsigned int        style:4;
  53.     unsigned int        backing:2;
  54.     unsigned int        buttonMask:3;
  55.     unsigned int        visible:1;
  56.     unsigned int        isMainWindow:1;
  57.     unsigned int        isKeyWindow:1;
  58.     unsigned int        isPanel:1;
  59.     unsigned int        hideOnDeactivate:1;
  60.     unsigned int        dontFreeWhenClosed:1;
  61.     unsigned int        oneShot:1;
  62. #else
  63.     unsigned int        oneShot:1;
  64.     unsigned int        dontFreeWhenClosed:1;
  65.     unsigned int        hideOnDeactivate:1;
  66.     unsigned int        isPanel:1;
  67.     unsigned int        isKeyWindow:1;
  68.     unsigned int        isMainWindow:1;
  69.     unsigned int        visible:1;
  70.     unsigned int        buttonMask:3;
  71.     unsigned int        backing:2;
  72.     unsigned int        style:4;
  73. #endif
  74.     }                   wFlags;
  75.     struct _wFlags2 {
  76. #ifdef __BIG_ENDIAN__
  77.     unsigned int        deferred:1;
  78.     unsigned int        _cursorRectsDisabled:1;
  79.     unsigned int        _haveFreeCursorRects:1;
  80.     unsigned int        _validCursorRects:1;
  81.     unsigned int        docEdited:1;
  82.     unsigned int        dynamicDepthLimit:1;
  83.     unsigned int        _worksWhenModal:1;
  84.     unsigned int        _limitedBecomeKey:1;
  85.     unsigned int        _needsFlush:1;
  86.     unsigned int        _newMiniIcon:1;
  87.     unsigned int        _ignoredFirstMouse:1;
  88.     unsigned int        _repostedFirstMouse:1;
  89.     unsigned int        _windowDying:1;
  90.     unsigned int        _tempHidden:1;
  91.     unsigned int        _hiddenOnDeactivate:1;
  92.     unsigned int        _floatingPanel:1;
  93. #else
  94.     unsigned int        _floatingPanel:1;
  95.     unsigned int        _hiddenOnDeactivate:1;
  96.     unsigned int        _tempHidden:1;
  97.     unsigned int        _windowDying:1;
  98.     unsigned int        _repostedFirstMouse:1;
  99.     unsigned int        _ignoredFirstMouse:1;
  100.     unsigned int        _RESERVED:1;
  101.     unsigned int        _needsFlush:1;
  102.     unsigned int        _limitedBecomeKey:1;
  103.     unsigned int        _worksWhenModal:1;
  104.     unsigned int        dynamicDepthLimit:1;
  105.     unsigned int        docEdited:1;
  106.     unsigned int        _validCursorRects:1;
  107.     unsigned int        _haveFreeCursorRects:1;
  108.     unsigned int        _cursorRectsDisabled:1;
  109.     unsigned int        deferred:1;
  110. #endif
  111.     }                   wFlags2;
  112.     id                  _borderView;
  113.     short               _displayDisabled;
  114.     short               _flushDisabled;
  115.     void               *_cursorRects;
  116.     NXHashTable        *_trectTable;
  117.     id                  _invalidCursorView;
  118.     id            _miniIcon;
  119.     void           *_private;
  120. }
  121.  
  122. + (NSRect)frameRectForContentRect:(NSRect)cRect styleMask:(int)aStyle;
  123. + (NSRect)contentRectForFrameRect:(NSRect)fRect styleMask:(int)aStyle;
  124. + (float)minFrameWidthWithTitle:(NSString *)aTitle styleMask:(unsigned int)aStyle;
  125. + (NSWindowDepth)defaultDepthLimit;
  126.  
  127. - initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag;
  128. - initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag screen:(NSScreen *)screen;
  129.  
  130. - setTitle:(NSString *)aString;
  131. - setTitleWithRepresentedFilename:(NSString *)aString;
  132. - setExcludedFromWindowsMenu:(BOOL)flag;
  133. - (BOOL)isExcludedFromWindowsMenu;
  134. - setContentView:aView;
  135. - contentView;
  136. - setDelegate:anObject;
  137. - delegate;
  138. - (NSString *)title;
  139. - (int)windowNum;
  140. - (unsigned int)styleMask;
  141. - getFieldEditor:(BOOL)createFlag for:anObject;
  142. - endEditingFor:anObject;
  143.  
  144. - (NSRect)constrainFrameRect:(NSRect)frameRect;
  145. - (void)setFrame:(NSRect)frameRect display:(BOOL)flag;
  146. - setContentSize:(NSSize)contentSize;
  147. - setFrameOrigin:(NSPoint)newOrigin;
  148. - setFrameTopLeftPoint:(NSPoint)newTopLeft;
  149. - (NSPoint)cascadeTopLeftFromPoint:(NSPoint)topLeftPoint;
  150. - (NSRect)frame;
  151.  
  152. - (NSPoint)mouseLocationOutsideOfEventStream;
  153.  
  154. - useOptimizedDrawing:(BOOL)flag;
  155. - disableFlushWindow;
  156. - reenableFlushWindow;
  157. - (BOOL)isFlushWindowDisabled;
  158. - flushWindow;
  159. - flushWindowIfNeeded;
  160. - (void)setViewsNeedDisplay:(BOOL)flag;
  161. - (BOOL)viewsNeedDisplay;
  162. - displayIfNeeded;
  163. - display;
  164. - (void)setAutodisplay:(BOOL)flag;
  165. - (BOOL)isAutodisplay;
  166.  
  167. - update;
  168. - makeFirstResponder:aResponder;
  169. - firstResponder;
  170. - (int)resizeFlags;
  171. - keyDown:(NSEvent *)theEvent;
  172. - close;
  173. - setFreeWhenClosed:(BOOL)flag;
  174. - (BOOL)isReleasedWhenClosed;
  175. - miniaturize:sender;
  176. - deminiaturize:sender;
  177. - (BOOL)tryToPerform:(SEL)anAction with:anObject;
  178. - validRequestorForSendType:(NSString *)sendType andReturnType:(NSString *)returnType;
  179. - setBackgroundColor:(NSColor *)color;
  180. - (NSColor *)backgroundColor;
  181.  
  182. - setHideOnDeactivate:(BOOL)flag;
  183. - (BOOL)doesHideOnDeactivate;
  184. - center;
  185. - makeKeyAndOrderFront:sender;
  186. - orderFront:sender;
  187. - orderBack:sender;
  188. - orderOut:sender;
  189. - orderWindow:(int)place relativeTo:(int)otherWin;
  190. - orderFrontRegardless;
  191.  
  192. - setMiniwindowImage:(NSImage *)anImage;
  193. - setMiniwindowTitle:(NSString *)title;
  194. - (NSImage *)miniwindowImage;
  195. - (NSString *)miniwindowTitle;
  196.  
  197. - setDocEdited:(BOOL)flag;
  198. - (BOOL)isDocEdited;
  199. - (BOOL)isVisible;
  200. - (BOOL)isKeyWindow;
  201. - (BOOL)isMainWindow;
  202. - (BOOL)canBecomeKeyWindow;
  203. - (BOOL)canBecomeMainWindow;
  204. - makeKeyWindow;
  205. - becomeKeyWindow;
  206. - resignKeyWindow;
  207. - becomeMainWindow;
  208. - resignMainWindow;
  209.  
  210. - (BOOL)worksWhenModal;
  211. - (NSPoint)convertBaseToScreen:(NSPoint)aPoint;
  212. - (NSPoint)convertScreenToBase:(NSPoint)aPoint;
  213. - performClose:sender;
  214. - performMiniaturize:sender;
  215. - (int)gState;
  216. - setOneShot:(BOOL)flag;
  217. - (BOOL)isOneShot;
  218. - (NSData *)dataWithEPSInsideRect:(NSRect)rect;
  219. - print:sender;
  220. - fax:sender;
  221.  
  222. - disableCursorRects;
  223. - enableCursorRects;
  224. - discardCursorRects;
  225. - invalidateCursorRectsForView:aView;
  226. - resetCursorRects;
  227.  
  228. - setBackingType:(int)bufferingType;
  229. - (int)backingType;
  230. - (void)setLevel:(int)newLevel;
  231. - (int)level;
  232. - setDepthLimit:(NSWindowDepth)limit;
  233. - (NSWindowDepth)depthLimit;
  234. - setDynamicDepthLimit:(BOOL)flag;
  235. - (BOOL)hasDynamicDepthLimit;
  236. - (NSScreen *)screen;
  237. - (NSScreen *)deepestScreen;
  238. - (BOOL)canStoreColor;
  239. - counterpart;
  240.  
  241. - (NSString *)stringWithSavedFrame;
  242. - (void)setFrameFromString:(NSString *)string;
  243. - (void)saveFrameUsingName:(NSString *)name;
  244. - (BOOL)setFrameUsingName:(NSString *)name;
  245. - (BOOL)setFrameAutosaveName:(NSString *)name;
  246. - (NSString *)frameAutosaveName;
  247. + (void)removeFrameUsingName:(NSString *)name;
  248.  
  249. - (NSSize)minSize;
  250. - (NSSize)maxSize;
  251. - setMinSize:(NSSize)size;
  252. - setMaxSize:(NSSize)size;
  253. - (NSEvent *)nextEventMatchingMask:(unsigned int)mask;
  254. - (NSEvent *)nextEventMatchingMask:(unsigned int)mask untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue:(BOOL)deqFlag;
  255. - (void)discardEventsMatchingMask:(unsigned int)mask beforeEvent:(NSEvent *)lastEvent;
  256. - (void)postEvent:(NSEvent *)event atStart:(BOOL)flag;
  257. - (NSEvent *)currentEvent;
  258. - (void)setAcceptsMouseMovedEvents:(BOOL)flag;
  259. - (BOOL)acceptsMouseMovedEvents;
  260. - (NSDictionary *)deviceDescription;
  261. - sendEvent:(NSEvent *)theEvent;
  262. - (NSPoint)mouseLocationOutsideOfEventStream;
  263.  
  264. @end
  265.  
  266.  
  267. @interface NSWindow(Drag)
  268. - dragImage:anImage at:(NSPoint)baseLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:sourceObj slideBack:(BOOL)slideFlag;
  269.  
  270. - registerForDraggedTypes:(NSArray *)newTypes;
  271. - unregisterDraggedTypes;
  272. @end
  273.  
  274.  
  275. @interface NSObject(WindowDelegate)
  276. - windowWillClose:sender;
  277. - windowWillReturnFieldEditor:sender toObject:client;
  278. - (NSSize)windowWillResize:sender toSize:(NSSize)frameSize;
  279. - windowDidResize:sender;
  280. - windowDidExpose:sender;
  281. - windowWillMove:sender;
  282. - windowDidMove:sender;
  283. - windowDidBecomeKey:sender;
  284. - windowDidResignKey:sender;
  285. - windowDidBecomeMain:sender;
  286. - windowDidResignMain:sender;
  287. - windowWillMiniaturize:sender toMiniwindow:miniwindow;
  288. - windowDidMiniaturize:sender;
  289. - windowDidDeminiaturize:sender;
  290. - windowDidUpdate:sender;
  291. - windowDidChangeScreen:sender;
  292. @end
  293.  
  294.  
  295. /* Notifications */
  296. extern NSString *NSWindowDidBecomeKeyNotification;
  297. extern NSString *NSWindowDidBecomeMainNotification;
  298. extern NSString *NSWindowDidChangeScreenNotification;
  299. extern NSString *NSWindowDidDeminiaturizeNotification;
  300. extern NSString *NSWindowDidExposeNotification;
  301. extern NSString *NSWindowDidMiniaturizeNotification;
  302. extern NSString *NSWindowDidMoveNotification;
  303. extern NSString *NSWindowDidResignKeyNotification;
  304. extern NSString *NSWindowDidResignMainNotification;
  305. extern NSString *NSWindowDidResizeNotification;
  306. extern NSString *NSWindowDidUpdateNotification;
  307. extern NSString *NSWindowWillCloseNotification;
  308. extern NSString *NSWindowWillMiniaturizeNotification;
  309. extern NSString *NSWindowWillMoveNotification;
  310. extern NSString *NSWindowWillUpdateNotification;
  311.