Copyright ©1995 by NeXT Computer, Inc.  All Rights Reserved.

Window



Inherits From: Responder : Object
Declared In: appkit/Window.h



Class Description

The Window class defines objects that manage and coordinate the windows that an application displays on the screen.  A single Window object corresponds to, at most, one window.  The two principle functions of a Window are to provide an area in which Views can be placed, and to accept and distribute, to the appropriate Views, events that the user instigates through actions on the mouse and keyboard.



Rectangles, Views, and the View Hierarchy

A Window is defined by a frame rectangle that encloses the entire window, including its title bar, resize bar, and border, and by a content rectangle that encloses just its content area.  Both rectangles are specified in the screen coordinate system.  The frame rectangle establishes the Window's base coordinate system.  This coordinate system is always aligned with and is measured in the same increments as the screen coordinate system (in other words, the base coordinate system can't be rotated or scaled).  The origin of a base coordinate system is the bottom left corner of the Window's frame rectangle.

You create a Window (through one of the init:... methods) by specifying, among other attributes, the size and location of its content rectangle.  The frame rectangle is derived from the dimensions of the content rectangle.

When it's created, a Window automatically creates two Views:  an opaque frame view that fills the frame rectangle and draws the border, title bar, resize bar, and background, and a transparent content view that fills the content area.  The frame view is a private object that your application can't access directly.  The content view is the "highest" accessible View in the Window; you can replace the content view with a View of your own creation through Window's setContentView: method.

You add other Views to the Window by declaring each to be a subview of the content view, or a subview of one of the content view's subviews, and so on, through View's addSubview: method.  This tree of Views is called the Window's view hierarchy. When a Window is told to display itself, it does so by sending View-displaying messages to each object in its view hierarchy. Because displaying is carried out in a determined order, the content view (which is drawn first) may be wholly or partially obscured by its subviews, and these subviews may be obscured by their subviews (and so on).



Event Handling

Mouse and keyboard events that are directed at a Window are automatically forwarded to the object, however, a Window receives keyboard events only if it's the key window.  If the event affects the Window directly--resizing or moving it, for example--the Window performs the appropriate operation itself and sends messages to its delegate informing it of its intentions, thus allowing your application to intercede.  Events that are directed at specific Views within the Window are forwarded by the Window to the View.

The Window keeps track of the object that was last selected to handle keyboard events as its first responder.  The first responder is typically the View that displays the current selection.  In addition to keyboard events, the first responder is sent action messages that have a user-selected target (a nil target in program code).  The Window continually updates the first responder in response to the user's mouse actions.

Each Window provides a field editor, a Text object that handles small-scale text-editing chores.  The field editor can be used by the Window's first responder to edit the text that it displays.  The getFieldEditor:for: method returns a Window's field editor.



Instance Variables

NXRect frame;

id contentView;

id delegate;

id firstResponder;

id lastLeftHit;

id lastRightHit;

id counterpart;

id fieldEditor;

int winEventMask;

int windowNum;

float backgroundGray;

struct _wFlags{
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;

} wFlags;

struct _wFlags2{
unsigned int  deferred:1;
unsigned int  docEdited:1;
unsigned int  dynamicDepthLimit:1;

} wFlags2;


