[Previous] [Up] [Next]

NSWindow

Authors

Richard Frith-Macdonald
James Dessart

Version: $Revision$

Date: $Date$

NSWindow

NSWindow

Declared in: Gui/NSWindow.h

Inherits from: NSResponder

Conforms to: NSCoding


Instances of the NSWindow class handle on-screen windows, their associated NSViews, and events generate by the user. An NSWindow's size is defined by its frame rectangle, which encompasses its entire structure, and its content rectangle, which includes only the content.

Every NSWindow has a content view, the NSView which forms the root of the window's view hierarchy. This view can be set using the setContentView: method, and accessed through the contentView method. setContentView: replaces the default content view created by NSWindow.

Other views may be added to the window by using the content view's addSubview: method. These subviews can also have subviews added, forming a tree structure, the view hierarchy. When an NSWindow must display itself, it causes this hierarchy to draw itself. Leaf nodes in the view hierarchy are drawn last, causing them to potentially obscure views further up in the hierarchy.

A delegate can be specified for an NSWindow, which will receive notifications of events pertaining to the window. The delegate is set using setDelegate:, and can be retrieved using delegate. The delegate can restrain resizing by implementing the windowWillResize: toSize: method, or control the closing of the window by implementing windowShouldClose:.

Instance Variables

Methods


Class Methods

contentRectForFrameRect:

+ (NSRect) contentRectForFrameRect: (NSRect)frameRect;

defaultDepthLimit

+ (NSWindowDepth) defaultDepthLimit;

frameRectForContentRect:

+ (NSRect) frameRectForContentRect: (NSRect)contentRect;

menuChanged:

+ (void) menuChanged: (NSMenu*)aMenu;

minFrameWidthWithTitle:styleMask:

+ (float) minFrameWidthWithTitle: (NSString*)aTitle styleMask: (unsigned int)aStyle;

removeFrameUsingName:

+ (void) removeFrameUsingName: (NSString*)name;


Instances Methods

acceptsMouseMovedEvents

- (BOOL) acceptsMouseMovedEvents;

areCursorRectsEnabled

- (BOOL) areCursorRectsEnabled;

aspectRatio

- (NSSize) aspectRatio;

backgroundColor

- (NSColor*) backgroundColor;

backingType

- (NSBackingStoreType) backingType;

becomeKeyWindow

- (void) becomeKeyWindow;

becomeMainWindow

- (void) becomeMainWindow;

cacheImageInRect:

- (void) cacheImageInRect: (NSRect)aRect;

canBecomeKeyWindow

- (BOOL) canBecomeKeyWindow;

canBecomeMainWindow

- (BOOL) canBecomeMainWindow;

canStoreColor

- (BOOL) canStoreColor;

cascadeTopLeftFromPoint:

- (NSPoint) cascadeTopLeftFromPoint: (NSPoint)topLeftPoint;

center

- (void) center;

close

- (void) close;

constrainFrameRect:

- (NSRect) constrainFrameRect: (NSRect)frameRect;

contentView

- (id) contentView;

Returns the NSWindow's content view.


convertBaseToScreen:

- (NSPoint) convertBaseToScreen: (NSPoint)aPoint;

convertScreenToBase:

- (NSPoint) convertScreenToBase: (NSPoint)aPoint;

currentEvent

- (NSEvent*) currentEvent;

dataWithEPSInsideRect:

- (NSData*) dataWithEPSInsideRect: (NSRect)aRect;

deepestScreen

- (NSScreen*) deepestScreen;

defaultButtonCell

- (NSButtonCell*) defaultButtonCell;

delegate

- (id) delegate;

deminiaturize:

- (void) deminiaturize: (id)sender;

depthLimit

- (NSWindowDepth) depthLimit;

deviceDescription

- (NSDictionary*) deviceDescription;

disableCursorRects

- (void) disableCursorRects;

disableFlushWindow

- (void) disableFlushWindow;

disableKeyEquivalentForDefaultButtonCell

- (void) disableKeyEquivalentForDefaultButtonCell;

discardCachedImage

- (void) discardCachedImage;

discardCursorRects

- (void) discardCursorRects;

discardEventsMatchingMask:beforeEvent:

- (void) discardEventsMatchingMask: (unsigned int)mask beforeEvent: (NSEvent*)lastEvent;

display

- (void) display;

displayIfNeeded

- (void) displayIfNeeded;

dragImage:at:offset:event:pasteboard:source:slideBack:

- (void) dragImage: (NSImage*)anImage at: (NSPoint)aPoint offset: (NSSize)initialOffset event: (NSEvent *)theEvent pasteboard: (NSPasteboard*)pboard source: (id)sourceObject slideBack: (BOOL)slideBack;

enableCursorRects

- (void) enableCursorRects;

enableFlushWindow

- (void) enableFlushWindow;

enableKeyEquivalentForDefaultButtonCell

- (void) enableKeyEquivalentForDefaultButtonCell;

endEditingFor:

- (void) endEditingFor: (id)anObject;

fax:

- (void) fax: (id)sender;

