home *** CD-ROM | disk | FTP | other *** search
- /*
- Window.h
- Application Kit, Release 2.0
- Copyright (c) 1988, 1989, 1990, NeXT, Inc. All rights reserved.
- */
-
- #import "NSResponder.h"
- #import "screens.h"
- #import "drag.h"
- #import "color.h"
- #import <objc/hashtable.h>
- #import "NSGraphics.h"
-
- /* Window Types */
-
- #define NX_PLAINSTYLE 0
- #define NX_TITLEDSTYLE 1
- #define NX_MENUSTYLE 2
- #define NX_MINIWINDOWSTYLE 3
- #define NX_MINIWORLDSTYLE 4
- #define NX_TOKENSTYLE 5
- #define NX_RESIZEBARSTYLE 6
- #define NX_SIZEBARSTYLE NX_RESIZEBARSTYLE /* historical */
-
- #define NX_FIRSTWINSTYLE NX_PLAINSTYLE
- #define NX_LASTWINSTYLE NX_RESIZEBARSTYLE
- #define NX_NUMWINSTYLES (NX_LASTWINSTYLE - NX_FIRSTWINSTYLE + 1)
-
- #define NX_CLOSEBUTTONMASK 1
- #define NX_MINIATURIZEBUTTONMASK 4
-
- extern NSSize NSIconSize;
- extern NSSize NSTokenSize;
-
- /* Window Level Hierarchy */
-
- enum {
- NSNormalWindowLevel = 0,
- NSFloatingWindowLevel = 3,
- NSDockWindowLevel = 5,
- NSSubmenuWindowLevel = 10,
- NSMainMenuWindowLevel = 20
- };
-
-
- @interface NSWindow : NSResponder
- {
- NSRect frame;
- id contentView;
- id delegate;
- id firstResponder;
- id lastLeftHit;
- id lastRightHit;
- id counterpart;
- id fieldEditor;
- int winEventMask;
- int windowNum;
- float backgroundGray;
- struct _wFlags {
- #ifdef __BIG_ENDIAN__
- unsigned int style:4;
- unsigned int backing:2;
- unsigned int buttonMask:3;
- unsigned int visible:1;
- unsigned int isMainWindow:1;
- unsigned int isKeyWindow:1;
- unsigned int isPanel:1;
- unsigned int hideOnDeactivate:1;
- unsigned int dontFreeWhenClosed:1;
- unsigned int oneShot:1;
- #else
- unsigned int oneShot:1;
- unsigned int dontFreeWhenClosed:1;
- unsigned int hideOnDeactivate:1;
- unsigned int isPanel:1;
- unsigned int isKeyWindow:1;
- unsigned int isMainWindow:1;
- unsigned int visible:1;
- unsigned int buttonMask:3;
- unsigned int backing:2;
- unsigned int style:4;
- #endif
- } wFlags;
- struct _wFlags2 {
- #ifdef __BIG_ENDIAN__
- unsigned int deferred:1;
- unsigned int _cursorRectsDisabled:1;
- unsigned int _haveFreeCursorRects:1;
- unsigned int _validCursorRects:1;
- unsigned int docEdited:1;
- unsigned int dynamicDepthLimit:1;
- unsigned int _worksWhenModal:1;
- unsigned int _limitedBecomeKey:1;
- unsigned int _needsFlush:1;
- unsigned int _newMiniIcon:1;
- unsigned int _ignoredFirstMouse:1;
- unsigned int _repostedFirstMouse:1;
- unsigned int _windowDying:1;
- unsigned int _tempHidden:1;
- unsigned int _hiddenOnDeactivate:1;
- unsigned int _floatingPanel:1;
- #else
- unsigned int _floatingPanel:1;
- unsigned int _hiddenOnDeactivate:1;
- unsigned int _tempHidden:1;
- unsigned int _windowDying:1;
- unsigned int _repostedFirstMouse:1;
- unsigned int _ignoredFirstMouse:1;
- unsigned int _RESERVED:1;
- unsigned int _needsFlush:1;
- unsigned int _limitedBecomeKey:1;
- unsigned int _worksWhenModal:1;
- unsigned int dynamicDepthLimit:1;
- unsigned int docEdited:1;
- unsigned int _validCursorRects:1;
- unsigned int _haveFreeCursorRects:1;
- unsigned int _cursorRectsDisabled:1;
- unsigned int deferred:1;
- #endif
- } wFlags2;
- id _borderView;
- short _displayDisabled;
- short _flushDisabled;
- void *_cursorRects;
- NXHashTable *_trectTable;
- id _invalidCursorView;
- id _miniIcon;
- void *_private;
- }
-
- + (NSRect)frameRectForContentRect:(NSRect)cRect style:(int)aStyle;
- + (NSRect)contentRectForFrameRect:(NSRect)fRect style:(int)aStyle;
- + (float)minFrameWidth:(NSString *)aTitle forStyle:(int)aStyle buttonMask:(int)aMask;
- + (NSWindowDepth)defaultDepthLimit;
-
- - init;
- - initContent:(NSRect)contentRect style:(int)aStyle backing:(int)bufferingType buttonMask:(int)mask defer:(BOOL)flag;
- - initContent:(NSRect)contentRect style:(int)aStyle backing:(int)bufferingType buttonMask:(int)mask defer:(BOOL)flag screen:(const NXScreen *)screen;
- - (void)dealloc;
- - setTitle:(NSString *)aString;
- - setTitleAsFilename:(NSString *)aString;
- - setExcludedFromWindowsMenu:(BOOL)flag;
- - (BOOL)isExcludedFromWindowsMenu;
- - setContentView:aView;
- - contentView;
- - setDelegate:anObject;
- - delegate;
- - (NSString *)title;
- - (int)buttonMask;
- - (int)windowNum;
- - getFieldEditor:(BOOL)createFlag for:anObject;
- - endEditingFor:anObject;
- - placeWindowAndDisplay:(NSRect)frameRect;
- - placeWindow:(NSRect)frameRect;
- - placeWindow:(NSRect)frameRect screen:(const NXScreen *)screen;
- - (NSRect)constrainFrameRect:(NSRect)frameRect;
- - setContentSize:(NSSize)_contentSize;
- - setFrameOrigin:(NSPoint)_newOrigin;
- - setFrameTopLeftPoint:(NSPoint)_newTopLeft;
- - moveTo:(float)x :(float)y screen:(const NXScreen *)screen;
- - moveTopLeftTo:(float)x :(float)y screen:(const NXScreen *)screen;
- - (NSRect)frame;
- - getFrame:(NSRect *)rect andScreen:(const NXScreen **)screen;
- - (NSPoint)mouseLocation;
- - (int)style;
- - useOptimizedDrawing:(BOOL)flag;
- - disableFlushWindow;
- - reenableFlushWindow;
- - (BOOL)isFlushWindowDisabled;
- - flushWindow;
- - flushWindowIfNeeded;
- - disableDisplay;
- - reenableDisplay;
- - (BOOL)isDisplayEnabled;
- - displayIfNeeded;
- - display;
- - update;
- - (int)setEventMask:(int)newMask;
- - (int)addToEventMask:(int)newEvents;
- - (int)removeFromEventMask:(int)oldEvents;
- - (int)eventMask;
- - setTrackingRect:(NSRect)aRect inside:(BOOL)insideFlag owner:anObject tag:(int)trackNum left:(BOOL)leftDown right:(BOOL)rightDown;
- - discardTrackingRect:(int)trackNum;
- - makeFirstResponder:aResponder;
- - firstResponder;
- - sendEvent:(NXEvent *)theEvent;
- - windowExposed:(NXEvent *)theEvent;
- - windowMoved:(NXEvent *)theEvent;
- - screenChanged:(NXEvent *)theEvent;
- - (int)resizeFlags;
- - makeKeyWindow;
- - becomeKeyWindow;
- - resignKeyWindow;
- - becomeMainWindow;
- - resignMainWindow;
- - displayBorder;
- - rightMouseDown:(NXEvent *)theEvent;
- - (BOOL)commandKey:(NXEvent *)theEvent;
- - close;
- - setFreeWhenClosed:(BOOL)flag;
- - miniaturize:sender;
- - deminiaturize:sender;
- - (BOOL)tryToPerform:(SEL)anAction with:anObject;
- - validRequestorForSendType:(NSString *)sendType andReturnType:(NSString *)returnType;
- - setBackgroundGray:(float)value;
- - (float)backgroundGray;
- - setBackgroundColor:(NXColor)color;
- - (NXColor)backgroundColor;
- - dragFromPoint:(NSPoint)point eventNumber:(int)num;
- - setHideOnDeactivate:(BOOL)flag;
- - (BOOL)doesHideOnDeactivate;
- - center;
- - makeKeyAndOrderFront:sender;
- - orderFront:sender;
- - orderBack:sender;
- - orderOut:sender;
- - orderWindow:(int)place relativeTo:(int)otherWin;
- - orderFrontRegardless;
- - setMiniwindowImage:(NSImage *)image;
- - setMiniwindowTitle:(NSString *)title;
- - (NSImage *)miniwindowImage;
- - (NSString *)miniwindowTitle;
- - setDocEdited:(BOOL)flag;
- - (BOOL)isDocEdited;
- - (BOOL)isVisible;
- - (BOOL)isKeyWindow;
- - (BOOL)isMainWindow;
- - (BOOL)canBecomeKeyWindow;
- - (BOOL)canBecomeMainWindow;
- - (BOOL)worksWhenModal;
- - (NSPoint)convertBaseToScreen:(NSPoint)aPoint;
- - (NSPoint)convertScreenToBase:(NSPoint)aPoint;
- - performClose:sender;
- - performMiniaturize:sender;
- - (int)gState;
- - setOneShot:(BOOL)flag;
- - (BOOL)isOneShot;
- - faxPSCode:sender;
- - printPSCode:sender;
- - (NSData *)dataWithEPSInsideRect:(NSRect)rect;
- - smartFaxPSCode:sender;
- - smartPrintPSCode:sender;
- - (BOOL)knowsPagesFirst:(int *)firstPageNum last:(int *)lastPageNum;
- - openSpoolFile:(char *)filename;
- - beginPSOutput;
- - beginPrologueBBox:(NSRect)boundingBox creationDate:(NSString *)dateCreated createdBy:(NSString *)anApplication fonts:(NSString *)fontNames forWhom:(NSString *)user pages:(int)numPages title:(NSString *)aTitle;
- - endHeaderComments;
- - endPrologue;
- - beginSetup;
- - endSetup;
- - beginPage:(int)ordinalNum label:(NSString *)aString bBox:(NSRect)pageRect fonts:(NSString *)fontNames;
- - beginPageSetupRect:(NSRect)aRect placement:(NSPoint)location;
- - endPageSetup;
- - endPage;
- - beginTrailer;
- - endTrailer;
- - endPSOutput;
- - spoolFile:(NSString *)filename;
- - (float)heightAdjustLimit;
- - (float)widthAdjustLimit;
- - (NSRect)rectForPage;
- - placePrintRect:(NSRect)aRect offset:(NSPoint)location;
- - addCursorRect:(NSRect)aRect cursor:anObj forView:aView;
- - removeCursorRect:(NSRect)aRect cursor:anObj forView:aView;
- - disableCursorRects;
- - enableCursorRects;
- - discardCursorRects;
- - invalidateCursorRectsForView:aView;
- - resetCursorRects;
- - setBackingType:(int)bufferingType;
- - (int)backingType;
- - setAvoidsActivation:(BOOL)flag;
- - (BOOL)avoidsActivation;
- - setDepthLimit:(NSWindowDepth)limit;
- - (NSWindowDepth)depthLimit;
- - setDynamicDepthLimit:(BOOL)flag;
- - (BOOL)hasDynamicDepthLimit;
- - (const NXScreen *)screen;
- - (const NXScreen *)bestScreen;
- - (BOOL)canStoreColor;
- - counterpart;
-
- - (NSString *)stringWithSavedFrame;
- - (void)setFrameFromString:(NSString *)string;
- - (void)saveFrameUsingName:(NSString *)name;
- - (BOOL)setFrameUsingName:(NSString *)name;
- - (BOOL)setFrameAutosaveName:(NSString *)name;
- - (NSString *)frameAutosaveName;
- + (void)removeFrameUsingName:(NSString *)name;
-
- - (NSSize)minSize;
- - (NSSize)maxSize;
- - setMinSize:(NSSize)size;
- - setMaxSize:(NSSize)size;
-
- @end
-
-
- @interface NSWindow(Drag)
- - dragImage:anImage at:(NSPoint)baseLocation offset:(NSSize)initialOffset event:(NXEvent *)event pasteboard:(NSPasteboard *)pboard source:sourceObj slideBack:(BOOL)slideFlag;
-
- - registerForDraggedTypes:(NSArray *)newTypes;
- - unregisterDraggedTypes;
- @end
-
-
- @interface NSObject(WindowDelegate)
- - windowWillClose:sender;
- - windowWillReturnFieldEditor:sender toObject:client;
- - (NSSize)windowWillResize:sender toSize:(NSSize)frameSize;
- - windowDidResize:sender;
- - windowDidExpose:sender;
- - windowWillMove:sender;
- - windowDidMove:sender;
- - windowDidBecomeKey:sender;
- - windowDidResignKey:sender;
- - windowDidBecomeMain:sender;
- - windowDidResignMain:sender;
- - windowWillMiniaturize:sender toMiniwindow:miniwindow;
- - windowDidMiniaturize:sender;
- - windowDidDeminiaturize:sender;
- - windowDidUpdate:sender;
- - windowDidChangeScreen:sender;
- @end
-