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:
.
Returns the NSWindow's content view.
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
.
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
.
Sets the window's content view to aView, replacing any previous content view.
Sets the window's title to the string aString.
Returns an NSString containing the text of the window's title.