frame The Window's frame rectangle in screen coordinates.
contentView The View that fills the Window's content area.
delegate The object that receives notification messages.
firstResponder The Responder object that receives keyboard events and untargeted action messages sent to the Window.
lastLeftHit The View in the Window's view hierarchy that most recently received a left mouse-down event.
lastRightHit The View in the Window's view hierarchy that most recently received a right mouse-down event.
counterpart The Window's miniwindow, or, if the Window is a miniwindow, the Window it stands for.
fieldEditor The Text object that displays and edits text for the   Window.
winEventMask The events the Window can receive from the Window Server.
windowNum An integer that identifies the Window Server window device that corresponds to this Window.
backgroundGray The shade of gray that fills the Window's background.
wFlags.style The style of Window; whether it's plain, titled, a miniwindow, or has a frame suitable for a menu.
wFlags.backing The type of backing for the on-screen display; whether the Window is retained, nonretained, or buffered.
wFlags.buttonMask A mask that indicates whether the Window has a close button and miniaturize button.
wFlags.visible True if the Window is on-screen (if it's in the screen list).
wFlags.isMainWindow True if the Window is the main window.
wFlags.isKeyWindow True if the Window is the key window.
wFlags.isPanel True if the Window is a Panel.
wFlags.hideOnDeactivate True if the Window should be removed from the screen when the application is deactivated.
wFlags.dontFreeWhenClosed True if the Window is not to be freed when closed.
wFlags.oneShot True if the Window Server should free the window device for this object when the Window is removed from the screen.
wFlags2.deferred True if the Window Server shouldn't create a window device for this object until it's placed on-screen.
wFlags2.docEdited True if the close button indicates that a displayed document has been edited but not saved.
wFlags2.dynamicDepthLimit True if the Window has a depth limit that can change to match the depth of the screen.



Method Types

Initializing a new Window instance
init
initContent:style:backing:buttonMask:defer:
initContent:style:backing:buttonMask:
defer:screen:
Freeing a Window object free
Computing frame and content rectangles
+ getFrameRect:forContentRect:style:
+ getContentRect:forFrameRect:style:
+ minFrameWidth:forStyle:buttonMask:
Accessing the frame rectangle getFrame:
getFrame:andScreen:
setFrameUsingName:
saveFrameUsingName:
+ removeFrameUsingName:
setFrameAutosaveName:
frameAutosaveName
setFrameFromString:
saveFrameToString:
Accessing the content view setContentView:
contentView
Querying Window attributes windowNum
buttonMask
style
worksWhenModal
Window graphics setTitle:
setTitleAsFilename:
title
setBackgroundColor:
backgroundColor
setBackgroundGray:
backgroundGray
Window device attributes setBackingType:
backingType
setOneShot:
isOneShot
setFreeWhenClosed:
The miniwindow counterpart
setMiniwindowIcon:
setMiniwindowImage:
setMiniwindowTitle:
miniwindowIcon
miniwindowImage
miniwindowTitle
The field editor endEditingFor:
getFieldEditor:for:
Window status makeKeyWindow
makeKeyAndOrderFront:
becomeKeyWindow
isKeyWindow
resignKeyWindow
canBecomeKeyWindow
becomeMainWindow
isMainWindow
resignMainWindow
canBecomeMainWindow
Moving and resizing moveTo::
moveTo::screen:
moveTopLeftTo::
moveTopLeftTo::screen:
dragFrom::eventNum:
constrainFrameRect:toScreen:
placeWindow:
placeWindow:screen:
placeWindowAndDisplay:
sizeWindow::
setMinSize:
setMaxSize:
getMinSize:
getMaxSize:
resizeFlags
center
Ordering on and off screen makeKeyAndOrderFront:
orderFront:
orderBack:
orderOut:
orderWindow:relativeTo:
orderFrontRegardless
isVisible
setHideOnDeactivate:
doesHideOnDeactivate
Converting coordinates convertBaseToScreen:
convertScreenToBase:
Managing display display
displayIfNeeded
disableDisplay
isDisplayEnabled
reenableDisplay
flushWindow
flushWindowIfNeeded
disableFlushWindow
reenableFlushWindow
isFlushWindowDisabled
displayBorder
useOptimizedDrawing:
update
Screens and Window depths screen
bestScreen
+ defaultDepthLimit
setDepthLimit:
depthLimit
setDynamicDepthLimit:
hasDynamicDepthLimit
canStoreColor
Graphics state objects gState
Cursor management addCursorRect:cursor:forView:
removeCursorRect:cursor:forView:
invalidateCursorRectsForView:
disableCursorRects
enableCursorRects
discardCursorRects
resetCursorRects
Handling user actions and events
close
performClose:
miniaturize:
performMiniaturize:
deminiaturize:
setDocEdited:
isDocEdited
windowExposed:
windowMoved:
screenChanged:
Setting the event mask setEventMask:
addToEventMask:
removeFromEventMask:
eventMask
Aiding event handling getMouseLocation:
setTrackingRect:inside:owner:tag:left:right:
discardTrackingRect:
makeFirstResponder:
firstResponder
sendEvent:
rightMouseDown:
commandKey:
tryToPerform:with:
setAvoidsActivation:
avoidsActivation
Dragging registerForDraggedTypes:count:
unregisterDraggedTypes
dragImage:at:offset:event:pasteboard:source:slideBack:
Services and Windows menu support
validRequestorForSendType:andReturnType:
setExcludedFromWindowsMenu:
isExcludedFromWindowsMenu
Assigning a delegate setDelegate:
delegate
Printing printPSCode:
smartPrintPSCode:
faxPSCode:
smartFaxPSCode:
openSpoolFile:
spoolFile:
copyPSCodeInside:to:
knowsPagesFirst:last:
getRect:forPage:
placePrintRect:offset:
heightAdjustLimit
widthAdjustLimit
beginPSOutput
endPSOutput
beginPrologueBBox:creationDate:
createdBy:fonts:forWhom:pages:title:
endHeaderComments
endPrologue
beginSetup
endSetup
beginPage:label:bBox:fonts:
endPage
beginPageSetupRect:placement:
endPageSetup
beginTrailer
endTrailer
Archiving read:
write:
awake



Class Methods

defaultDepthLimit
+ (NXWindowDepth)defaultDepthLimit

Returns the default depth limit for instances of Window.  This will be the smaller of:

The depth of the deepest display device available to the Window Server.
The depth set for the application by the NXWindowDepthLimit parameter.

The value returned will be one of these NXWindowDepth values:

NX_TwoBitGrayDepth
NX_EightBitGrayDepth
NX_TwelveBitRGBDepth
NX_TwentyFourBitRGBDepth

See also:  setDepthLimit:, setDynamicDepthLimit:, canStoreColor



getContentRect:forFrameRect:style:
+ getContentRect:(NXRect *)content
forFrameRect:(const NXRect *)frame
style:(int)aStyle

Calculates and returns, in content, the content rectangle for a Window with the given frame rectangle and style.  Both content and frame are in screen coordinates.  See the style method for a list of acceptable style values.  Returns self.

See also:  + getFrameRect:forContentRect:style:



getFrameRect:forContentRect:style:
+ getFrameRect:(NXRect *)frame
forContentRect:(const NXRect *)content
style:(int)aStyle

Calculates and returns, in frame, the frame rectangle for a Window with the given content rectangle and style.  Both frame and content are in screen coordinates.  See the style method for a list of acceptable style values.  Returns self.

See also:  + getContentRect:forFrameRect:style:



minFrameWidth:forStyle:buttonMask:
+ (NXCoord)minFrameWidth:(const char *)aTitle
forStyle:(int)aStyle
buttonMask:(int)aMask

Returns the minimum width that a Window's frame rectangle must have for it to display all of aTitle, given the specified style and button mask.  See the style and buttonMask methods for lists of acceptable style and button mask values.



removeFrameUsingName:
+ (void)removeFrameUsingName:(const char *)name

Removes the frame data named name from the application's defaults.

See also:  setFrameUsingName:, setFrameAutosaveName:



Instance Methods

addCursorRect:cursor:forView:
addCursorRect:(const NXRect *)aRect
cursor:anObject
forView:aView

Adds the rectangle specified by aRect to the Window's list of cursor rectangles and returns selfaRect, which is taken in the Window's base coordinate system, must lie within the Window's content rectangle.  If it doesn't, the cursor rectangle isn't added and nil is returned.

You typically add cursor rectangles to View objects (through View's addCursorRect:cursor: method) rather than to Windows.

See also:  addCursorRect:cursor: (View)



addToEventMask:
(int)addToEventMask:(int)newEvents

Adds newEvents to the Window's current event mask and returns the original event mask.   This method is typically used when an object sets up a modal event loop to respond to certain events.  The return value should be used to restore the Window's original event mask when the modal loop done.  See setEventMask: for a list of event mask constants.

See also:  setEventMask:, eventMask, removeFromEventMask:



avoidsActivation
(BOOL)avoidsActivation

Returns YES if the Window's application doesn't become active when the user clicks in the Window's content area.  The default is NO.  Note that clicking on the title bar will always activate the Window's application.

See also:  setAvoidsActivation:



awake
awake

You never invoke this method directly; it's invoked automatically after the Window has been read from an archive file.

See also:  read:



backgroundColor
(NXColor)backgroundColor

Returns the color of the Window's background when the object is displayed on a color screen.  The default is the color equivalent of NX_LTGRAY.

See also:  setBackgroundColor:, setBackgroundGray:



backgroundGray
(float)backgroundGray

Returns the shade of gray of the Window's background when the object is displayed on a monochrome screen.  The default is NX_LTGRAY.

See also:  setBackgroundGray:, setBackgroundColor:



backingType
(int)backingType

Returns the Window's backing type as one of the following constants:

NX_BUFFERED
NX_RETAINED
NX_NONRETAINED

See also:  setBackingType:



becomeKeyWindow
becomeKeyWindow

You never invoke this method; it's invoked automatically when the Window becomes the key window.  The method sends becomeKeyWindow to the Window's first responder, and sends windowDidBecomeKey: to the Window's delegate (if the respective objects can respond).  Returns self.

See also:  makeKeyWindow, makeKeyAndOrderFront:



becomeMainWindow
becomeMainWindow

You never invoke this method; it's invoked automatically when the Window becomes the main window.  The method sends windowDidBecomeMain: to the Window's delegate (if the delegate can respond).  Returns self.

See also:  makeKeyWindow, makeKeyAndOrderFront:



beginPage:label:bBox:fonts:
beginPage:(int)ordinalNum
label:(const char *)aString
bBox:(const NXRect *)pageRect
fonts:(const char *)fontNames

Writes a PostScript page separator by forwarding the beginPage:... message to the Window's frame view.  You never invoke this method directly; it's invoked automatically when printing or faxing the Window.

See also:  beginPage:labelbBox:fonts: (View)



beginPageSetupRect:placement:
beginPageSetupRect:(const NXRect *)aRect
placement:(const NXPoint *)location

Writes the start of a PostScript page-setup section by forwarding the beginPageSetupRect:placement: message to the Window's frame view.  You never invoke this method directly; it's invoked automatically when printing or faxing the Window.

See also:  beginPageSetupRect:placement: (View)



beginPrologueBBox:creationDate:createdBy:fonts:
forWhom:pages:title:
beginPrologueBBox:(const NXRect *)boundingBox
creationDate:(const char *)dateCreated
createdBy:(const char *)anApplication
fonts:(const char *)fontNames
forWhom:(const char *)user
pages:(int)numPages
title:(const char *)aTitle

Writes the start of a PostScript prolog section by forwarding the beginPrologueBbox:... message to the Window's frame view. You never invoke this method directly; it's invoked automatically when printing or faxing the Window.

See also:  beginPrologueBBox:.. (View)



beginPSOutput
beginPSOutput

Prepares the Window (and the application environment) for printing or faxing by forwarding the beginPSOutput message to the Window's frame view.  You never invoke this method directly; it's invoked automatically when printing or faxing the Window.

See also:  beginPSOutput (View)



beginSetup
beginSetup

Writes the start of a PostScript document-setup section by forwarding the beginSetup message to the Window's frame view. You never invoke this method directly; it's invoked automatically when printing or faxing the Window.

See also:  beginSetup (View)



beginTrailer
beginTrailer

Writes the start of a PostScript document-trailer section by forwarding the beginTrailer message to the Window's frame view. You never invoke this method directly; it's invoked automatically when printing or faxing the Window.

See also:  beginTrailer (View)



bestScreen
(const NXScreen *)bestScreen

Returns a pointer to the deepest screen that the Window is on, or NULL if the Window is currently off-screen.

See also:  screen, colorScreen (Application)



buttonMask
(int)buttonMask

Returns a mask that indicates which buttons appear in the Window's title bar.  The return value may include one or both of these constants:

NX_CLOSEBUTTONMASK
NX_MINIATURIZEBUTTONMASK

The button mask is set when the Window is initialized and is, thereafter, immutable.

See also:  initContent:style:backing:buttonMask:defer:screen:



canBecomeKeyWindow
(BOOL)canBecomeKeyWindow

Returns YES if the Window can be made the key window, and NO if it can't.  This method is consulted when the Window tries to become the key window; the attempt is thwarted if this method returns NO.

See also:  isKeyWindow, makeKeyWindow



canBecomeMainWindow
(BOOL)canBecomeMainWindow

Returns YES if the Window can be made the main window, and NO if it can't.  This method is consulted when the Window tries to become the main window; the attempt is thwarted if this method returns NO.

See also:  isMainWindow, makeKeyWindow



canStoreColor
(BOOL)canStoreColor

Returns YES if the Window has a depth limit that allows it to store color values, and NO if it doesn't.

See also:  depthLimit, shouldDrawColor (View)



center
center

Moves the Window to the center of the screen:  The Window is placed dead-center horizontally and placed somewhat above center vertically.  Such a placement is consider to carry a certain immediacy and importance, visually.  You typically use this method to place a Window--most likely an attention Panel--where the user can't miss it.  This method is invoked automatically when a Panel is placed on the screen by Application's runModalFor: method.  Returns self.



close
close

Removes the Window from the screen.  If the Window is set to be freed when it's closed (the default), a free message is sent to the object (but note that the message isn't sent until the current event is completed).

Normally, this method is invoked by the Application Kit when the user clicks the Window's close button.  Note that this method doesn't cause windowWillClose: to be sent to the Window's delegate (the message is sent when the user clicks the close button).  You can induce an invocation of the delegate method by simulating the user's action through the performClose: method.

Returns nil.

See also:  performClose:, setFreeWhenClosed:



commandKey:
(BOOL)commandKey:(NXEvent *)theEvent

Responds to the Command key-down event passed as theEvent.  You never invoke this method directly; the Application object, upon receiving a Command key-down event, sends a commandKey: message to each Window in the Window list until one of them returns YES (signifying that the event was recognized and handled).  The default implementation of this method returns NO--instances of Window can't handle these events.  (By contrast, Panels can.)

You can create your own subclass of Window that responds to Command key-down events.  A typical subclass implementation of this method passes a performKeyEquivalent: message down the view hierarchy:

- (BOOL)commandKey:(NXEvent *)theEvent
{
if ( [contentView performKeyEquivalent:theEvent] )
return YES;
else
return NO;
}

See also:  performKeyEquivalent: (View), commandKey: (Panel)



constrainFrameRect:toScreen:
(BOOL)constrainFrameRect:(NXRect *)theFrame
toScreen:(const NXScreen *)screen

Modifies the rectangle pointed to by theFrame such that its top edge lies on the given screen.  If the Window is resizable, the rectangle's height is adjusted to bring the bottom edge onto the screen as well.  The rectangle's width and horizontal location are unaffected.  You shouldn't need to invoke this method yourself; it's invoked automatically (and the modified frame is used to locate and set the size of the Window) whenever a titled Window is placed on-screen or resized through sizeWindow::.

You can override this method to prevent a particular Window from being constrained, or to constrain it differently.  The unconstrained frame rectangle is pointed to by theFrame; the screen it wants to lie on is pointed to by screen.  If your method modifies the rectangle, it should return YES; otherwise, it should return NO.



contentView
contentView

Returns the Window's content view, the highest accessible View object in the Window's view hierarchy.

See also:  setContentView:



convertBaseToScreen:
convertBaseToScreen:(NXPoint *)aPoint

Converts the point referred to by aPoint from the Window's base coordinate system to the screen coordinate system.  Returns self.

See also:  convertScreenToBase:



convertScreenToBase:
convertScreenToBase:(NXPoint *)aPoint

Converts the point referred to by aPoint from the screen coordinate system to the Window's base coordinate system.  Returns self.

See also:  convertBaseToScreen:



copyPSCodeInside:to:
copyPSCodeInside:(const NXRect *)rect to:(NXStream *)stream

Generates PostScript code, in the manner of printPSCode:, for all the Views located inside the rect portion of the Window. The rectangle is specified in the Window's base coordinates.  The PostScript code is written to stream.

Returns self (unless an exception is raised).

See also:  printPSCode:, faxPSCode:



counterpart
counterpart

Returns the Window's miniwindow or, if this Window is a miniwindow, the Window that it represents.  You can't set a Window's counterpart directly; a corresponding miniwindow is created automatically the first time the Window is miniaturized. If the Window has not yet been miniaturized, this method will return nil.

See also:  setMiniwindowImage:, setMiniwindowTitle:



delegate
delegate

Returns the Window's delegate, or nil if it doesn't have one.

See also:  setDelegate:



deminiaturize:
deminiaturize:sender

Deminiaturizes the Window (which should be a miniwindow).  You rarely need to invoke this method; it's invoked automatically when a Window is deminiaturized by the user (by double-clicking a miniwindow, or by choosing the Arrange in Front item in the Windows menu).  However, if you feel compelled to deminiaturize a Window programmatically, you should note that the deminiaturize message is sent to the miniwindow, not the original Window.  The value passed as sender is ignored.  Returns self.

See also:  miniaturize:



depthLimit
(NXWindowDepth)depthLimit

Returns the depth limit of the Window as one of the following values:

NX_DefaultDepth
NX_TwoBitGrayDepth
NX_EightBitGrayDepth
NX_TwelveBitRGBDepth
NX_TwentyFourBitRGBDepth

If the return value is NX_DefaultDepth, you can find out the actual depth limit by sending the Window class a defaultDepthLimit message.

See also:  + defaultDepthLimit, setDepthLimit:, setDynamicDepthLimit:



disableCursorRects
disableCursorRects

Disables all cursor rectangle management within the Window.  Typically this method is used when you need to do some special cursor manipulation, and you don't want the Application Kit interfering.  Returns self.

See also:  enableCursorRects



disableDisplay
disableDisplay

Disables View's display methods, thus preventing the Views in the Window's view hierarchy from being displayed (note, however, that this doesn't disable Window's display method).  This permits you to alter or update the Views before displaying them again.

Displaying should be disabled only temporarily.  Each disableDisplay message should be paired with a subsequent reenableDisplay message.  Pairs of these messages can be nested; drawing won't be reenabled until the last (unnested) reenableDisplay message is sent or until a display message is sent to the Window.

Returns self.

See also:  reenableDisplay, isDisplayEnabled, display, display::: (View)



disableFlushWindow
disableFlushWindow

Disables the flushWindow method for the Window.  If the Window is a buffered window, drawing won't automatically be flushed to the screen by the display methods defined in the View class.  This permits several Views to be displayed before the results are shown to the user.

Flushing should be disabled only temporarily, while the Window's display is being updated.  Each disableFlushWindow message should be paired with a subsequent reenableFlushWindow message.  Message pairs can be nested; flushing won't be reenabled until the last (unnested) reenableFlushWindow message is sent.

Returns self.

See also:  reenableFlushWindow, flushWindow, disableDisplay



discardCursorRects
discardCursorRects

Removes all cursor rectangles from the Window, and returns self.  This method is invoked by resetCursorRects to remove existing cursor rectangles before resetting them.  In general, you wouldn't invoke it in the code you write, but might want to override it to change its behavior.

See also:  resetCursorRects



discardTrackingRect:
discardTrackingRect:(int)trackNum

Removes the tracking rectangle identified by trackNum and returns self.  The tag was assigned when the tracking rectangle was created.

See also:  setTrackingRect:inside:owner:tag:left:right:



display
display

Passes a display message down the Window's view hierarchy, thus redrawing all Views within the Window, including the border, resize bar, and title bar.  If displaying is disabled for the Window, this method reenables it.  Returns self.

See also:  display (View), disableDisplay, displayIfNeeded



displayBorder
displayBorder

Redraws the Window's border, title bar, and resize bar, and returns self.  You rarely need to invoke this method yourself; a Window's border is automatically displayed when any of the elements therein are changed--when the Window is resized or its title is changed, for example.

See also:  display



displayIfNeeded
displayIfNeeded

Sends a displayIfNeeded message down the Window's view hierarchy, thus redrawing all Views that need to be displayed, including the Window's border, title bar, and resize bar.  This method is useful when you want to disable displaying in the Window, modify some number of Views, and then display only the ones that were modified.  Note that this method, unlike display, doesn't reenable display if it's currently disabled.  Returns self.

See also:  display, displayIfNeeded (View), setNeedsDisplay: (View), update (View)



doesHideOnDeactivate
(BOOL)doesHideOnDeactivate

Returns YES if the Window will be removed from the screen when its application is deactivated, and NO if it will remain on-screen.

See also:  setHideOnDeactivate:



dragFrom::eventNum:
dragFrom:(float)x
:(float)y
eventNum:(int)num

Lets the user drag a Window from a location other than the title bar.

Warning: This method has nothing to do with the image-dragging mechanism provided by the dragImage:... method and related protocols.
Normally, a Window can only be dragged by its title bar (if it has one).  To provide some other draggable area in the Window, you design a View that invokes this method when it receives a mouse-down event. The first two arguments, (x, y), give the cursor's location in base coordinates.  The third argument, num, is the event number for the mouse-down event.  All three arguments should be taken from the mouse-down event record.  The following example shows an implementation of mouseDown: that would allow the user to drag the Window by clicking anywhere in the View:

mouseDown:(NXEvent *)theEvent
{
[window dragFrom:theEvent->location.x :theEvent->location.y
eventNum:theEvent->data.mouse.eventNum];
return self;
}

The dragging itself is performed as usual:  The View that invoked this method won't receive the subsequent mouse-dragged and mouse-up events, they're intercepted and applied directly to change the Window's location.

Returns self.

See also:  moveTo::



dragImage:at:offset:event:pasteboard:source:slideBack:
dragImage:anImage
at:(NXPoint *)location
offset:(NXPoint *)initialOffset
event:(NXEvent *)event
pasteboard:(Pasteboard *)pboard
source:sourceObject
slideBack:(BOOL)slideFlag

Instigates an image-dragging session.  You never invoke this method directly from your application; it can only be invoked from within a View's implementation of the mouseDown: method.  Furthermore, View also implements the dragImage:... method; you typically instigate an image-dragging session by sending this message to a View, rather than a Window.  The two methods are identical except for the interpretation of the location argument:  In Window's implementation, location is taken in the base coordinate system.  See the description of this method in the View class for the meanings of the other  arguments.

See also:  dragImage:at:offset:event:pasteboard:source:slideBack: (View)



enableCursorRects
enableCursorRects

Reenables cursor rectangle management.  Returns self.

See also:  disableCursorRects



endEditingFor:
endEditingFor:anObject

Prepares the Window's field editor for a new editing assignment and returns self.  The argument is ignored by Window's default implementation.

If the field editor is the first responder, it resigns that status, passing it to the Window (even if the field editor refuses to resign). This forces a textDidEnd:endChar: message to be sent to the field editor's delegate.  The field editor is then removed from the view hierarchy and its delegate is set to nil.

To conditionally end editing, first try to make the Window the first responder:

if ([myWindow makeFirstResponder:myWindow]) {
[myWindow endEditingFor:nil];
. . .
}

This is the preferred way to verify all fields when an OK button is pressed in a panel, for example.

See also:  getFieldEditor:for:



endHeaderComments
endHeaderComments

Writes the end of a PostScript comment section by forwarding the endHeaderComments message to the Window's frame view.  You never invoke this method directly; it's invoked automatically when printing or faxing the Window.

See also:  endHeaderComments (View)



endPage
endPage

Writes the end of a PostScript page separator by forwarding the endPage message to the Window's frame view.  You never invoke this method directly; it's invoked automatically when printing or faxing the Window.

See also:  endPage (View)



endPageSetup
endPageSetup

Writes the end of a PostScript page-setup section by forwarding the endPageSetup message to the Window's frame view.  You never invoke this method directly; it's invoked automatically when printing or faxing the Window.

See also:  endPageSetup (View)



endPrologue
endPrologue

Writes the end of a PostScript prolog section by forwarding the endPrologue message to the Window's frame view.  You never invoke this method directly; it's invoked automatically when printing or faxing the Window.

See also:  endPrologue (View)



endPSOutput
endPSOutput

Declares that printing or faxing is finished by forwarding the endPSOutput to the Window's frame view.  You never invoke this method directly; it's invoked automatically when printing or faxing the Window.

See also:  endPSOutput (View)



endSetup
endSetup

Writes the end of a PostScript document-setup section by forwarding the endSetup message to the Window's frame view.  You never invoke this method directly; it's invoked automatically when printing or faxing the Window.

See also:  endSetup (View)



endTrailer
endTrailer

Writes the end of a PostScript document-trailer section by forwarding the endTrailer message to the Window's frame view. You never invoke this method directly; it's invoked automatically when printing or faxing the Window.

See also:  endTrailer (View)



eventMask
(int)eventMask

Returns the current event mask for the Window.  See setEventMask: for a list of the possible contents of the mask.

See also:  setEventMask:, addToEventMask:, removeFromEventMask:



faxPSCode:
faxPSCode:sender

Prints the Window (all the Views in its view hierarchy including the frame view) to a fax modem.  A return value of nil indicates that there were errors in generating the PostScript code or that the user canceled the job.

In the current user interface, faxing is initiated from within the Print panel.  However, with this method, you can provide users with an independent control for faxing a Window.

This method normally brings up the Fax panel before actually beginning printing.  But if sender implements a shouldRunPrintPanel: method, that method will be invoked to first query whether to run the panel.  If shouldRunPrintPanel: returns NO, the Fax panel won't be displayed, and the Window will be printed using the previous settings of the panel.

See also:  smartFaxPSCode:, printPSCode:, shouldRunPrintPanel: (Object Additions)



firstResponder
firstResponder

Returns the Window's first responder.

See also:  makeFirstResponder:, acceptsFirstResponder (Responder)



flushWindow
flushWindow

if the Window is buffered and flushing hasn't been disabled by disableFlushWindow, this flushes the off-screen buffer to the screen.  This method is automatically invoked when you send a display message to a Window or View.  However, it has no effect if the display is being directed to a printer or other device, rather than to the screen.  Returns self.

See also:  display:: (View), disableFlushWindow



flushWindowIfNeeded
flushWindowIfNeeded

Flushes the Window's off-screen buffer to the screen, provided that:

The Window is a buffered window
Flushing isn't currently disabled
Some previous flushWindow messages had no effect because flushing was disabled

You should use this method, rather than flushWindow, to flush a Window after flushing has been reenabled.  Returns self.

See also:  flushWindow, disableFlushWindow, reenableFlushWindow



frameAutosaveName
(const char *)frameAutosaveName

Returns the name that's used to automatically save the Window's frame rectangle data in the defaults system, as set through setFrameAutosaveName:.  If the Window has an autosave name, it's frame data is written as a default whenever the frame rectangle changes.

See also:  setFrameAutosaveName:



free
free

Deallocates memory for the Window object and all that it surveys.  This includes the Views  in its view hierarchy, its instance variables (including the field editor), and the Window Server window device that it's associated with.



getFieldEditor:for:
getFieldEditor:(BOOL)flag for:anObject

Returns the field editor, the Window's communal Text object.  The field editor is provided as a convenience and can be used however your application sees fit.  Typically, the field editor is used by simple text-bearing objects--for example, a TextField object uses its Window's field editor to display and manipulate text.  The field editor can be shared by any number of objects and so its state may be constantly changing.  Therefore, it shouldn't be used to display text that demands sophisticated Text object preparation (for this you should create a dedicated Text object).

A freshly created Window doesn't have a field editor; the only way to create a field editor is to invoke this method with a flag value of YES.  After a field editor has been created for a Window, the flag argument is ignored.

The Window's delegate can supply the object that this method returns as the return value of the windowWillReturnFieldEditor:toObject: delegate message (the Window is passed as the  first argument, anObject is passed as the second).  However, note the following:

If the Window's delegate is anObject, windowWillReturnFieldEditor:toObject: isn't sent.
The object returned by the delegate method doesn't become the Window's field editor.

If this method returns a non-nil value, it should be followed by an invocation of Window's endEditingFor: method before the field editor is actually used.

See also:  endEditingFor:



getFrame:
getFrame:(NXRect *)theRect

Returns the Window's frame rectangle by reference in theRect and returns self.  The frame rectangle is always reckoned in the screen coordinate system.

See also:  getFrame:andScreen:



getFrame:andScreen:
getFrame:(NXRect *)theRect andScreen:(const NXScreen **)theScreen

Copies the Window's frame rectangle into the structure referred to by theRect.  A pointer to the screen where the Window is located is provided in the variable referred to by theScreen.  The frame rectangle is specified relative to the lower left corner of the screen.  However, if theScreen is NULL, the frame rectangle is specified in absolute coordinates (relative to the origin of the screen coordinate system).  Returns self.

See also:  getFrame:



getMaxSize:
getMaxSize:(NXSize *)aSize

Returns, by reference in aSize, an NXSize structure that gives the maximum size to which the Window's frame can be sized by the user or by the setFrame:... methods.  Note that this constraint doesn't apply to sizeWindow:: or the placeWindow:... methods.

See also:  setMaxSize:, setMinSize:, getMinSize:



getMinSize:
getMinSize:(NXSize *)aSize

Returns, by reference in aSize, an NXSize structure that gives the minimum size to which the Window's frame can be sized by the user or by the setFrame:... methods.  Note that this constraint doesn't apply to sizeWindow:: or the placeWindow:... methods.

See also:  setMinSize:, setMaxSize:, getMaxSize:



getMouseLocation:
getMouseLocation:(NXPoint *)thePoint

Returns, by reference in thePoint, the current location of the mouse reckoned in the Window's base coordinate system.  Returns self.

See also:  currentEvent (Application)



getRect:forPage:
(BOOL)getRect:(NXRect *)theRect forPage:(int)page

Implemented by subclasses to provide the rectangle to be printed for page number page.  A Window receives getRect:forPage: messages when it's being printed (or faxed) if its knowsPagesFirst:last: method returns YES.

If page is a valid page number for the Window, this method should return YES after providing (in the variable referred to by theRect) the rectangle that represents the page requested.  The rectangle should be specified in the Window's base coordinates.

If page is not a valid page number, this method should return NO.  By default, it returns NO.

The Window may receive a series of getRect:forPage: messages, one for each page that's being printed.  It shouldn't assume that the pages will be generated in any particular order.

See also:  knowsPagesFirst:last:, printPSCode:



gState
(int)gState

Returns the PostScript graphics state object associated with the Window.



hasDynamicDepthLimit
(BOOL)hasDynamicDepthLimit

Returns YES if the Window's depth limit can change to match the depth of the screen it's on, and NO if it can't.

See also:  setDynamicDepthLimit:



heightAdjustLimit
(float)heightAdjustLimit

Returns the fraction of a page that can be pushed onto the next page to prevent items from being cut in half.  The limit applies to vertical pagination.  By default, it's 0.2.

You never invoke this method directly; it's invoked during automatic pagination when printing (or faxing) the Window. However, you can override it to return a different value.  The value returned should lie between 0.0 and 1.0 inclusive.

See also:  widthAdjustLimit



init
init

Initializes the receiver, a newly allocated Window object, by passing default values to the initContent:style:backing:buttonMask:defer: method.  The initialized object is a plain, buffered window, and has a default frame rectangle.  Returns self.

See also:  initContent:style:backing:buttonMask:defer:



initContent:style:backing:buttonMask:defer:
initContent:(const NXRect *)contentRect
style:(int)aStyle
backing:(int)backingType
buttonMask:(int)mask
defer:(BOOL)flag

Initializes the Window object and returns self.  This method is the designated initializer for the Window class.

The first argument, contentRect, specifies the location and size of the Window's content area in screen coordinates.  If a NULL pointer is passed for this argument, a default rectangle is used.

The second argument, aStyle, specifies the Window's style.  It can be:

NX_PLAINSTYLE
NX_TITLEDSTYLE
NX_RESIZEBARSTYLE
NX_MENUSTYLE
NX_MINIWINDOWSTYLE
NX_MINIWORLDSTYLE
NX_TOKENSTYLE

You usually only create titled and resizable Windows.  Menu style is used by the Menu class; miniwindows, miniworld icons, and tokens (application icons) are created for you by the Application Kit.  Plain Windows lack interface accouterments and should very rarely be created and displayed.

The third argument, backingType, specifies how the drawing done in the Window is buffered by the object's window device:

NX_BUFFERED
NX_RETAINED
NX_NONRETAINED

The fourth argument, mask, specifies whether the Window's title bar will sport a close or resize button.  You build the mask by joining (with the bitwise OR operator) the individual masks for the buttons:

NX_CLOSEBUTTONMASK
NX_MINIATURIZEBUTTONMASK

The fifth argument, flag, determines whether the Window Server will create a window device for the new object immediately. If flag is YES, it will defer creating the window until the Window is ordered on-screen.  All display messages sent to the Window or its Views will be postponed until the window is created, just before it's moved on-screen.  Deferring the creation of the window improves launch time and minimizes the virtual memory load on the Server.

The Window creates an instance of View to be its default content view.  You can replace it with your own object by using the setContentView: method.

See also:  orderFront:, setTitle:, setOneShot:



initContent:style:backing:buttonMask:defer:screen:
initContent:(const NXRect *)contentRect
style:(int)aStyle
backing:(int)bufferingType
buttonMask:(int)mask
defer:(BOOL)flag
screen:(const NXScreen *)aScreen

Initializes the Window object and returns self.  This method is equivalent to initContent:style:backing:buttonMask:defer:, except that the content rectangle is specified relative to the lower left corner of aScreen.

If aScreen is NULL, the content rectangle is interpreted relative to the lower left corner of the main screen.  The main screen is the one that contains the current key window, or, if there is no key window, the one that contains the main menu.  If there's neither a key window nor a main menu (if there's no active application), the main screen is the one where the origin of the screen coordinate system is located.