fieldEditor:

- (NSText*) fieldEditor: (BOOL)createFlag;

firstResponder

- (NSResponder*) firstResponder;

flushWindow

- (void) flushWindow;

flushWindowIfNeeded

- (void) flushWindowIfNeeded;

frame

- (NSRect) frame;

frameAutosaveName

- (NSString*) frameAutosaveName;

gState

- (int) gState;

hasDynamicDepthLimit

- (BOOL) hasDynamicDepthLimit;

hidesOnDeactivate

- (BOOL) hidesOnDeactivate;

initialFirstResponder

- (NSView*) initialFirstResponder;

initWithContentRect:styleMask:backing:

- (id) initWithContentRect: (NSRect)contentRect styleMask: (unsigned int)styleMask backing: (NSBackingStoreType)backingType;

Initializes the receiver with a content rect of contentRect, a style mask of styleMask, and a backing store type of backingType.

The style mask values are NSTitledWindowMask, for a window with a title, NSClosableWindowMask, for a window with a close widget, NSMiniaturizableWindowMask, for a window with a miniaturize widget, and NSResizableWindowMask, for a window with a resizing widget. These mask values can be OR'd in any combination.

Backing store values are NSBackingStoreBuffered, NSBackingStoreRetained and NSBackingStoreNonretained.


initWithContentRect:styleMask:backing:defer:screen:

- (id) initWithContentRect: (NSRect)contentRect styleMask: (unsigned int)styleMask backing: (NSBackingStoreType)bufferingType defer: (BOOL)flag screen: (NSScreen*)aScreen;

Initializes the receiver with a content rect of contentRect, a style mask of styleMask, a backing store type of backingType and a boolean flag. flag specifies whether the window should be created now (NO), or when it is displayed (YES).

The style mask values are NSTitledWindowMask, for a window with a title, NSClosableWindowMask, for a window with a close widget, NSMiniaturizableWindowMask, for a window with a miniaturize widget, and NSResizableWindowMask, for a window with a resizing widget. These mask values can be OR'd in any combination.

Backing store values are NSBackingStoreBuffered, NSBackingStoreRetained and NSBackingStoreNonretained.


interfaceStyle

- (NSInterfaceStyle) interfaceStyle;

invalidateCursorRectsForView:

- (void) invalidateCursorRectsForView: (NSView*)aView;

isAutodisplay

- (BOOL) isAutodisplay;

isDocumentEdited

- (BOOL) isDocumentEdited;

isExcludedFromWindowsMenu

- (BOOL) isExcludedFromWindowsMenu;

isFlushWindowDisabled

- (BOOL) isFlushWindowDisabled;

isKeyWindow

- (BOOL) isKeyWindow;

isMainWindow

- (BOOL) isMainWindow;

isMiniaturized

- (BOOL) isMiniaturized;

isOneShot

- (BOOL) isOneShot;

isReleasedWhenClosed

- (BOOL) isReleasedWhenClosed;

isVisible

- (BOOL) isVisible;

isZoomed;

- (BOOL) isZoomed;;

keyDown:

- (void) keyDown: (NSEvent*)theEvent;

keyViewSelectionDirection

- (NSSelectionDirection) keyViewSelectionDirection;

level

- (int) level;

makeFirstResponder:

- (BOOL) makeFirstResponder: (NSResponder*)aResponder;

makeKeyAndOrderFront:

- (void) makeKeyAndOrderFront: (id)sender;

makeKeyWindow

- (void) makeKeyWindow;

makeMainWindow

- (void) makeMainWindow;

maxSize

- (NSSize) maxSize;

miniaturize:

- (void) miniaturize: (id)sender;

miniwindowImage

- (NSImage*) miniwindowImage;

miniwindowTitle

- (NSString*) miniwindowTitle;

minSize

- (NSSize) minSize;

mouseLocationOutsideOfEventStream

- (NSPoint) mouseLocationOutsideOfEventStream;

nextEventMatchingMask:

- (NSEvent*) nextEventMatchingMask: (unsigned int)mask;

nextEventMatchingMask:untilDate:inMode:dequeue:

- (NSEvent*) nextEventMatchingMask: (unsigned int)mask untilDate: (NSDate*)expirationDate inMode: (NSString *)mode dequeue: (BOOL)dequeue;

orderBack:

- (void) orderBack: (id)sender;

orderFront:

- (void) orderFront: (id)sender;

orderFrontRegardless

- (void) orderFrontRegardless;

orderOut:

- (void) orderOut: (id)sender;

orderWindow:relativeTo:

- (void) orderWindow: (NSWindowOrderingMode)place relativeTo: (int)otherWindowNumber;

performClose:

- (void) performClose: (id)sender;

performMiniaturize:

- (void) performMiniaturize: (id)sender;

performZoom:

- (void) performZoom: (id)sender;

postEvent:

- (void) postEvent: (NSEvent*)anEvent;

print:

- (void) print: (id)sender;

registerForDraggedTypes:

- (void) registerForDraggedTypes: (NSArray*)pboardTypes;

