Up

NSWindow

Authors

Scott Christley( scottc@net-community.com )
Felipe A. Rodriguez( far@ix.netcom.com )
Richard Frith-Macdonald( richard@brainstorm.co.uk )
The window class

Copyright: (C) 1996 Free Software Foundation, Inc.


Contents -

  1. NSWindow
  2. Software documentation for the NSObject(NSWindowDelegate) informal protocol
  3. Software documentation for the NSWindow(GNUstepBackend) category
  4. Software documentation for the NSWindow(GNUstepTextView) category

NSWindow

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:.

NSWindow : NSResponder

Declared in:
AppKit/NSWindow.h
Conforms to:
NSCoding
Standards:

Method summary

contentRectForFrameRect:styleMask:

+ (NSRect) contentRectForFrameRect: (NSRect)aRect styleMask: (unsigned int)aStyle;

Description forthcoming.


defaultDepthLimit

+ (NSWindowDepth) defaultDepthLimit;

Description forthcoming.


frameRectForContentRect:styleMask:

+ (NSRect) frameRectForContentRect: (NSRect)aRect styleMask: (unsigned int)aStyle;

Description forthcoming.


menuChanged:

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

Description forthcoming.


minFrameWidthWithTitle:styleMask:

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

Description forthcoming.


removeFrameUsingName:

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

Description forthcoming.


acceptsMouseMovedEvents

- (BOOL) acceptsMouseMovedEvents;

Description forthcoming.


alphaValue

- (float) alphaValue;

Description forthcoming.


animationResizeTime:

- (NSTimeInterval) animationResizeTime: (NSRect)newFrame;

Description forthcoming.


areCursorRectsEnabled

- (BOOL) areCursorRectsEnabled;

Description forthcoming.


aspectRatio

- (NSSize) aspectRatio;

Description forthcoming.


backgroundColor

- (NSColor*) backgroundColor;

Description forthcoming.


backingType

- (NSBackingStoreType) backingType;

Description forthcoming.


becomeKeyWindow

- (void) becomeKeyWindow;

Description forthcoming.


becomeMainWindow

- (void) becomeMainWindow;

Description forthcoming.


cacheImageInRect:

- (void) cacheImageInRect: (NSRect)aRect;

Description forthcoming.


canBecomeKeyWindow

- (BOOL) canBecomeKeyWindow;

Returns YES if the receiver can be made key. If this method returns NO, the window will not be made key. This implementation returns YES if the window is resizable or has a title bar. You can override this method to change it's behavior


canBecomeMainWindow

- (BOOL) canBecomeMainWindow;

Returns YES if the receiver can be the main window. If this method returns NO, the window will not become the main window. This implementation returns YES if the window is resizable or has a title bar and is visible and is not an NSPanel. You can override this method to change it's behavior


canHide

- (BOOL) canHide;

Description forthcoming.


canStoreColor

- (BOOL) canStoreColor;

Description forthcoming.


cascadeTopLeftFromPoint:

- (NSPoint) cascadeTopLeftFromPoint: (NSPoint)topLeftPoint;

Description forthcoming.


center

- (void) center;

Description forthcoming.


close

- (void) close;

Description forthcoming.


constrainFrameRect:toScreen:

- (NSRect) constrainFrameRect: (NSRect)frameRect toScreen: (id)screen;

Description forthcoming.


contentView

- (id) contentView;

Description forthcoming.


convertBaseToScreen:

- (NSPoint) convertBaseToScreen: (NSPoint)basePoint;

Description forthcoming.


convertScreenToBase:

- (NSPoint) convertScreenToBase: (NSPoint)screenPoint;

Description forthcoming.


counterpart

- (NSWindow*) counterpart;

Description forthcoming.


currentEvent

- (NSEvent*) currentEvent;

Description forthcoming.


dataWithEPSInsideRect:

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

Description forthcoming.


dataWithPDFInsideRect:

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

Description forthcoming.


deepestScreen

- (NSScreen*) deepestScreen;

Returns the screen the window is on. Unlike (apparently) OpenStep and MacOSX, GNUstep does not support windows being split across multiple screens


defaultButtonCell

