NSView scottc@net-community.com far@ix.netcom.com ovidiu@net-community.com richard@brainstorm.co.uk The view class which encapsulates all drawing functionality (C) 1996 Free Software Foundation, Inc. NSView

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.

AppKit/NSView.h defaultMenu Description forthcoming. focusView Return the view at the top of graphics contexts stack or nil if none is focused. 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: anObject Description forthcoming. addSubview: aView Adds aView as a subview of the receiver. addSubview: aView positioned: place relativeTo: otherView Description forthcoming. addToPageSetup Description forthcoming. addToolTipRect: aRect owner: anObject userData: data Description forthcoming. addTrackingRect: aRect owner: anObject userData: data assumeInside: flag Description forthcoming. adjustPageHeightNew: newBottom top: oldTop bottom: oldBottom limit: bottomLimit Description forthcoming. adjustPageWidthNew: newRight left: oldLeft right: oldRight limit: rightLimit Description forthcoming. adjustScroll: newVisible Description forthcoming. 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 Description forthcoming. autoresizingMask Description forthcoming. autoscroll: theEvent Description forthcoming. beginDocument Writes header and job information for the PostScript document. This includes at a minimum, PostScript header information. It may also include job setup information if the output is intended for a printer (i.e. not an EPS file). Most of the information for writing the header comes from the NSPrintOperation and NSPrintInfo objects associated with the current print operation. There isn't normally anything that the program needs to override at the beginning of a document, although if there is additional setup that needs to be done, you can override the NSView's methods endHeaderComments, endPrologue, beginSetup, and/or endSetup. This method calls the above methods in the listed order before or after writing the required information. For an EPS operation, the beginSetup and endSetup methods aren't used. beginPage: ordinalNum label: aString bBox: pageRect fonts: fontNames Description forthcoming. beginPageInRect: aRect atPlacement: location Description forthcoming. beginPageSetupRect: aRect placement: location Description forthcoming. beginPrologueBBox: bBox creationDate: dateCreated createdBy: anApplication fonts: fontNames forWhom: user pages: numPages title: aTitle Description forthcoming. beginSetup Description forthcoming. beginTrailer Description forthcoming. bounds Description forthcoming. boundsRotation Description forthcoming. canDraw Description forthcoming. centerScanRect: aRect Description forthcoming. convertPoint: aPoint fromView: aView Description forthcoming. convertPoint: aPoint toView: aView Description forthcoming. convertRect: aRect fromView: aView Description forthcoming. convertRect: aRect toView: aView Description forthcoming. convertSize: aSize fromView: aView Description forthcoming. convertSize: aSize toView: aView Description forthcoming. dataWithEPSInsideRect: aRect Description forthcoming. dataWithPDFInsideRect: aRect Description forthcoming. didAddSubview: subview Description forthcoming. discardCursorRects Description forthcoming. display Description forthcoming. displayIfNeeded Description forthcoming. displayIfNeededIgnoringOpacity Description forthcoming. displayIfNeededInRect: aRect Description forthcoming. displayIfNeededInRectIgnoringOpacity: aRect Description forthcoming. displayRect: rect Description forthcoming. displayRectIgnoringOpacity: aRect Description forthcoming. dragFile: filename fromRect: rect slideBack: slideFlag event: event Description forthcoming. dragImage: anImage at: viewLocation offset: initialOffset event: event pasteboard: pboard source: sourceObject slideBack: slideFlag Description forthcoming. drawPageBorderWithSize: borderSize Description forthcoming. drawRect: rect 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 Description forthcoming. enclosingScrollView Description forthcoming. endDocument Description forthcoming. endHeaderComments Description forthcoming. endPage Description forthcoming. endPageSetup Description forthcoming. endPrologue Description forthcoming. endSetup Description forthcoming. endTrailer Description forthcoming. fax: sender Description forthcoming. frame Description forthcoming. frameRotation Description forthcoming. 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 heightAdjustLimit Description forthcoming. hitTest: aPoint Returns the subview, lowest in the receiver's hierarchy, which contains aPoint initWithFrame: frameRect Description forthcoming. isDescendantOf: aView Returns YES if aView is an ancestor of the receiver. isFlipped Description forthcoming. isOpaque Description forthcoming. isRotatedFromBase Description forthcoming. isRotatedOrScaledFromBase Description forthcoming. knowsPageRange: range Description forthcoming. knowsPagesFirst: firstPageNum last: lastPageNum Description forthcoming. locationOfPrintRect: aRect Description forthcoming. lockFocus Description forthcoming. lockFocusIfCanDraw Description forthcoming. menuForEvent: theEvent Description forthcoming. mouse: aPoint inRect: aRect Returns whether or not aPoint lies within aRect needsDisplay Description forthcoming. nextKeyView Description forthcoming. nextValidKeyView Description forthcoming. opaqueAncestor Description forthcoming. performKeyEquivalent: theEvent Description forthcoming. performMnemonic: aString Description forthcoming. postsBoundsChangedNotifications Description forthcoming. postsFrameChangedNotifications Description forthcoming. previousKeyView Description forthcoming. previousValidKeyView Description forthcoming. print: sender Description forthcoming. printJobTitle Description forthcoming. rectForPage: page Description forthcoming. reflectScrolledClipView: aClipView Description forthcoming. registerForDraggedTypes: types Description forthcoming. releaseGState Frees the gstate object, if there is one. Note that the next time the view is lockFocused, the gstate will be allocated again. removeAllToolTips Description forthcoming. removeCursorRect: aRect cursor: anObject Description forthcoming. 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: aSubview

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.

