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.

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

Description forthcoming.



Instance Variables for NSWindow Class

_alphaValue

@private float _alphaValue;

Description forthcoming.


_autosaveName

@private NSString* _autosaveName;

Description forthcoming.


_backgroundColor

@private NSColor* _backgroundColor;

Description forthcoming.


_backingType

@private NSBackingStoreType _backingType;

Description forthcoming.


_cachedImage

@private NSCachedImageRep* _cachedImage;

Description forthcoming.


_cachedImageOrigin

@private NSPoint _cachedImageOrigin;

Description forthcoming.


_contentView

@private id _contentView;

Description forthcoming.


_counterpart

@private int _counterpart;

Description forthcoming.


_defaultButtonCell

@private id _defaultButtonCell;

Description forthcoming.


_delegate

@private id _delegate;

Description forthcoming.


_depthLimit

@private NSWindowDepth _depthLimit;

Description forthcoming.


_disableFlushWindow

@private unsigned int _disableFlushWindow;

Description forthcoming.


_f

@private struct GSWindowFlagsType _f;

Description forthcoming.


_fieldEditor

@private id _fieldEditor;

Description forthcoming.


_firstResponder

@private id _firstResponder;

Description forthcoming.


_frame

@private NSRect _frame;

Description forthcoming.


_futureFirstResponder

@private id _futureFirstResponder;

Description forthcoming.


_gstate

@private int _gstate;

Description forthcoming.


_increments

@private NSSize _increments;

Description forthcoming.


_initialFirstResponder

@private NSView* _initialFirstResponder;

Description forthcoming.


_lastDragOperationMask

@private int _lastDragOperationMask;

Description forthcoming.


_lastDragView

@private id _lastDragView;

Description forthcoming.


_lastPoint

@private NSPoint _lastPoint;

Description forthcoming.


_lastView

@private id _lastView;

Description forthcoming.


_maximumSize

@private NSSize _maximumSize;

Description forthcoming.


_miniaturizedImage

@private NSImage* _miniaturizedImage;

Description forthcoming.


_miniaturizedTitle

@private NSString* _miniaturizedTitle;

Description forthcoming.


_minimumSize

@private NSSize _minimumSize;

Description forthcoming.


_rectNeedingFlush

@private NSRect _rectNeedingFlush;

Description forthcoming.


_rectsBeingDrawn

@private NSMutableArray* _rectsBeingDrawn;

Description forthcoming.


_representedFilename

@private NSString* _representedFilename;

Description forthcoming.


_reserved_1

@private void* _reserved_1;

Description forthcoming.


_reserved_2

@private void* _reserved_2;

Description forthcoming.


_reserved_s

@private void* _reserved_s;

Description forthcoming.


_screen

@private NSScreen* _screen;

Description forthcoming.


_selectionDirection

@private NSSelectionDirection _selectionDirection;

Description forthcoming.


_styleMask

@private unsigned int _styleMask;

Description forthcoming.


_toolbar

@private NSToolbar* _toolbar;

Description forthcoming.


_toolbarView

@private id _toolbarView;

Description forthcoming.


_windowController

@private NSWindowController* _windowController;

Description forthcoming.


_windowLevel

@private int _windowLevel;

Description forthcoming.


_windowNum

@private int _windowNum;

Description forthcoming.


_windowTitle

@private NSString* _windowTitle;

Description forthcoming.


_wv

@private id _wv;

Description forthcoming.





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: (NSScreen*)screen;

Given a proposed frame rectangle, return a modified version which will fit inside the screen .


contentView 

- (id) contentView;

Description forthcoming.


convertBaseToScreen: 

- (NSPoint) convertBaseToScreen: (NSPoint)aPoint;

Convert from a point in the base coordinate system for the window to a point in the screen coordinate system.


convertScreenToBase: 

- (NSPoint) convertScreenToBase: (NSPoint)aPoint;

Convert from a point in the screen coordinate system to a point in the screen coordinate system of the receiver.


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 click event. Does nothing it the window isn't miniaturized.


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: 

- (id) 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. Does nothing if the window can't be miniaturized (eg. because it's already miniaturized).


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;

Orders the window to the back of its level. Equivalent to -orderWindow: NSWindowBelow relativeTo: 0.


orderFront: 

- (void) orderFront: (id)sender;

If the application is active, orders the window to the front in its level. If the application is not active, the window is ordered in as far forward as possible in its level without being ordered in front of the key or main window of the currently active app. The current key and main window status is not changed. Equivalent to -orderWindow: NSWindowAbove relativeTo: 0.


orderFrontRegardless 

- (void) orderFrontRegardless;

Orders the window to the front in its level (even in front of the key and main windows of the current app) regardless of whether the app is current or not. This method should only be used in rare cases where the app is cooperating with another app that is displaying data for it. The current key and main window status is not changed.


orderOut: 

- (void) orderOut: (id)sender;

Orders the window out from the screen. Equivalent to -orderWindow: NSWindowOut relativeTo: 0.


orderWindow: relativeTo: 

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

If place is NSWindowOut, removes the window from the screen. If place is NSWindowAbove, places the window directly above otherWin, or directly above all windows in its level if otherWin is 0. If place is NSWindowBelow, places the window directly below otherWin, or directly below all windows in its level if otherWin is 0.

If place is NSWindowAbove or NSWindowBelow and the application is hidden, the application is unhidden.



Up