- (NSButtonCell*) defaultButtonCell;

Description forthcoming.


delegate

- (id) delegate;

Description forthcoming.


deminiaturize:

- (void) deminiaturize: (id)sender;

Causes the window to deminiaturize. Normally you would not call this method directly. A window is automatically deminiaturized by the user via a mouse cloick event.


depthLimit

- (NSWindowDepth) depthLimit;

Description forthcoming.


deviceDescription

- (NSDictionary*) deviceDescription;

Description forthcoming.


disableCursorRects

- (void) disableCursorRects;

Description forthcoming.


disableFlushWindow

- (void) disableFlushWindow;

Description forthcoming.


disableKeyEquivalentForDefaultButtonCell

- (void) disableKeyEquivalentForDefaultButtonCell;

Description forthcoming.


discardCachedImage

- (void) discardCachedImage;

Description forthcoming.


discardCursorRects

- (void) discardCursorRects;

Description forthcoming.


discardEventsMatchingMask:beforeEvent:

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

Description forthcoming.


display

- (void) display;

Description forthcoming.


displayIfNeeded

- (void) displayIfNeeded;

Description forthcoming.


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

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

Description forthcoming.


drawers

- (NSArray*) drawers;

Description forthcoming.


enableCursorRects

- (void) enableCursorRects;

Description forthcoming.


enableFlushWindow

- (void) enableFlushWindow;

Description forthcoming.


enableKeyEquivalentForDefaultButtonCell

- (void) enableKeyEquivalentForDefaultButtonCell;

Description forthcoming.


endEditingFor:

- (void) endEditingFor: (id)anObject;

Description forthcoming.


fax:

- (void) fax: (id)sender;

Description forthcoming.


fieldEditor:forObject:

- (NSText*) fieldEditor: (BOOL)createFlag forObject: (id)anObject;

Description forthcoming.


firstResponder

- (NSResponder*) firstResponder;

Description forthcoming.


flushWindow

- (void) flushWindow;

Flush all drawing in the windows buffer to the screen unless the window is not buffered or flushing is not enabled.


flushWindowIfNeeded

- (void) flushWindowIfNeeded;

Description forthcoming.


frame

- (NSRect) frame;

Description forthcoming.


frameAutosaveName

- (NSString*) frameAutosaveName;

Description forthcoming.


gState

- (int) gState;

Description forthcoming.


hasDynamicDepthLimit

- (BOOL) hasDynamicDepthLimit;

Description forthcoming.


hasShadow

- (BOOL) hasShadow;

Description forthcoming.


hidesOnDeactivate

- (BOOL) hidesOnDeactivate;

Description forthcoming.


initWithContentRect:styleMask:backing:defer:

- (id) initWithContentRect: (NSRect)contentRect styleMask: (unsigned int)aStyle backing: (NSBackingStoreType)bufferingType defer: (BOOL)flag;

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)aStyle 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.


initWithWindowRef:

- (NSWindow*) initWithWindowRef: (void*)windowRef;

Description forthcoming.


initialFirstResponder

- (NSView*) initialFirstResponder;

Description forthcoming.


invalidateCursorRectsForView:

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

Description forthcoming.


isAutodisplay

- (BOOL) isAutodisplay;

Description forthcoming.


isDocumentEdited

- (BOOL) isDocumentEdited;

Description forthcoming.


isExcludedFromWindowsMenu

- (BOOL) isExcludedFromWindowsMenu;

Description forthcoming.


isFlushWindowDisabled

- (BOOL) isFlushWindowDisabled;

Description forthcoming.


isKeyWindow

- (BOOL) isKeyWindow;

Description forthcoming.


isMainWindow

- (BOOL) isMainWindow;

Description forthcoming.


isMiniaturized

- (BOOL) isMiniaturized;

Description forthcoming.


isOneShot

- (BOOL) isOneShot;

Description forthcoming.


isOpaque

- (BOOL) isOpaque;

Description forthcoming.


isReleasedWhenClosed

- (BOOL) isReleasedWhenClosed;

Description forthcoming.


isVisible

- (BOOL) isVisible;

Description forthcoming.


keyDown:

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

Description forthcoming.


