NSView $Revision$ $Date$ NSView Gui/NSView.h NSCoding

NSView is an abstract class which provides facilities for drawing in a window and receiving events. It is the superclass of many of the visual elements of the GUI.

In order to display itself, a view must be placed in a window (represented by an NSWindow object). Within the window is a hierarchy of NSViews, headed by the window's content view. Every other view in a window is a descendant of this view.

Subclasses can override drawRect: in order to implement their appearance. Other methods of NSView and NSResponder can also be overridden to handle user generated events.

defaultMenu

As of yet, unimplemented.

focusView

Returns the view which currently has the focus.

acceptsFirstMouse: theEvent

Returns YES if the view object will accept the first click received when in an inactive window, and NO otherwise.

addCursorRect: aRect cursor: aCursor addSubview: aView

Adds aView as a subview of the receiver.

addSubview: aView positioned: place relativeTo: otherView addToPageSetup addTrackingRect: aRect owner: anObject userData: userData assumeInside: flag adjustPageHeightNew: newBottom top: top bottom: proposedBottom adjustPageWidthNew: newRight left: left right: proposedRight adjustScroll: proposedVisibleRect allocateGState Tell the view to maintain a private gstate object which encapsulates all the information about drawing, such as coordinate transforms, line widths, etc. If you do not invoke this method, a gstate object is constructed each time the view is lockFocused. Allocating a private gstate may improve the performance of views that are focused a lot and have a lot of customized drawing parameters.

View subclasses should override the setUpGstate method to set these custom parameters. ancestorSharedWithView: aView

Returns self if aView is the receiver or aView is a subview of the receiver, the ancestor view shared by aView and the receiver, if any, aView if it is an ancestor of the receiver, otherwise returns nil.

autoresizesSubviews autoresizingMask autoscroll: theEvent beginPage: ordinalNum label: aString bBox: pageRect beginPageSetupRect: aRect placement: location beginPrologueBBox: boundingBox creationDate: dateCreated createdBy: anApplication fonts: fontNames forWhom: user pages: numPages beginSetup beginTrailer bounds boundsRotation canDraw centerScanRect: aRect convertPoint: aPoint fromView: aView convertPoint: aPoint convertRect: aRect fromView: aView convertRect: aRect toView: aView convertSize: aSize fromView: aView convertSize: aSize toView: aView dataWithEPSInsideRect: aRect discardCursorRects display displayIfNeeded displayIfNeededIgnoringOpacity displayIfNeededInRect: aRect displayIfNeededInRectIgnoringOpacity: aRect displayRect: aRect displayRectIgnoringOpacity: aRect dragFile: fullPath fromRect: aRect slideBack: slideBack dragImage: anImage at: imageLoc offset: mouseOffset event: theEvent pasteboard: pboard source: sourceObject slideBack: slideBack drawPageBorderWithSize: borderSize drawRect: aRect This method is invoked to handle drawing inside the view. The default NSView's implementation does nothing; subclasses might override it to draw something inside the view. Since NSView's implementation is guaranteed to be empty, you should not call super's implementation when you override it in subclasses. drawRect: is invoked when the focus has already been locked on the view; you can use arbitrary postscript functions in drawRect: to draw inside your view; the coordinate system in which you draw is the view's own coordinate system (this means for example that you should refer to the rectangle covered by the view using its bounds, and not its frame). The argument of drawRect: is the rectangle which needs to be redrawn. In a lossy implementation, you can ignore the argument and redraw the whole view; if you are aiming at performance, you may want to redraw only what is inside the rectangle which needs to be redrawn; this usually improves drawing performance considerably. drawSheetBorderWithSize: borderSize enclosingScrollView endHeaderComments endPage endPageSetup endPrologue endSetup endTrailer fax: sender frame frameRotation gState Returns an identifier that represents the view's gstate object, which is used to encapsulate drawing information about the view. Most of the time a gstate object is created from scratch when the view is focused, so if the view is not currently focused or allocateGState has not been called, then this method will return 0. heightAdjustLimit hitTest: aPoint

Returns the subview, lowest in the receiver's hierarchy, which contains aPoint

initWithFrame: frameRect interfaceStyle isDescendantOf: aView

Returns YES if aView is an ancestor of the receiver.

isFlipped isOpaque isRotatedFromBase isRotatedOrScaledFromBase knowsPageRange: range knowsPagesFirst: firstPageNum locationOfPrintRect: aRect lockFocus menuForEvent: theEvent

As of yet, unimplemented.

mouse: aPoint inRect: aRect

Returns whether or not aPoint lies within aRect.

needsDisplay needsPanelToBecomeKey nextKeyView nextValidKeyView opaqueAncestor performKeyEquivalent: theEvent performMnemonic: aString postsBoundsChangedNotifications postsFrameChangedNotifications previousKeyView previousValidKeyView print: sender rectForPage: pageNumber reflectScrolledClipView: aClipView registerForDraggedTypes: pboardTypes releaseGState Frees the gstate object, if there is one. Note that the next time the view is lockFocused, the gstate will be allocated again. removeCursorRect: aRect cursor: aCursor removeFromSuperview

Removes the receiver from its superviews list of subviews, by invoking the superviews [-removeSubview:] method, and marks the rectangle that the reciever occupied in the superview as needing redisplay.

This is dangerous to use during display, since it alters the rectangles needing display.

removeFromSuperviewWithoutNeedingDisplay

Removes the receiver from its superviews list of subviews, by invoking the superviews [-removeSubview:] method.

removeSubview: aView

Removes the view from the receivers list of subviews and from the responder chain.

Also invokes [aView -viewWillMoveToWindow: nil] to handle removal of aView (and recursively, its children) from its window - performing tidyup by invalidating cursor rects etc.

removeTrackingRect: aTag renewGState Invalidates the view's gstate object so it will be set up again using setUpGState the next time the view is focused. replaceSubview: oldView with: newView

Removes oldView from the receiver and places newView in its place.

resetCursorRects resizeSubviewsWithOldSize: oldFrameSize resizeWithOldSuperviewSize: oldFrameSize rotateByAngle: angle scaleUnitSquareToSize: newUnitSize scrollClipView: aClipView scrollPoint: aPoint scrollRect: aRect scrollRectToVisible: aRect setAutoresizesSubviews: flag setAutoresizingMask: mask setBounds: boundsRect setBoundsOrigin: newOrigin setBoundsRotation: angle setBoundsSize: newSize setFrame: frameRect setFrameOrigin: newOrigin setFrameRotation: angle setFrameSize: newSize setInterfaceStyle: interfaceStyle setNeedsDisplay: flag setNeedsDisplayInRect: invalidRect setNextKeyView: aView setPostsBoundsChangedNotifications: flag setPostsFrameChangedNotifications: flag setToolTip: string setUpGState shouldDelayWindowOrderingForEvent: theEvent shouldDrawColor sortSubviewsUsingFunction: compare context: context subviews superview tag toolTip translateOriginToPoint: newOrigin unlockFocus unregisterDraggedTypes viewWillMoveToSuperview: newSuperview

Notifies the receiver that its superview is being changed to newSuperview.

viewWillMoveToWindow: newWindow

Notifies the receiver that it will now be a view of newWindow.

viewWithTag: aTag visibleRect widthAdjustLimit window

Returns the window in which the receiver resides.

writeEPSInsideRect: aRect toPasteboard: pboard