home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / OpenStepConversion / IntermediateFrameworks3 / AppKit.framework / Headers / NSWindow.h < prev    next >
Text File  |  1996-01-22  |  11KB  |  330 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 "screens.h"
  9. #import "drag.h"
  10. #import "NSColor.h"
  11. #import <objc/hashtable.h>
  12. #import "NSGraphics.h"
  13.  
  14. /* Window Types */
  15.  
  16. #define NX_PLAINSTYLE        0
  17. #define NX_TITLEDSTYLE        1
  18. #define NX_MENUSTYLE        2
  19. #define NX_MINIWINDOWSTYLE    3
  20. #define NX_MINIWORLDSTYLE    4
  21. #define NX_TOKENSTYLE        5
  22. #define NX_RESIZEBARSTYLE    6
  23. #define NX_SIZEBARSTYLE        NX_RESIZEBARSTYLE    /* historical */
  24.  
  25. #define NX_FIRSTWINSTYLE    NX_PLAINSTYLE
  26. #define NX_LASTWINSTYLE        NX_RESIZEBARSTYLE
  27. #define NX_NUMWINSTYLES        (NX_LASTWINSTYLE - NX_FIRSTWINSTYLE + 1)
  28.  
  29. #define NX_CLOSEBUTTONMASK        1
  30. #define NX_MINIATURIZEBUTTONMASK    4
  31.  
  32. extern NSSize NSIconSize;
  33. extern NSSize NSTokenSize;
  34.  
  35. /* Window Level Hierarchy */
  36.  
  37. enum {
  38.     NSNormalWindowLevel            = 0,
  39.     NSFloatingWindowLevel        = 3,
  40.     NSDockWindowLevel            = 5,
  41.     NSSubmenuWindowLevel        = 10,
  42.     NSMainMenuWindowLevel        = 20
  43. };
  44.  
  45. @class NSEvent;
  46.  
  47. @interface NSWindow : NSResponder
  48. {
  49.     NSRect              frame;
  50.     id                  contentView;
  51.     id                  delegate;
  52.     id                  firstResponder;
  53.     id                  lastLeftHit;
  54.     id                  lastRightHit;
  55.     id                  counterpart;
  56.     id                  fieldEditor;
  57.     int                 winEventMask;
  58.     int                 windowNum;
  59.     float               backgroundGray;
  60.     struct _wFlags {
  61. #ifdef __BIG_ENDIAN__
  62.     unsigned int        style:4;
  63.     unsigned int        backing:2;
  64.     unsigned int        buttonMask:3;
  65.     unsigned int        visible:1;
  66.     unsigned int        isMainWindow:1;
  67.     unsigned int        isKeyWindow:1;
  68.     unsigned int        isPanel:1;
  69.     unsigned int        hideOnDeactivate:1;
  70.     unsigned int        dontFreeWhenClosed:1;
  71.     unsigned int        oneShot:1;
  72. #else
  73.     unsigned int        oneShot:1;
  74.     unsigned int        dontFreeWhenClosed:1;
  75.     unsigned int        hideOnDeactivate:1;
  76.     unsigned int        isPanel:1;
  77.     unsigned int        isKeyWindow:1;
  78.     unsigned int        isMainWindow:1;
  79.     unsigned int        visible:1;
  80.     unsigned int        buttonMask:3;
  81.     unsigned int        backing:2;
  82.     unsigned int        style:4;
  83. #endif
  84.     }                   wFlags;
  85.     struct _wFlags2 {
  86. #ifdef __BIG_ENDIAN__
  87.     unsigned int        deferred:1;
  88.     unsigned int        _cursorRectsDisabled:1;
  89.     unsigned int        _haveFreeCursorRects:1;
  90.     unsigned int        _validCursorRects:1;
  91.     unsigned int        docEdited:1;
  92.     unsigned int        dynamicDepthLimit:1;
  93.     unsigned int        _worksWhenModal:1;
  94.     unsigned int        _limitedBecomeKey:1;
  95.     unsigned int        _needsFlush:1;
  96.     unsigned int        _newMiniIcon:1;
  97.     unsigned int        _ignoredFirstMouse:1;
  98.     unsigned int        _repostedFirstMouse:1;
  99.     unsigned int        _windowDying:1;
  100.     unsigned int        _tempHidden:1;
  101.     unsigned int        _hiddenOnDeactivate:1;
  102.     unsigned int        _floatingPanel:1;
  103. #else
  104.     unsigned int        _floatingPanel:1;
  105.     unsigned int        _hiddenOnDeactivate:1;
  106.     unsigned int        _tempHidden:1;
  107.     unsigned int        _windowDying:1;
  108.     unsigned int        _repostedFirstMouse:1;
  109.     unsigned int        _ignoredFirstMouse:1;
  110.     unsigned int        _RESERVED:1;
  111.     unsigned int        _needsFlush:1;
  112.     unsigned int        _limitedBecomeKey:1;
  113.     unsigned int        _worksWhenModal:1;
  114.     unsigned int        dynamicDepthLimit:1;
  115.     unsigned int        docEdited:1;
  116.     unsigned int        _validCursorRects:1;
  117.     unsigned int        _haveFreeCursorRects:1;
  118.     unsigned int        _cursorRectsDisabled:1;
  119.     unsigned int        deferred:1;
  120. #endif
  121.     }                   wFlags2;
  122.     id                  _borderView;
  123.     short               _displayDisabled;
  124.     short               _flushDisabled;
  125.     void               *_cursorRects;
  126.     NXHashTable        *_trectTable;
  127.     id                  _invalidCursorView;
  128.     id            _miniIcon;
  129.     void           *_private;
  130. }
  131.  
  132. + (NSRect)frameRectForContentRect:(NSRect)cRect style:(int)aStyle;
  133. + (NSRect)contentRectForFrameRect:(NSRect)fRect style:(int)aStyle;
  134. + (float)minFrameWidth:(NSString *)aTitle forStyle:(int)aStyle buttonMask:(int)aMask;
  135. + (NSWindowDepth)defaultDepthLimit;
  136.  
  137. - initContent:(NSRect)contentRect style:(int)aStyle backing:(int)bufferingType buttonMask:(int)mask defer:(BOOL)flag;
  138. - initContent:(NSRect)contentRect style:(int)aStyle backing:(int)bufferingType buttonMask:(int)mask defer:(BOOL)flag screen:(const NXScreen *)screen;
  139.  
  140. - setTitle:(NSString *)aString;
  141. - setTitleAsFilename:(NSString *)aString;
  142. - setExcludedFromWindowsMenu:(BOOL)flag;
  143. - (BOOL)isExcludedFromWindowsMenu;
  144. - setContentView:aView;
  145. - contentView;
  146. - setDelegate:anObject;
  147. - delegate;
  148. - (NSString *)title;
  149. - (int)buttonMask;
  150. - (int)windowNum;
  151. - getFieldEditor:(BOOL)createFlag for:anObject;
  152. - endEditingFor:anObject;
  153.  
  154. - placeWindowAndDisplay:(NSRect)frameRect;
  155. - placeWindow:(NSRect)frameRect;
  156. - placeWindow:(NSRect)frameRect screen:(const NXScreen *)screen;
  157. - (NSRect)constrainFrameRect:(NSRect)frameRect;
  158. - setContentSize:(NSSize)_contentSize;
  159. - setFrameOrigin:(NSPoint)_newOrigin;
  160. - setFrameTopLeftPoint:(NSPoint)_newTopLeft;
  161. - moveTo:(float)x :(float)y screen:(const NXScreen *)screen;
  162. - moveTopLeftTo:(float)x :(float)y screen:(const NXScreen *)screen;
  163. - (NSRect)frame;
  164. - getFrame:(NSRect *)rect andScreen:(const NXScreen **)screen;
  165. - (NSPoint)mouseLocation;
  166. - (int)style;
  167.  
  168. - useOptimizedDrawing:(BOOL)flag;
  169. - disableFlushWindow;
  170. - reenableFlushWindow;
  171. - (BOOL)isFlushWindowDisabled;
  172. - flushWindow;
  173. - flushWindowIfNeeded;
  174. - disableDisplay;
  175. - reenableDisplay;
  176. - (BOOL)isDisplayEnabled;
  177. - displayIfNeeded;
  178. - display;
  179. - update;
  180. - setTrackingRect:(NSRect)aRect inside:(BOOL)insideFlag owner:anObject tag:(int)trackNum left:(BOOL)leftDown right:(BOOL)rightDown;
  181. - discardTrackingRect:(int)trackNum;
  182. - makeFirstResponder:aResponder;
  183. - firstResponder;
  184. - windowExposed:(NSEvent *)theEvent;
  185. - windowMoved:(NSEvent *)theEvent;
  186. - screenChanged:(NSEvent *)theEvent;
  187. - (int)resizeFlags;
  188. - makeKeyWindow;
  189. - becomeKeyWindow;
  190. - resignKeyWindow;
  191. - becomeMainWindow;
  192. - resignMainWindow;
  193. - displayBorder;
  194. - rightMouseDown:(NSEvent *)theEvent;
  195. - (BOOL)performKeyEquivalent:(NSEvent *)theEvent;
  196. - close;
  197. - setFreeWhenClosed:(BOOL)flag;
  198. - miniaturize:sender;
  199. - deminiaturize:sender;
  200. - (BOOL)tryToPerform:(SEL)anAction with:anObject;
  201. - validRequestorForSendType:(NSString *)sendType andReturnType:(NSString *)returnType;
  202. - setBackgroundColor:(NSColor *)color;
  203. - (NSColor *)backgroundColor;
  204. - dragFromPoint:(NSPoint)point eventNumber:(int)num;
  205. - setHideOnDeactivate:(BOOL)flag;
  206. - (BOOL)doesHideOnDeactivate;
  207. - center;
  208. - makeKeyAndOrderFront:sender;
  209. - orderFront:sender;
  210. - orderBack:sender;
  211. - orderOut:sender;
  212. - orderWindow:(int)place relativeTo:(int)otherWin;
  213. - orderFrontRegardless;
  214. - setMiniwindowImage:(NSImage *)image;
  215. - setMiniwindowTitle:(NSString *)title;
  216. - (NSImage *)miniwindowImage;
  217. - (NSString *)miniwindowTitle;
  218. - setDocEdited:(BOOL)flag;
  219. - (BOOL)isDocEdited;
  220. - (BOOL)isVisible;
  221. - (BOOL)isKeyWindow;
  222. - (BOOL)isMainWindow;
  223. - (BOOL)canBecomeKeyWindow;
  224. - (BOOL)canBecomeMainWindow;
  225. - (BOOL)worksWhenModal;
  226. - (NSPoint)convertBaseToScreen:(NSPoint)aPoint;
  227. - (NSPoint)convertScreenToBase:(NSPoint)aPoint;
  228. - performClose:sender;
  229. - performMiniaturize:sender;
  230. - (int)gState;
  231. - setOneShot:(BOOL)flag;
  232. - (BOOL)isOneShot;
  233. - faxPSCode:sender;
  234. - printPSCode:sender;
  235. - (NSData *)dataWithEPSInsideRect:(NSRect)rect;
  236. - smartFaxPSCode:sender;
  237. - smartPrintPSCode:sender;
  238. - (BOOL)knowsPagesFirst:(int *)firstPageNum last:(int *)lastPageNum;
  239. - openSpoolFile:(char *)filename;
  240. - beginPSOutput;
  241. - beginPrologueBBox:(NSRect)boundingBox creationDate:(NSString *)dateCreated createdBy:(NSString *)anApplication fonts:(NSString *)fontNames forWhom:(NSString *)user pages:(int)numPages title:(NSString *)aTitle;
  242. - endHeaderComments;
  243. - endPrologue;
  244. - beginSetup;
  245. - endSetup;
  246. - beginPage:(int)ordinalNum label:(NSString *)aString bBox:(NSRect)pageRect fonts:(NSString *)fontNames;
  247. - beginPageSetupRect:(NSRect)aRect placement:(NSPoint)location;
  248. - endPageSetup;
  249. - endPage;
  250. - beginTrailer;
  251. - endTrailer;
  252. - endPSOutput;
  253. - spoolFile:(NSString *)filename;
  254. - (float)heightAdjustLimit;
  255. - (float)widthAdjustLimit;
  256. - (NSRect)rectForPage;
  257. - placePrintRect:(NSRect)aRect offset:(NSPoint)location;
  258. - addCursorRect:(NSRect)aRect cursor:anObj forView:aView;
  259. - removeCursorRect:(NSRect)aRect cursor:anObj forView:aView;
  260. - disableCursorRects;
  261. - enableCursorRects;
  262. - discardCursorRects;
  263. - invalidateCursorRectsForView:aView;
  264. - resetCursorRects;
  265. - setBackingType:(int)bufferingType;
  266. - (int)backingType;
  267. - setAvoidsActivation:(BOOL)flag;
  268. - (BOOL)avoidsActivation;
  269. - setDepthLimit:(NSWindowDepth)limit;
  270. - (NSWindowDepth)depthLimit;
  271. - setDynamicDepthLimit:(BOOL)flag;
  272. - (BOOL)hasDynamicDepthLimit;
  273. - (const NXScreen *)screen;
  274. - (const NXScreen *)bestScreen;
  275. - (BOOL)canStoreColor;
  276. - counterpart;
  277.  
  278. - (NSString *)stringWithSavedFrame;
  279. - (void)setFrameFromString:(NSString *)string;
  280. - (void)saveFrameUsingName:(NSString *)name;
  281. - (BOOL)setFrameUsingName:(NSString *)name;
  282. - (BOOL)setFrameAutosaveName:(NSString *)name;
  283. - (NSString *)frameAutosaveName;
  284. + (void)removeFrameUsingName:(NSString *)name;
  285.  
  286. - (NSSize)minSize;
  287. - (NSSize)maxSize;
  288. - setMinSize:(NSSize)size;
  289. - setMaxSize:(NSSize)size;
  290. - (NSEvent *)nextEventMatchingMask:(unsigned int)mask;
  291. - (NSEvent *)nextEventMatchingMask:(unsigned int)mask untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue:(BOOL)deqFlag;
  292. - (void)discardEventsMatchingMask:(unsigned int)mask beforeEvent:(NSEvent *)lastEvent;
  293. - (void)postEvent:(NSEvent *)event atStart:(BOOL)flag;
  294. - (NSEvent *)currentEvent;
  295. - (void)setAcceptsMouseMovedEvents:(BOOL)flag;
  296. - (BOOL)acceptsMouseMovedEvents;
  297. - (NSDictionary *)deviceDescription;
  298. - sendEvent:(NSEvent *)theEvent;
  299. - (NSPoint)mouseLocationOutsideOfEventStream;
  300.  
  301. @end
  302.  
  303.  
  304. @interface NSWindow(Drag)
  305. - dragImage:anImage at:(NSPoint)baseLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:sourceObj slideBack:(BOOL)slideFlag;
  306.  
  307. - registerForDraggedTypes:(NSArray *)newTypes;
  308. - unregisterDraggedTypes;
  309. @end
  310.  
  311.  
  312. @interface NSObject(WindowDelegate)
  313. - windowWillClose:sender;
  314. - windowWillReturnFieldEditor:sender toObject:client;
  315. - (NSSize)windowWillResize:sender toSize:(NSSize)frameSize;
  316. - windowDidResize:sender;
  317. - windowDidExpose:sender;
  318. - windowWillMove:sender;
  319. - windowDidMove:sender;
  320. - windowDidBecomeKey:sender;
  321. - windowDidResignKey:sender;
  322. - windowDidBecomeMain:sender;
  323. - windowDidResignMain:sender;
  324. - windowWillMiniaturize:sender toMiniwindow:miniwindow;
  325. - windowDidMiniaturize:sender;
  326. - windowDidDeminiaturize:sender;
  327. - windowDidUpdate:sender;
  328. - windowDidChangeScreen:sender;
  329. @end
  330.