keyViewSelectionDirection

- (NSSelectionDirection) keyViewSelectionDirection;

Description forthcoming.


level

- (int) level;

Description forthcoming.


makeFirstResponder:

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

Description forthcoming.


makeKeyAndOrderFront:

- (void) makeKeyAndOrderFront: (id)sender;

Description forthcoming.


makeKeyWindow

- (void) makeKeyWindow;

Description forthcoming.


makeMainWindow

- (void) makeMainWindow;

Description forthcoming.


maxSize

- (NSSize) maxSize;

Description forthcoming.


minSize

- (NSSize) minSize;

Description forthcoming.


miniaturize:

- (void) miniaturize: (id)sender;

Causes the window to miniaturize, that is the window is removed from the screen and it's counterpart (mini)window is displayed.


miniwindowImage

- (NSImage*) miniwindowImage;

Description forthcoming.


miniwindowTitle

- (NSString*) miniwindowTitle;

Description forthcoming.


mouseLocationOutsideOfEventStream

- (NSPoint) mouseLocationOutsideOfEventStream;

Description forthcoming.


nextEventMatchingMask:

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

Description forthcoming.


nextEventMatchingMask:untilDate:inMode:dequeue:

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

Description forthcoming.


orderBack:

- (void) orderBack: (id)sender;

Description forthcoming.


orderFront:

- (void) orderFront: (id)sender;

Description forthcoming.


orderFrontRegardless

- (void) orderFrontRegardless;

Description forthcoming.


orderOut:

- (void) orderOut: (id)sender;

Description forthcoming.


orderWindow:relativeTo:

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

Description forthcoming.


performClose:

- (void) performClose: (id)sender;

Description forthcoming.


performMiniaturize:

- (void) performMiniaturize: (id)sender;

Miniaturize the receiver... as long as its style mask includes NSMiniaturizableWindowMask (and as long as the receiver is not an icon or mini window itsself). Calls -miniaturize to do this.
Beeps if the window can't be miniaturised.
Should ideally provide visual feedback (highlighting the miniaturize button as if it had been clicked) first... but that's not yet implemented.


performZoom:

- (void) performZoom: (id)sender;

Description forthcoming.


postEvent:atStart:

- (void) postEvent: (NSEvent*)event atStart: (BOOL)flag;

Description forthcoming.


print:

- (void) print: (id)sender;

Description forthcoming.


registerForDraggedTypes:

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

Description forthcoming.


representedFilename

- (NSString*) representedFilename;

Description forthcoming.


resetCursorRects

- (void) resetCursorRects;

Description forthcoming.


resignKeyWindow

- (void) resignKeyWindow;

Description forthcoming.


resignMainWindow

- (void) resignMainWindow;

Description forthcoming.


resizeFlags

- (int) resizeFlags;

Description forthcoming.


resizeIncrements

- (NSSize) resizeIncrements;

Description forthcoming.


restoreCachedImage

- (void) restoreCachedImage;

Description forthcoming.


runToolbarCustomizationPalette:

- (void) runToolbarCustomizationPalette: (id)sender;

Description forthcoming.


saveFrameUsingName:

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

Description forthcoming.


screen

- (NSScreen*) screen;

Returns the screen the window is on.


selectKeyViewFollowingView:

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

Description forthcoming.


selectKeyViewPrecedingView:

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

Description forthcoming.


selectNextKeyView:

- (void) selectNextKeyView: (id)sender;

Description forthcoming.


selectPreviousKeyView:

- (void) selectPreviousKeyView: (id)sender;

Description forthcoming.


sendEvent:

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

Handles mouse and other events sent to the received by NSApplication. Do not invoke this method directly.


setAcceptsMouseMovedEvents:

- (void) setAcceptsMouseMovedEvents: (BOOL)flag;

Description forthcoming.


setAlphaValue:

- (void) setAlphaValue: (float)windowAlpha;

Description forthcoming.


setAspectRatio:

- (void) setAspectRatio: (NSSize)ratio;

Description forthcoming.


setAutodisplay:

- (void) setAutodisplay: (BOOL)flag;

Description forthcoming.


setBackgroundColor:

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