representedFilename

- (NSString*) representedFilename;

resetCursorRects

- (void) resetCursorRects;

resignKeyWindow

- (void) resignKeyWindow;

resignMainWindow

- (void) resignMainWindow;

resizeFlags

- (int) resizeFlags;

resizeIncrements

- (NSSize) resizeIncrements;

restoreCachedImage

- (void) restoreCachedImage;

saveFrameUsingName:

- (void) saveFrameUsingName: (NSString*)name;

screen

- (NSScreen*) screen;

selectKeyViewFollowingView:

- (void) selectKeyViewFollowingView: (NSView*)aView;

selectKeyViewPrecedingView:

- (void) selectKeyViewPrecedingView: (NSView*)aView;

selectNextKeyView:

- (void) selectNextKeyView: (id)sender;

selectPreviousKeyView:

- (void) selectPreviousKeyView: (id)sender;

sendEvent:

- (void) sendEvent: (NSEvent*)theEvent;

setAcceptsMouseMovedEvents:

- (void) setAcceptsMouseMovedEvents: (BOOL)flag;

setAspectRatio:

- (void) setAspectRatio: (NSSize)ratio;

setAutodisplay:

- (void) setAutodisplay: (BOOL)flag;

setBackgroundColor:

- (void) setBackgroundColor: (NSColor*)aColor;

setBackingType:

- (void) setBackingType: (NSBackingStoreType)backingType;

setContentSize:

- (void) setContentSize: (NSSize)aSize;

setContentView:

- (void) setContentView: (NSView*)aView;

Sets the window's content view to aView, replacing any previous content view.


setDefaultButtonCell:

- (void) setDefaultButtonCell: (NSButtonCell*)aButtonCell;

setDelegate:

- (void) setDelegate: (id)anObject;

setDepthLimit:

- (void) setDepthLimit: (NSWindowDepth)limit;

setDocumentEdited:

- (void) setDocumentEdited: (BOOL)flag;

setDynamicDepthLimit:

- (void) setDynamicDepthLimit: (BOOL)flag;

setExcludedFromWindowsMenu:

- (void) setExcludedFromWindowsMenu: (BOOL)flag;

setFrame:

- (void) setFrame: (NSRect)frameRect;

setFrameAutosaveName:

- (BOOL) setFrameAutosaveName: (NSString*)name;

setFrameFromString:

- (void) setFrameFromString: (NSString*)aString;

setFrameOrigin:

- (void) setFrameOrigin: (NSPoint)aPoint;

setFrameTopLeftPoint:

- (void) setFrameTopLeftPoint: (NSPoint)aPoint;

setFrameUsingName:

- (BOOL) setFrameUsingName: (NSString*)name;

setHidesOnDeactivate:

- (void) setHidesOnDeactivate: (BOOL)flag;

setInitialFirstResponder:

- (void) setInitialFirstResponder: (NSView*)aView;

setInterfaceStyle:

- (void) setInterfaceStyle: (NSInterfaceStyle)interfaceStyle;

setLevel:

- (void) setLevel: (int)newLevel;

setMaxSize:

- (void) setMaxSize: (NSSize)aSize;

setMiniwindowImage:

- (void) setMiniwindowImage: (NSImage*)anImage;

setMiniwindowTitle:

- (void) setMiniwindowTitle: (NSString*)aString;

setMinSize:

- (void) setMinSize: (NSSize)aSize;

setOneShot:

- (void) setOneShot: (BOOL)flag;

setReleasedWhenClosed:

- (void) setReleasedWhenClosed: (BOOL)flag;

setRepresentedFilename:

- (void) setRepresentedFilename: (NSString*)path;

setResizeIncrements:

- (void) setResizeIncrements: (NSSize)increments;

setTitle:

- (void) setTitle: (NSString*)aString;

Sets the window's title to the string aString.


setTitleWithRepresentedFilename:

- (void) setTitleWithRepresentedFilename: (NSString*)path;

setViewsNeedDisplay:

- (void) setViewsNeedDisplay: (BOOL)flag;

setWindowController:

- (void) setWindowController: (NSWindowController*)windowController;

stringWithSavedFrame

- (NSString*) stringWithSavedFrame;

styleMask

- (unsigned int) styleMask;

title

- (NSString*) title;

Returns an NSString containing the text of the window's title.


tryToPerform:

- (BOOL) tryToPerform: (SEL)anAction;

unregisterDraggedTypes

- (void) unregisterDraggedTypes;

update

- (void) update;

useOptimizedDrawing:

- (void) useOptimizedDrawing: (BOOL)flag;

validRequestorForSendType:returnType:

- (id) validRequestorForSendType: (NSString*)sendType returnType: (NSString*)returnType;

viewsNeedDisplay

- (BOOL) viewsNeedDisplay;

windowController

- (id) windowController;

windowHandle

- (void*) windowHandle;

windowNumber

- (int) windowNumber;

worksWhenModal

- (BOOL) worksWhenModal;

zoom:

- (void) zoom: (id)sender;