See also:  initContent:style:backing:buttonMask:defer:



invalidateCursorRectsForView:
invalidateCursorRectsForView:aView

Marks the Window as having invalid cursor rectangles.  If the Window is the key window, the Application object will send it a resetCursorRects message to have it fix its cursor rectangles before getting the next event.  If the Window isn't the key window, it will receive the message when it next becomes the key window.  Returns self.

See also:  resetCursorRects



isDisplayEnabled
(BOOL)isDisplayEnabled

Returns YES if the display mechanism is currently disabled (because of a previous disableDisplay message), and NO if it isn't.

See also:  disableDisplay, reenableDisplay, display::: (View)



isDocEdited
(BOOL)isDocEdited

Returns YES if the Window's document has been edited, otherwise returns NO.

See also:  setDocEdited:



isExcludedFromWindowsMenu
(BOOL)isExcludedFromWindowsMenu

Returns YES if the Window is excluded from the application's Windows menu, and NO if it isn't.

See also:  setExcludedFromWindowsMenu:



isFlushWindowDisabled
(BOOL)isFlushWindowDisabled

Returns YES if the Window's flushing ability has been disabled; otherwise returns NO.

See also:  disableFlushWindow, reenableFlushWindow



isKeyWindow
(BOOL)isKeyWindow