removeToolTip: tag Description forthcoming. removeTrackingRect: tag Description forthcoming. 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 Description forthcoming. resizeSubviewsWithOldSize: oldSize Description forthcoming. resizeWithOldSuperviewSize: oldSize Description forthcoming. rotateByAngle: angle Description forthcoming. scaleUnitSquareToSize: newSize Description forthcoming. scrollClipView: aClipView toPoint: aPoint Description forthcoming. scrollPoint: aPoint Description forthcoming. scrollRect: aRect by: delta Description forthcoming. scrollRectToVisible: aRect Description forthcoming. setAutoresizesSubviews: flag Description forthcoming. setAutoresizingMask: mask Description forthcoming. setBounds: aRect Description forthcoming. setBoundsOrigin: newOrigin Description forthcoming. setBoundsRotation: angle Description forthcoming. setBoundsSize: newSize Description forthcoming. setFrame: frameRect Description forthcoming. setFrameOrigin: newOrigin Description forthcoming. setFrameRotation: angle Description forthcoming. setFrameSize: newSize Description forthcoming. setNeedsDisplay: flag Description forthcoming. setNeedsDisplayInRect: rect Description forthcoming. setNextKeyView: aView Description forthcoming. setPostsBoundsChangedNotifications: flag Description forthcoming. setPostsFrameChangedNotifications: flag Description forthcoming. setPreviousKeyView: aView Description forthcoming. setToolTip: string Description forthcoming. setUpGState Description forthcoming. shouldDelayWindowOrderingForEvent: anEvent Description forthcoming. shouldDrawColor Description forthcoming. sortSubviewsUsingFunction: compare context: context Description forthcoming. subviews Description forthcoming. superview Description forthcoming. tag Description forthcoming. toolTip Description forthcoming. translateOriginToPoint: point Description forthcoming. unlockFocus Description forthcoming. unregisterDraggedTypes Description forthcoming. viewDidMoveToSuperview Description forthcoming. viewDidMoveToWindow Description forthcoming. viewWillMoveToSuperview: newSuper 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. Note, this method is also used when removing a view from a window (in which case, newWindow is nil) to let all the subviews know that they have also been removed from the window. viewWithTag: aTag Description forthcoming. visibleRect Description forthcoming. widthAdjustLimit Description forthcoming. willRemoveSubview: subview Description forthcoming. window Returns the window in which the receiver resides. writeEPSInsideRect: rect toPasteboard: pasteboard Description forthcoming. writePDFInsideRect: aRect toPasteboard: pboard Description forthcoming.
Software documentation for the NSView(PrivateMethods) category AppKit/NSView.h Description forthcoming. _invalidateCoordinates Description forthcoming. _matrixFromWindow Description forthcoming. _matrixToWindow Description forthcoming. _rebuildCoordinates Description forthcoming.