Description forthcoming.


setBackingType:

- (void) setBackingType: (NSBackingStoreType)type;

Description forthcoming.


setCanHide:

- (void) setCanHide: (BOOL)flag;

Description forthcoming.


setContentSize:

- (void) setContentSize: (NSSize)aSize;

Description forthcoming.


setContentView:

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

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


setDefaultButtonCell:

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

Description forthcoming.


setDelegate:

- (void) setDelegate: (id)anObject;

Description forthcoming.


setDepthLimit:

- (void) setDepthLimit: (NSWindowDepth)limit;

Description forthcoming.


setDocumentEdited:

- (void) setDocumentEdited: (BOOL)flag;

Description forthcoming.


setDynamicDepthLimit:

- (void) setDynamicDepthLimit: (BOOL)flag;

Description forthcoming.


setExcludedFromWindowsMenu:

- (void) setExcludedFromWindowsMenu: (BOOL)flag;

Description forthcoming.


setFrame:display:

- (void) setFrame: (NSRect)frameRect display: (BOOL)flag;

Description forthcoming.


setFrame:display:animate:

- (void) setFrame: (NSRect)frameRect display: (BOOL)displayFlag animate: (BOOL)animationFlag;

Description forthcoming.


setFrameAutosaveName:

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

Description forthcoming.


setFrameFromString:

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

Description forthcoming.


setFrameOrigin:

- (void) setFrameOrigin: (NSPoint)aPoint;

Description forthcoming.


setFrameTopLeftPoint:

- (void) setFrameTopLeftPoint: (NSPoint)aPoint;

Description forthcoming.


setFrameUsingName:

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

Description forthcoming.


setFrameUsingName:force:

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

Description forthcoming.


setHasShadow:

- (void) setHasShadow: (BOOL)hasShadow;

Description forthcoming.


setHidesOnDeactivate:

- (void) setHidesOnDeactivate: (BOOL)flag;

Description forthcoming.


setInitialFirstResponder:

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

Description forthcoming.


setLevel:

- (void) setLevel: (int)newLevel;

Description forthcoming.


setMaxSize:

- (void) setMaxSize: (NSSize)aSize;

Description forthcoming.


setMinSize:

- (void) setMinSize: (NSSize)aSize;

Description forthcoming.


setMiniwindowImage:

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

Description forthcoming.


setMiniwindowTitle:

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

Description forthcoming.


setOneShot:

- (void) setOneShot: (BOOL)flag;

Description forthcoming.


setOpaque:

- (void) setOpaque: (BOOL)isOpaque;

Description forthcoming.


setReleasedWhenClosed:

- (void) setReleasedWhenClosed: (BOOL)flag;

Description forthcoming.


setRepresentedFilename:

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

Description forthcoming.


setResizeIncrements:

- (void) setResizeIncrements: (NSSize)aSize;

Description forthcoming.


setShowsResizeIndicator:

- (void) setShowsResizeIndicator: (BOOL)show;

Description forthcoming.


setTitle:

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

Sets the window's title to the string aString.


setTitleWithRepresentedFilename:

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

Description forthcoming.


setToolbar:

- (void) setToolbar: (NSToolbar*)toolbar;

Description forthcoming.


setViewsNeedDisplay:

- (void) setViewsNeedDisplay: (BOOL)flag;

Description forthcoming.


setWindowController:

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

Description forthcoming.


showsResizeIndicator

- (BOOL) showsResizeIndicator;

Description forthcoming.


stringWithSavedFrame

- (NSString*) stringWithSavedFrame;

Description forthcoming.


styleMask

- (unsigned int) styleMask;

Description forthcoming.


title

- (NSString*) title;

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


toggleToolbarShown:

- (void) toggleToolbarShown: (id)sender;

Description forthcoming.


toolbar

- (NSToolbar*) toolbar;

Description forthcoming.


tryToPerform:with:

- (BOOL) tryToPerform: (SEL)anAction with: (id)anObject;

Description forthcoming.


unregisterDraggedTypes

- (void) unregisterDraggedTypes;

Description forthcoming.


update

- (void) update;

Description forthcoming.


useOptimizedDrawing:

- (void) useOptimizedDrawing: (BOOL)flag;

Description forthcoming.


validRequestorForSendType:returnType:

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

Description forthcoming.


viewsNeedDisplay

- (BOOL) viewsNeedDisplay;

Description forthcoming.


windowController

- (id) windowController;

Description forthcoming.


windowHandle

- (void*) windowHandle;

Description forthcoming.


windowNumber

- (int) windowNumber;

Description forthcoming.


windowRef

- (void*) windowRef;

Description forthcoming.


worksWhenModal

- (BOOL) worksWhenModal;

Description forthcoming.


zoom:

- (void) zoom: (id)sender;

Description forthcoming.


Software documentation for the NSObject(NSWindowDelegate) informal protocol

NSObject(NSWindowDelegate)

Declared in:
AppKit/NSWindow.h
Standards:

Description forthcoming.

Method summary

windowDidBecomeKey:

- (void) windowDidBecomeKey: (NSNotification*)aNotification;

Description forthcoming.


windowDidBecomeMain:

- (void) windowDidBecomeMain: (NSNotification*)aNotification;

Description forthcoming.


windowDidChangeScreen:

- (void) windowDidChangeScreen: (NSNotification*)aNotification;

Description forthcoming.


windowDidDeminiaturize:

- (void) windowDidDeminiaturize: (NSNotification*)aNotification;

Description forthcoming.


windowDidExpose:

- (void) windowDidExpose: (NSNotification*)aNotification;

Description forthcoming.


windowDidMiniaturize:

- (void) windowDidMiniaturize: (NSNotification*)aNotification;

Description forthcoming.


windowDidMove:

- (void) windowDidMove: (NSNotification*)aNotification;

Description forthcoming.


windowDidResignKey:

- (void) windowDidResignKey: (NSNotification*)aNotification;

Description forthcoming.


windowDidResignMain:

- (void) windowDidResignMain: (NSNotification*)aNotification;

Description forthcoming.


windowDidResize:

- (void) windowDidResize: (NSNotification*)aNotification;

Description forthcoming.


windowDidUpdate:

- (void) windowDidUpdate: (NSNotification*)aNotification;

Description forthcoming.


windowShouldClose:

- (BOOL) windowShouldClose: (id)sender;

Description forthcoming.


windowShouldZoom:toFrame:

- (BOOL) windowShouldZoom: (NSWindow*)sender toFrame: (NSRect)aFrame;

Description forthcoming.


windowWillClose:

- (void) windowWillClose: (NSNotification*)aNotification;

Description forthcoming.


windowWillMiniaturize:

- (void) windowWillMiniaturize: (NSNotification*)aNotification;

Description forthcoming.


windowWillMove:

- (void) windowWillMove: (NSNotification*)aNotification;

Description forthcoming.


windowWillResize:toSize:

- (NSSize) windowWillResize: (NSWindow*)sender toSize: (NSSize)frameSize;

Description forthcoming.


windowWillReturnFieldEditor:toObject:

- (id) windowWillReturnFieldEditor: (NSWindow*)sender toObject: (id)client;

Description forthcoming.


windowWillUseStandardFrame:defaultFrame:

- (NSRect) windowWillUseStandardFrame: (NSWindow*)sender defaultFrame: (NSRect)aFrame;

Description forthcoming.


Software documentation for the NSWindow(GNUstepBackend) category

NSWindow(GNUstepBackend)

Declared in:
AppKit/NSWindow.h
Standards:

Description forthcoming.

Method summary

_captureMouse:

- (void) _captureMouse: (id)sender;

Description forthcoming.


_initDefaults

- (void) _initDefaults;

Description forthcoming.


_releaseMouse:

- (void) _releaseMouse: (id)sender;

Description forthcoming.


_setVisible:

- (void) _setVisible: (BOOL)flag;

Description forthcoming.


Software documentation for the NSWindow(GNUstepTextView) category

NSWindow(GNUstepTextView)

Declared in:
AppKit/NSWindow.h
Standards:

Description forthcoming.

Method summary

_futureFirstResponder

- (id) _futureFirstResponder;

Description forthcoming.



Up