Returns YES if the Window is the key window for the application, and NO if it isn't.

See also:  isMainWindow



isMainWindow
(BOOL)isMainWindow

Returns YES if the Window is the main window for the application, and NO if it isn't.

See also:  isKeyWindow



isOneShot
(BOOL)isOneShot

Returns YES if the window device that the Window manages is freed when it's removed from the screen list, and NO if not. The default is NO.

See also:  setOneShot:



isVisible
(BOOL)isVisible

Returns YES if the Window is on-screen (even if it's obscured by other Windows).

See also:  getVisibleRect: (View)



knowsPagesFirst:last:
(BOOL)knowsPagesFirst:(int *)firstPageNum last:(int *)lastPageNum

Implemented by subclasses to indicate whether the Window knows where its own pages lie.  This method is invoked when printing (or faxing) the Window.  Although it can be implemented in a Window subclass, it should not be used in program code.

If this method returns YES, the Window will receive getRect:forPage: messages querying it for the rectangles corresponding to specific pages.  If it returns NO, pagination will be done automatically.  By default, it returns NO.

Just before this method is invoked, the first page to be printed is set to 1 and the last page to be printed is set to the maximum integer size.  An implementation of this method can set firstPageNum to a different initial page (for example, a chapter may start on page 40), even if it returns NO.  If it returns YES, lastPageNum can be set to a different final page.  If it doesn't reset lastPageNum, the subclass implementation of getRect:forPage: must be able to signal that a page has been asked for beyond what is available in the document.

See also:  getRect:forPage:, printPSCode:



makeFirstResponder:
makeFirstResponder:aResponder

Makes aResponder the first receiver of keyboard events and action messages sent to the Window.  If aResponder isn't already the Window's first responder, this method first sends a resignFirstResponder message to the object that currently is, and a becomeFirstResponder message to aResponder.  However, if the old first responder refuses to resign, no changes are made.

The Application Kit uses this method to alter the first responder in response to mouse-down events; you can also use it to explicitly set the first responder from within your program.  aResponder should be a Responder object; typically, it's a View in the Window's view hierarchy.

If successful in making aResponder the first responder, this method returns self.  If not (if the old first responder refuses to resign), it returns nil.

See also:  becomeFirstResponder (Responder), resignFirstResponder (Responder)



makeKeyAndOrderFront:
makeKeyAndOrderFront:sender

Moves the Window to the front of the screen list (within its tier) and makes it the key window.  This method can be used in action message.  Returns self.

See also:  orderFront:, orderBack:, orderOut:, orderWindow:relativeTo:



makeKeyWindow
makeKeyWindow

Makes the Window object the key window, and returns self.

See also:  becomeKeyWindow, isKeyWindow



miniaturize:
miniaturize:sender

Removes the Window from the screen list and displays its miniwindow counterpart on-screen.  If the Window doesn't have a miniwindow counterpart, one is created.

A miniaturize: message is generated when the user clicks the miniaturize button in the Window's title bar.  This method has a sender argument so that it can be used in an action message from a Control.  It ignores this argument.  Returns self.

See also:  deminiaturize:



miniwindowIcon
(const char *)miniwindowIcon

Returns the name of the icon that's displayed in the Window's miniwindow.

See also:  setMiniwindowIcon:



miniwindowImage
(NXImage *)miniwindowImage

Returns the NXImage object that's displayed in the Window's miniwindow.

See also:  setMiniwindowImage:



miniwindowTitle
(const char *)miniwindowTitle

Returns the title that's displayed in the Window's miniwindow.

See also:  setMiniwindowTitle:



moveTo::
moveTo:(NXCoord)x :(NXCoord)y

Moves the Window by the lower left corner of its frame rectangle.  The arguments are taken in the screen coordinate system. Returns self.

See also:  dragFrom::eventNum:, moveTopLeftTo::



moveTo::screen:
moveTo:(NXCoord)x :(NXCoord)y screen:(const NXScreen *)aScreen

Repositions the Window so that its lower left corner lies at (x, y) relative to a coordinate origin at the lower left corner of aScreen.  If aScreen is NULL, this method is the same as moveTo::.  Returns self.



moveTopLeftTo::
moveTopLeftTo:(NXCoord)x :(NXCoord)y

Moves the Window by the top left corner of its frame rectangle.  The arguments are taken in the screen coordinate system. Returns self.

See also:  dragFrom::eventNum:, moveTo::



moveTopLeftTo::screen:
moveTopLeftTo:(NXCoord)x :(NXCoord)y screen:(const NXScreen *)aScreen

Repositions the Window so that its top left corner lies at (x, y) relative to a coordinate origin at the lower left corner of aScreen. If aScreen is NULL, this method is the same as moveTopLeftTo::.  Returns self.

See also:  moveTo::



openSpoolFile:
openSpoolFile:(char *)filename

Opens the filename file for print spooling.  This method is invoked when printing (or faxing) the Window; it shouldn't be used in program code.  However, you can override it to modify its behavior.

If filename is NULL or empty, PostScript code for the Window will be sent directly to the printing daemon, npd, without opening a file.  (However, if the Window is being previewed or saved, a default file is opened in /tmp.)

If a filename is provided, the file is opened.  The printing machinery will then write the PostScript code to that file and the file will be printed using lpr.

This method opens a Display PostScript context that will write to the spool file, and sets the context of the global PrintInfo object to this new context.  It returns nil if the file can't be opened.

See also:  printPSCode:



orderBack:
orderBack:sender

Moves the Window to the back of its tier in the screen list.  It may also change the key window and main window.  Returns self.

See also:  orderFront:, orderOut:, orderWindow:relativeTo:, makeKeyAndOrderFront:



orderFront:
orderFront:sender

Moves the Window to the front of its tier in the screen list.  It may also change the key window and main window.  Returns self.

See also:  orderBack:, orderOut:, orderWindow:relativeTo:, makeKeyAndOrderFront:



orderFrontRegardless
orderFrontRegardless

Moves the Window to the front of its tier, even if the Window's application isn't active.    Normally a Window can't be moved in front of the key window unless the Window and the key window are in the same application.  You should rarely need to invoke this method; it's designed to be used when applications are cooperating such that an active application (with the key window) is using another application to display data.

See also:  orderFront:



orderOut:
orderOut:sender

Takes the Window out of the screen list.  It may also change the key window and main window.  Returns self.

See also:  orderFront:, orderBack:, orderWindow:relativeTo:



orderWindow:relativeTo:
orderWindow:(int)place relativeTo:(int)otherWin

Repositions the Window's window device in the Window Server's screen list.  place can be one of:

NX_ABOVE
NX_BELOW
NX_OUT

If it's NX_OUT, the window is removed from the screen list and otherWin is ignored.  If it's NX_ABOVE or NX_BELOW, otherWin is the window number of the window that the receiving Window is to be placed above or below.  If otherWin is 0, the receiving Window will be placed above or below all other windows in its tier.  Returns self.

See also:  orderFront:, orderBack:, orderOut:, makeKeyAndOrderFront:



performClose:
performClose:sender

Simulates the user clicking the close button by momentarily highlighting the button and then closing the Window.  If the Window's delegate or the Window itself implements windowWillClose:, then that message is sent with the Window as the argument (only one such message is sent; if both the delegate and the Window implement the method, only the delegate will receive the message).

If the Window doesn't have a close button, then the method calls NXBeep().  Returns self.

See also:  performClick: (Button), close, performMiniaturize:



performMiniaturize:
performMiniaturize:sender

Simulates the user clicking the miniaturize button by momentarily highlighting the button then miniaturizing the Window.  If the Window doesn't have a miniaturize button, then this method calls NXBeep().  Returns self.

See also:  performClick: (Button), miniaturize:, performClose:



placePrintRect:offset:
placePrintRect:(const NXRect *)aRect offset:(NXPoint *)location

Determines the location of the rectangle being printed on the physical page.  You never invoke this method directly; it's automatically invoked when the Window is printed or faxed.  However, you can override it to change the way it places the rectangle.

aRect specifies the rectangle being printed on the current page; location is set by this method to be the offset of the rectangle from the lower left corner of the page.  All coordinates are in the base coordinate system (that of the page itself).

By default, if the flags for centering are YES in the global PrintInfo object, this method centers the rectangle within the margins. If the flags are NO, it abuts the rectangle against the top and left margins.

See also:  getRect:forPage:, printPSCode:



placeWindow:
placeWindow:(const NXRect *)frameRect

Resizes and moves the Window.  frameRect specifies the Window's new frame rectangle in screen coordinates.  The Window's frame view--but none of its other Views--is automatically redisplayed at its new size and location.  Returns self.

See also:  sizeWindow::, moveTo::, placeWindowAndDisplay:



placeWindow:screen:
placeWindow:(const NXRect *)frameRect screen:(const NXScreen *)aScreen

This is the same as placeWindow:, except that the frame rectangle is specified relative to a coordinate origin at the lower left corner of aScreen.  If aScreen is NULL, this method is exactly the same as placeWindow:.  Returns self.

See also:  placeWindow:, placeWindowAndDisplay:



placeWindowAndDisplay:
placeWindowAndDisplay:(const NXRect *)frameRect

This is the same as placeWindow:, except the Window's Views are redisplayed before the Window is shown.  Returns self.

See also:  placeWindow:



printPSCode:
printPSCode:sender

Prints the Window (all the Views in its view hierarchy including the frame view).  A return value of nil indicates that there were errors in generating the PostScript code or that the user canceled the job.

This method normally brings up the Print panel before actually beginning printing.  But if sender implements a shouldRunPrintPanel: method, that method will be invoked to first query whether to run the panel.  If shouldRunPrintPanel: returns NO, the Print panel won't be displayed, and the Window will be printed using the last settings of the panel.

See also:  smartPrintPSCode:, faxPSCode:, shouldRunPrintPanel: (Object Methods)



read:
read:(NXTypedStream *)stream

Reads the Window and its Views from the typed stream stream.

See also:  write:



reenableDisplay
reenableDisplay

Counters the effect of disableDisplay, reenabling View's display methods.  Returns self.

See also:  disableDisplay, isDisplayEnabled, display::: (View)



reenableFlushWindow
reenableFlushWindow

Reenables the flushWindow method for the Window after it was disabled through a previous disableFlushWindow message. Returns self.

See also:  disableFlushWindow, flushWindow



registerForDraggedTypes:count:
registerForDraggedTypes:(const char *const *)pbTypes count:(int)count

Registers the Pasteboard types that the Window will accept in an image-dragging session.   pbTypes is a pointer to an array of the types; count is the number of elements in the array.  Returns self.

Keep in mind that the values in the first argument are Pasteboard types, not file extensions (you can't register for specific file extensions).  For example, the following registers a Window as accepting files:

const char *fileType[] = {NXFilenamePboardType};
[aWindow registerForDraggedTypes:fileType count:1];

Note:  Registering a Window for dragged types automatically makes it a candidate destination object during a dragging session. As such, it must implement some or all of the NXDraggingDestination protocol methods.  As a convenience, Window provides default implementations of these methods (in general, the dragging destination methods are forwarded to the Window's delegate).  See the NXDraggingDestination protocol description for details.

See also:  unregisterDraggedTypes



removeCursorRect:cursor:forView:
removeCursorRect:(const NXRect *)aRect
cursor:anObj
forView:aView

Removes a cursor rectangle from the Window.  You never invoke this method; it's used by View's removeCursorRect:cursor: method.  To remove a cursor rectangle, use the View method.

See also:  removeCursorRect:cursor: (View), resetCursorRects (View)



removeFromEventMask:
(int)removeFromEventMask:(int)oldEvents

Removes the event types specified by oldEvents from the Window's event mask, and returns the old mask.

See also:  eventMask, setEventMask:, addToEventMask:



resetCursorRects
resetCursorRects

Removes all existing cursor rectangles from the Window, then recreates the cursor rectangles by sending a resetCursorRects message to every View in the Window's view hierarchy.  Returns self.

This method is typically invoked by the Application object when it detects that the key window's cursor rectangles are invalid. In program code, it's more efficient to invoke invalidateCursorRectsForView:, rather than this method, to fix invalid cursor rectangles.

See also:  invalidateCursorRectsForView:, resetCursorRects (View)



resignKeyWindow
resignKeyWindow

You never invoke this method; it's invoked automatically when the Window resigns key window status.  The method sends resignKeyWindow to the Window's first responder, and sends windowDidResignKey: to the Window's delegate (if the respective objects can respond).  Returns self.

See also:  becomeKeyWindow



resignMainWindow
resignMainWindow

You never invoke this method; it's invoked automatically when the Window resigns main window status.  The method sends windowDidResignMain: to the Window's delegate (if the delegate can respond).  Returns self.

See also:  becomeMainWindow



resizeFlags
(int)resizeFlags

Valid only while the Window is being resized, this method returns the flags field of the event record for the mouse-down event that initiated the resizing session.  The integer encodes, as a mask, information such as which of the modifier keys was held down when the event occurred.  The flags are listed in dpsclient/event.h.  Because of its limited validity, this method should only be invoked from within an implementation of the delegate methods windowWillResize:toSize: or windowDidResize:.



rightMouseDown:
rightMouseDown:(NXEvent *)theEvent

Responds to uncaught right mouse-down events by forwarding this message to the Application object.  By default, a right mouse-down event in a window causes the main menu to pop up under the cursor.  Returns the value returned by the Application object.

See also:  rightMouseDown: (Application)



saveFrameToString:
(void)saveFrameToString:(char *)string

Saves the Window's frame rectangle data as a NULL-terminated ASCII string to the buffer pointed to by string.  The string can be stored as you see fit and used later to set the dimensions of a Window through the setFrameFromString: method.  You should use the constant NX_MAXFRAMESTRINGLENGTH to allocate the buffer.

See also:  setFrameFromString:, saveFrameUsingName:



saveFrameUsingName:
(void)saveFrameUsingName:(const char *)name

Saves the Window's frame rectangle as a system default.  With the companion method setFrameUsingName:, you can save and reset a Window's frame over various launchings of an application.  The default is owned by the application, filed under the name

"Window Frame name"

See also:  setFrameUsingName:, saveFrameToString:



screen
(const NXScreen *)screen

Returns a pointer to the screen that the Window is on.  If the Window is partly on one screen and partly on another, the screen where most of it lies is the one returned.

See also:  bestScreen



screenChanged:
screenChanged:(NXEvent *)theEvent

Invoked when the user releases the Window, having moved all or part of it to a different screen.  This method sends the delegate a windowDidChangeScreen: message (if the delegate can respond) and  returns self.

If the Window has a dynamic depth limit, this method will make sure that the depth limit matches the new device.  If the Window is on more than one screen, its depth limit will be adjusted to match the deepest screen it's on.

See also:  bestScreen



sendEvent:
sendEvent:(NXEvent *)theEvent

Dispatches mouse and keyboard events sent to the Window by the Application object; you never invoke this method directly.



setAvoidsActivation:
setAvoidsActivation:(BOOL)flag

Establishes whether the Window's application will become the active application when the user clicks in the Window's content area.  If flag is YES, the application won't become active; if flag is NO, it will.  The default is NO.  Note that clicking on the title bar will always activate the Window's application.

See also:  avoidsActivation



setBackgroundColor:
setBackgroundColor:(NXColor)color

Sets the color that fills the Window's content area when the Window is displayed on a color screen.  Returns self.

See also:  backgroundColor



setBackgroundGray:
setBackgroundGray:(float)value

Sets the shade of gray that fills the Window's content area when the Window is displayed on a monochrome screen.  value should lie in the range 0.0 (black) to 1.0 (white).  Returns self.

See also:  backgroundGray, setBackgroundColor:



setBackingType:
setBackingType:(int)backing

Sets the type of backing used by the Window's window device and returns self.  This method can only be used to switch a buffered Window to retained or vice versa; you can't change the backing type of a nonretained Window (a PostScript error is generated if you attempt to do so).

See also:  backingType



setContentView:
setContentView:aView

Makes aView the Window's content view; the previous content view is removed from the Window's view hierarchy and returned by this method.  aView is resized to fit precisely within the content area of the Window.  You can transform the content view's coordinate system, but you can't alter its size or location directly.

See also:  contentView



setDelegate:
setDelegate:anObject

Makes anObject the Window's delegate, and returns self.  A Window's delegate is given a chance to respond to action messages that work their way up the responder chain to the Window (through Application's sendAction:to:from: method).  It can also respond to notification messages sent by the Window.

See also:  delegate, tryToPerform:with:, sendAction:to:from: (Application)



setDepthLimit:
setDepthLimit:(NXWindowDepth)limit

Sets the depth limit of the Window to limit, which should be one of the following enumerated values:

NX_TwoBitGrayDepth
NX_EightBitGrayDepth
NX_TwelveBitRGBDepth
NX_TwentyFourBitRGBDepth

Returns self.

See also:  depthLimit, + defaultDepthLimit, setDynamicDepthLimit:



setDocEdited:
setDocEdited:(BOOL)flag

Sets whether or not the document displayed in the Window has been edited but not saved.  If flag is YES, the Window's close button will display a broken "X" to indicate that the  document needs to be saved.  If flag is NO, the close button will be shown with a solid "X".  The default is NO.  Returns self.

See also:  isDocEdited



setDynamicDepthLimit:
setDynamicDepthLimit:(BOOL)flag

Sets whether the Window's depth limit should change to match the depth of the display device that it's on.  If flag is YES, the depth limit will depend on which screen the Window is on.  If flag is NO, the Window will have the default depth limit.  A different, and nondynamic, depth limit can be set with the setDepthLimit: method.  Returns self.

See also:  hasDynamicDepthLimit, + defaultDepthLimit, setDepthLimit:



setEventMask:
(int)setEventMask:(int)newMask

Assigns a new event mask to the Window; the original event mask is returned.  The mask tells the Window Server which types of events the Window wants to receive.  It's formed by joining the masks for individual events using the bitwise OR operator. The constants for individual event masks are listed below.  Those that are included in the default event mask for a Window are marked with an asterisk.

NX_LMOUSEDOWNMASK*
NX_LMOUSEUPMASK*
NX_RMOUSEDOWNMASK*
NX_RMOUSEUPMASK*
NX_MOUSEMOVEDMASK
NX_LMOUSEDRAGGEDMASK
NX_RMOUSEDRAGGEDMASK
NX_MOUSEENTEREDMASK*
NX_MOUSEEXITEDMASK*
NX_KEYDOWNMASK*
NX_KEYUPMASK*
NX_FLAGSCHANGEDMASK
NX_KITDEFINEDMASK*
NX_APPDEFINEDMASK*
NX_SYSDEFINEDMASK*
NX_CURSORUPDATEMASK
NX_TIMERMASK
NX_JOURNALEVENTMASK
NX_NULLEVENTMASK

Miniwindows and application icons have the same default event mask as other Windows, except that keyboard events are excluded.  The default mask for a Menu includes only left and right mouse-down, mouse-up, and mouse-dragged events and the kit-defined event.

See also:  eventMask, addToEventMask:, removeFromEventMask:



setExcludedFromWindowsMenu:
setExcludedFromWindowsMenu:(BOOL)flag

Sets whether the Window will be excluded from the Windows menu.  If flag is YES, it won't be listed in the menu.  If flag is NO, it will be listed when it or its miniwindow is on-screen.  The default is NO.  Returns self.

See also:  isExcludedFromWindowsMenu



setFrameAutosaveName:
(BOOL)setFrameAutosaveName:(const char *)name

Sets the name that's used to automatically save the Window's frame rectangle in the defaults system.  If name isn't NULL, the Window's frame is saved as a default (as described in saveFrameUsingName:) each time the frame changes.  Passing NULL as an argument turns off this automation.  A Window can have only one frame autosave name at a time; if the Window already has an autosave name, the old one is replaced.  If name is already being used as an autosave name by a Window in this application, the name isn't set and this method returns NO; otherwise returns YES.

See also:  setFrameUsingName:, + removeFrameUsingName:, saveFrameToString:, setFrameFromString:



setFrameFromString:
(void)setFrameFromString:(const char *)data

Sets the Window's frame rectangle by reading the frame rectangle data stored in data.  The data should have been previously stored through the saveFrameToString: method.  The frame is constrained according to the Window's minimum and maximum size settings.  This method causes a windowWillResize:toSize: message to be sent to the delegate.

See also:  saveFrameToString:



setFrameUsingName:
(BOOL)setFrameUsingName:(const char *)name

Sets the Window's frame rectangle by reading, from the defaults system, the rectangle data stored in name.  The frame is constrained according to the Window's minimum and maximum size settings.  This method causes a windowWillResize:toSize: message to be sent to the delegate.

If name doesn't exist, the frame isn't set and this method returns NO; otherwise returns YES.

See also:  setFrameAutosaveName:, + removeFrameUsingName:, saveFrameToString:, setFrameFromString:



setFreeWhenClosed:
setFreeWhenClosed:(BOOL)flag

Determines the Window's behavior when it receives a close message.  If flag is NO, the Window is just hidden (taken out of the screen list).  If flag is YES, the Window is hidden and then freed.  The default for Windows is YES; the default for Panels and Menus is NO.  Returns self.

See also:  close, free



setHideOnDeactivate:
setHideOnDeactivate:(BOOL)flag

Determines whether the Window will disappear when the application is inactive.  If flag is YES, the Window is hidden (taken out of the screen list) when the application stops being the active application.  If flag is NO, the Window stays on-screen.  The default for Windows is NO; the default for Panels and Menus is YES.  Returns self.

See also:  doesHideOnDeactivate:



setMaxSize:
setMaxSize:(const NXSize *)aSize

Sets the maximum size to which the user can resize the Window's frame rectangle.  Note that this constraint isn't enforced when the Window is resized through the sizeWindow:: or placeWindow... methods.  Returns self.

See also:  getMaxSize:, setMinSize:, getMinSize:



setMinSize:
setMinSize:(const NXSize *)aSize

Sets the minimum size to which the user can resize the Window's frame rectangle.  Note that this constraint isn't enforced when the Window is resized through the sizeWindow:: or placeWindow... methods.  Returns self.

See also:  getMaxSize:, setMinSize:, getMinSize:



setMiniwindowIcon:
setMiniwindowIcon:(const char *)name

Sets the image that's displayed by the Window's miniwindow.  The named icon is searched for using NXImage's findImageNamed: class method.  This method is guaranteed to work only if it's invoked from within an implementation of the windowWillMiniaturize:toMiniwindow: delegate method, or if the miniwindow is currently visible.

See also:  setMiniwindowImage:, miniwindowIcon



setMiniwindowImage:
setMiniwindowImage:image

Sets the image that's displayed by the Window's miniwindow.  The argument should be an NXImage object.  This method is guaranteed to work only if it's invoked from within an implementation of the windowWillMiniaturize:toMiniwindow: delegate method, or if the miniwindow is currently visible.

See also:  setMiniwindowIcon:, miniwindowImage



setMiniwindowTitle:
setMiniwindowTitle:(const char *)title

Sets the title of the Window's miniwindow.  Normally, the miniwindow's title is taken, often abbreviated, from that of the Window.  This method is guaranteed to work only if it's invoked from within an implementation of the windowWillMiniaturize:toMiniwindow: delegate method, or if the miniwindow is currently visible.  In the latter case, the miniwindow's title is automatically redisplayed.  Note that setting the Window's title (through setTitle: or setTitleAsFilename:) will automatically reset the miniwindow's title to that of the Window.

See also:  miniwindowTitle:, setTitle, setTitleAsFilename:



setOneShot:
setOneShot:(BOOL)flag

Sets whether the window device that the Window object manages should be freed when it's removed from the screen list (and another one created if it's returned to the screen).  This is appropriate behavior for Windows that the user might use once or twice but not display continually.  The default is NO.  Returns self.

See also:  isOneShot



setTitle:
setTitle:(const char *)aString

Sets the string that appears in the Window's title bar (if it has one).  This also sets the title of the Window's miniwindow.  The new title is automatically displayed.  Returns self.

See also:  title, setTitleAsFilename:, setMiniwindowTitle:



setTitleAsFilename:
setTitleAsFilename:(const char *)aString

Sets aString to be the title of the Window, but formats it as a pathname to a file.  The file name is displayed first, followed by an em dash and the directory path.  The em dash is offset by two spaces on either side.  For example:

MyFile  --  /Net/server/group/home

This method also sets the title of the Window's miniwindow.

Returns self.

See also:  title, setTitle:, setMiniwindowTitle:



setTrackingRect:inside:owner:tag:left:right:
setTrackingRect:(const NXRect *)aRect
inside:(BOOL)insideFlag
owner:anObject
tag:(int)trackNum
left:(BOOL)leftDown
right:(BOOL)rightDown

Sets up a tracking rectangle in the Window.  The arguments are:

aRect is a pointer to the tracking rectangle specified in the Window's coordinate system.
insideFlag is YES if the cursor starts off inside the rectangle, otherwise it's NO.
anObject is the object, usually a View or an NXCursor, that will handle the mouse-entered and mouse-exited events that are generated for the rectangle.
trackNum is a tag you assign to identify the rectangle.
If leftDown is YES, mouse-entered and mouse-exited events are generated only while the left mouse button is down.
If rightDown is YES, mouse events are generated only while the right button is down.

Returns self.

See also:  discardTrackingRect:



sizeWindow::
sizeWindow:(NXCoord)width :(NXCoord)height

Resizes the Window so that its content area has the specified width and height in base coordinates.  The lower left corner of the window remains constant.  Returns self.

See also:  placeWindow:



smartFaxPSCode:
smartFaxPSCode:sender

This does for faxing what smartPrintPSCode does for printing.  A return value of nil indicates that there were errors in generating the PostScript code or that the user canceled the job.

See also:  faxPSCode:, smartPrintPSCode:



smartPrintPSCode:
smartPrintPSCode:sender

Prints the Window (all the Views in its view hierarchy including the frame view) on a single sheet of paper.  The image is centered horizontally and vertically, and the orientation of the paper (portrait or landscape) is set to match the dimensions of the window.  These settings are temporary--they don't permanently affect the global PrintInfo object.

This method normally brings up the Print panel before actually beginning printing.  But if sender implements a shouldRunPrintPanel: method, that method will be invoked to first query whether to run the panel.  If shouldRunPrintPanel: returns NO, the Print panel won't be displayed, and the Window will be printed using the last settings of the panel.

A return value of nil indicates that there were errors in generating the PostScript code or that the user canceled the job.

See also:  printPSCode:, smartFaxPSCode:



spoolFile:
spoolFile:(const char *)filename

Spools the PostScript code in filename to the printer.  This method is invoked automatically when printing (or faxing) the Window.

See also:  openSpoolFile:



style
(int)style

Returns one of the following values, indicating the Window's style:

NX_PLAINSTYLE
NX_TITLEDSTYLE
NX_RESIZEBARSTYLE
NX_MENUSTYLE
NX_MINIWINDOWSTYLE
NX_MINIWORLDSTYLE
NX_TOKENSTYLE

A Window's style is set when the object is initialized.  Once set, it can't be changed.

See also:  initContent:style:backing:buttonMask:defer:



title
(const char *)title

Returns the string that appears in the title bar of the window.

See also:  setTitle:, setTitleAsFilename:



tryToPerform:with:
(BOOL)tryToPerform:(SEL)anAction with:anObject

Gives the Window's delegate a chance to respond to the action message before passing the message up the responder chain.  If a receiver for anAction is found, this method returns YES.  Otherwise, it returns NO.

See also:  tryToPerform:with: (Responder)



unregisterDraggedTypes
unregisterDraggedTypes

Unregisters the Window as a possible recipient of dragged-images.

See also:  registerForDraggedTypes:count:



update
update

The default implementation of this method does nothing more than send a windowDidUpdate: message to the Window's delegate (if the delegate can respond) and return self.  A subclass can reimplement this method to perform specialized operations, but should send an update message to super just before returning.  For example, the Menu class implements this method to disable and enable menu commands as appropriate.

A Window is automatically sent an update message before it's ordered into the screen list.  If the Application object has received a setAutoupdate:YES message, each visible Window in the application is sent an update message after every event in the main event loop.  A Panel object that isn't visible is sent an update message as part of its implementation of the commandKey: method.

You can manually cause an update message to be sent to all visible Windows through Application's updateWindows method.

See also:  updateWindows (Application), setAutoupdate: (Application)



useOptimizedDrawing:
useOptimizedDrawing:(BOOL)flag

Informs the Window whether to optimize focusing and drawing when Views are displayed.  The optimizations may prevent sibling subviews from being displayed in the correct order--this matters only if the subviews overlap.  You should always set flag to YES if there are no overlapping subviews within the Window.  The default is NO.  Returns self.



validRequestorForSendType:andReturnType:
validRequestorForSendType:(NXAtom)typeSent
andReturnType:(NXAtom)typeReturned

Passes this message on to the Window's delegate, if the delegate can respond (and isn't a Responder with its own next responder).  If the delegate can't respond or returns nil, this method passes the message to the Application object.  If the Application object returns nil, this method also returns nil, indicating that no object was found that could supply typeSent data for a remote message from the Services menu and accept back typeReturned data.  If such an object was found, it is returned.

Messages to perform this method are initiated by the Services menu.  It's part of the mechanism that passes validRequestorForSendType:andReturnType: messages up the responder chain.

See also:  validRequestorForSendType:andReturnType:
(Responder and Application)



widthAdjustLimit
(float)widthAdjustLimit

Returns the fraction of a page that can be pushed onto the next page to prevent items from being cut in half.  The limit applies to horizontal pagination.  By default, it's 0.2.

This method is invoked during automatic pagination when printing (or faxing) the Window; it should not be used in program code.  However, you can override it to return a different value.  The value returned should lie between 0.0 and 1.0 inclusive.

See also:  heightAdjustLimit



windowExposed:
windowExposed:(NXEvent *)theEvent

Invoked when a portion of the Window that was previously obscured is uncovered.  This method is only invoked if the Window's backing is nonretained.  The Views in the uncovered portion of the Window are redisplayed, and a windowDidExpose: message is sent to the delegate.  Returns self.

See also:  display:: (View), setDelegate:



windowMoved:
windowMoved:(NXEvent *)theEvent

Invoked when the user moves the Window.  A windowDidMove: message is sent to the delegate.  Returns self.

See also:  dragFrom::eventNum:, setDelegate:



windowNum
(int)windowNum

Returns the window number of the Window's window device.  Each window device in an application is given a unique window number--note that this isn't the same as the global window number assigned by the Window Server.  You use this number as the second argument of orderWindow:relativeTo: and in the Application Kit functions NXWindowList() and NXConvertWinNumToGlobal().

If the Window doesn't have a window device, the return value will be equal to or less than 0.

See also:  initContent:style:backing:buttonMask:defer:, setOneShot:



worksWhenModal
(BOOL)worksWhenModal

Returns YES if the Window is able to receive keyboard and mouse events when there's a modal panel (an attention panel) on-screen.  The default is NO.  Only Panels should change this default.

See also:  setWorksWhenModal: (Panel)



write:
write:(NXTypedStream *)stream

Writes the receiving Window to the typed stream stream, along with its content view and miniwindow counterpart.  The delegate and field editor are not explicitly written, but all subviews of the content view will be.

See also:  read:



Methods Implemented by the Delegate

windowDidBecomeKey:
windowDidBecomeKey:sender

Invoked when the sender Window becomes the key window.



windowDidBecomeMain:
windowDidBecomeMain:sender

Invoked when the sender Window becomes the main window.



windowDidChangeScreen:
windowDidChangeScreen:sender

Invoked when the user finishes moving the sender Window to a different screen.

See also:  screenChanged:



windowDidDeminiaturize:
windowDidDeminiaturize:sender

Invoked when the user has double-clicked the sender Window's miniwindow counterpart, returning the Window to the screen and hiding the miniwindow.

See also:  deminiaturize:, windowDidMiniaturize:



windowDidExpose:
windowDidExpose:sender

Invoked when a previously obscured portion of the nonretained sender Window is uncovered.

See also:  windowExposed:



windowDidMiniaturize:
windowDidMiniaturize:sender

Invoked after the sender Window has been miniaturized (whether by the user or through the performMiniaturize: or miniaturize: method).

See also:  windowWillMiniaturize:toMiniwindow:, windowDidDeminiaturize:



windowDidMove:
windowDidMove:sender

Invoked when the user finishes moving the sender Window.

See also:  windowMoved:



windowDidResignKey:
windowDidResignKey:sender

Invoked when the sender Window resigns its status as key window.



windowDidResignMain:
windowDidResignMain:sender

Invoked when the sender Window resigns its status as main window.



windowDidResize:
windowDidResize:sender

Invoked when the user finishes resizing the sender Window.

See also:  windowWillResize:toSize:, getFrame:



windowDidUpdate:
windowDidUpdate:sender

Invoked when the sender Window receives an update message.

See also:  update



windowWillClose:
windowWillClose:sender

Invoked just before the user (or the performClose: method) closes the sender Window.  If this method returns nil, the Window isn't closed.



windowWillMiniaturize:toMiniwindow:
windowWillMiniaturize:sender toMiniwindow:miniwindow

Invoked before the sender Window is miniaturized (whether by the user or through the performMiniaturize: or miniaturize: method).  The return value is ignored.

See also:  windowDidMiniaturize:, miniaturize:



windowWillMove:
windowWillMove:sender

Invoked when the user clicks on the title bar of the sender Window.  Note that this method isn't sent when the user drags the Window by clicking in a Window-dragging View (as defined by the dragFrom::eventNum: method).  The return value is ignored.



windowWillResize:toSize:
windowWillResize:sender toSize:(NXSize *)frameSize

Invoked when the sender Window is being resized (whether by the user or through one of the setFrame... methods).  The second argument, frameSize, contains the size (in screen coordinates) that the Window will be resized to.  To reset the size, simply set frameSize directly from this method.  The Window's minimum and maximum size constraints will already have been applied when this method is invoked.

If the user is resizing the Window, the delegate is sent a series of windowWillResize:toSize: messages as the Window's outline is dragged.  The Window's outline will be displayed at the constrained size as set by this method.

See also:  windowDidResize:



windowWillReturnFieldEditor:toObject:
windowWillReturnFieldEditor:sender toObject:client

Invoked when the sender Window's field editor is requested by client.  If the delegate's implementation of this method returns an object other than nil, the Window substitutes it for the field editor and returns it to client.

See also:  getFieldEditor:for: