[Previous] [Up] [Next]

NSView

Authors

Richard Frith-Macdonald
James Dessart
Nicola Pero

Version: $Revision$

Date: $Date$

NSView

NSView

Declared in: Gui/NSView.h

Inherits from: NSResponder

Conforms to: 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.

Instance Variables

Methods


Class Methods

defaultMenu

+ (NSMenu*) defaultMenu;

As of yet, unimplemented.


focusView

+ (NSView*) focusView;

Returns the view which currently has the focus.



Instances Methods

acceptsFirstMouse:

- (BOOL) acceptsFirstMouse: (NSEvent*)theEvent;

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


addCursorRect:cursor:

- (void) addCursorRect: (NSRect)aRect cursor: (NSCursor*)aCursor;

addSubview:

- (void) addSubview: (NSView*)aView;

Adds aView as a subview of the receiver.


addSubview:positioned:relativeTo:

- (void) addSubview: (NSView*)aView positioned: (NSWindowOrderingMode)place relativeTo: (NSView*)otherView;

addToPageSetup

- (void) addToPageSetup;

addTrackingRect:owner:userData:assumeInside:

- (NSTrackingRectTag) addTrackingRect: (NSRect)aRect owner: (id)anObject userData: (void*)userData assumeInside: (BOOL)flag;

adjustPageHeightNew:top:bottom:

- (void) adjustPageHeightNew: (float*)newBottom top: (float)top bottom: (float)proposedBottom;

adjustPageWidthNew:left:right:

- (void) adjustPageWidthNew: (float*)newRight left: (float)left right: (float)proposedRight;

adjustScroll:

- (NSRect) adjustScroll: (NSRect)proposedVisibleRect;

allocateGState

- (void) allocateGState;

ancestorSharedWithView:

- (NSView*) ancestorSharedWithView: (NSView*)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

- (BOOL) autoresizesSubviews;

autoresizingMask

- (unsigned int) autoresizingMask;

autoscroll:

- (BOOL) autoscroll: (NSEvent*)theEvent;

beginPage:label:bBox:

- (void) beginPage: (int)ordinalNum label: (NSString *)aString bBox: (NSRect)pageRect;

beginPageSetupRect:placement:

- (void) beginPageSetupRect: (NSRect)aRect placement: (NSPoint)location;

beginPrologueBBox:creationDate:createdBy:fonts:forWhom:pages:

- (void) beginPrologueBBox: (NSRect)boundingBox creationDate: (NSString*)dateCreated createdBy: (NSString *)anApplication fonts: (NSString*)fontNames forWhom: (NSString *)user pages: (int)numPages;

beginSetup

- (void) beginSetup;

beginTrailer

- (void) beginTrailer;

bounds

- (NSRect) bounds;

boundsRotation

- (float) boundsRotation;

canDraw

- (BOOL) canDraw;

centerScanRect:

- (NSRect) centerScanRect: (NSRect)aRect;

convertPoint:fromView:

- (NSPoint) convertPoint: (NSPoint)aPoint fromView: (NSView*)aView;

convertPoint:

- (NSPoint) convertPoint: (NSPoint)aPoint;

convertRect:fromView:

- (NSRect) convertRect: (NSRect)aRect fromView: (NSView*)aView;

convertRect:toView:

- (NSRect) convertRect: (NSRect)aRect toView: (NSView*)aView;

convertSize:fromView:

- (NSSize) convertSize: (NSSize)aSize fromView: (NSView*)aView;

convertSize:toView:

- (NSSize) convertSize: (NSSize)aSize toView: (NSView*)aView;

dataWithEPSInsideRect:

- (NSData*) dataWithEPSInsideRect: (NSRect)aRect;

discardCursorRects

- (void) discardCursorRects;

display

- (void) display;

displayIfNeeded

- (void) displayIfNeeded;

displayIfNeededIgnoringOpacity

- (void) displayIfNeededIgnoringOpacity;

displayIfNeededInRect:

- (void) displayIfNeededInRect: (NSRect)aRect;

displayIfNeededInRectIgnoringOpacity:

- (void) displayIfNeededInRectIgnoringOpacity: (NSRect)aRect;

displayRect:

- (void) displayRect: (NSRect)aRect;

displayRectIgnoringOpacity:

- (void) displayRectIgnoringOpacity: (NSRect)aRect;

dragFile:fromRect:slideBack:

- (BOOL) dragFile: (NSString*)fullPath fromRect: (NSRect)aRect slideBack: (BOOL)slideBack;

dragImage:at:offset:event:pasteboard:source:slideBack:

- (void) dragImage: (NSImage*)anImage at: (NSPoint)imageLoc offset: (NSSize)mouseOffset event: (NSEvent *)theEvent pasteboard: (NSPasteboard*)pboard source: (id)sourceObject slideBack: (BOOL)slideBack;

drawPageBorderWithSize:

- (void) drawPageBorderWithSize: (NSSize)borderSize;

drawRect:

- (void) drawRect: (NSRect)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:

- (void) drawSheetBorderWithSize: (NSSize)borderSize;

enclosingScrollView

- (NSScrollView*) enclosingScrollView;

endHeaderComments

- (void) endHeaderComments;

endPage

- (void) endPage;

endPageSetup

- (void) endPageSetup;

endPrologue

- (void) endPrologue;

endSetup

- (void) endSetup;

endTrailer

- (void) endTrailer;

fax:

- (void) fax: (id)sender;

frame

- (NSRect) frame;

frameRotation

- (float) frameRotation;

gState

- (int) gState;

heightAdjustLimit

- (float) heightAdjustLimit;

hitTest:

- (NSView*) hitTest: (NSPoint)aPoint;

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


initWithFrame:

- (id) initWithFrame: (NSRect)frameRect;

interfaceStyle

- (NSInterfaceStyle) interfaceStyle;

isDescendantOf:

- (BOOL) isDescendantOf: (NSView*)aView;

Returns YES if aView is an ancestor of the receiver.


isFlipped

- (BOOL) isFlipped;

isOpaque

- (BOOL) isOpaque;

isRotatedFromBase

- (BOOL) isRotatedFromBase;

isRotatedOrScaledFromBase

- (BOOL) isRotatedOrScaledFromBase;

knowsPageRange:

- (BOOL) knowsPageRange: (NSRangePointer)range;

knowsPagesFirst:

- (BOOL) knowsPagesFirst: (int*)firstPageNum;

locationOfPrintRect:

- (NSPoint) locationOfPrintRect: (NSRect)aRect;

lockFocus

- (void) lockFocus;

menuForEvent:

- (NSMenu*) menuForEvent: (NSEvent*)theEvent;

As of yet, unimplemented.


mouse:inRect:

- (BOOL) mouse: (NSPoint)aPoint inRect: (NSRect)aRect;

Returns whether or not aPoint lies within aRect.


needsDisplay

- (BOOL) needsDisplay;

needsPanelToBecomeKey

- (BOOL) needsPanelToBecomeKey;

nextKeyView

- (NSView*) nextKeyView;

nextValidKeyView

- (NSView*) nextValidKeyView;

opaqueAncestor

- (NSView*) opaqueAncestor;

performKeyEquivalent:

- (BOOL) performKeyEquivalent: (NSEvent*)theEvent;

performMnemonic:

- (BOOL) performMnemonic: (NSString*)aString;

postsBoundsChangedNotifications

- (BOOL) postsBoundsChangedNotifications;

postsFrameChangedNotifications

- (BOOL) postsFrameChangedNotifications;

previousKeyView

- (NSView*) previousKeyView;

previousValidKeyView

- (NSView*) previousValidKeyView;

print:

- (void) print: (id)sender;

rectForPage:

- (NSRect) rectForPage: (int)pageNumber;

reflectScrolledClipView:

- (void) reflectScrolledClipView: (NSClipView*)aClipView;

registerForDraggedTypes:

- (void) registerForDraggedTypes: (NSArray*)pboardTypes;

releaseGState

- (void) releaseGState;

removeCursorRect:cursor:

- (void) removeCursorRect: (NSRect)aRect cursor: (NSCursor*)aCursor;

removeFromSuperview

- (void) 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

- (void) removeFromSuperviewWithoutNeedingDisplay;

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


removeSubview:

- (void) removeSubview: (NSView*)aView;
Standards: NotMacOS-X NotOpenStep

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:

- (void) removeTrackingRect: (NSTrackingRectTag)aTag;

renewGState

- (void) renewGState;

replaceSubview:with:

- (void) replaceSubview: (NSView*)oldView with: (NSView*)newView;

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


resetCursorRects

- (void) resetCursorRects;

resizeSubviewsWithOldSize:

- (void) resizeSubviewsWithOldSize: (NSSize)oldFrameSize;

resizeWithOldSuperviewSize:

- (void) resizeWithOldSuperviewSize: (NSSize)oldFrameSize;

rotateByAngle:

- (void) rotateByAngle: (float)angle;

scaleUnitSquareToSize:

- (void) scaleUnitSquareToSize: (NSSize)newUnitSize;

scrollClipView:

- (void) scrollClipView: (NSClipView*)aClipView;

scrollPoint:

- (void) scrollPoint: (NSPoint)aPoint;

scrollRect:

- (void) scrollRect: (NSRect)aRect;

scrollRectToVisible:

- (BOOL) scrollRectToVisible: (NSRect)aRect;

setAutoresizesSubviews:

- (void) setAutoresizesSubviews: (BOOL)flag;

setAutoresizingMask:

- (void) setAutoresizingMask: (unsigned int)mask;

setBounds:

- (void) setBounds: (NSRect)boundsRect;

setBoundsOrigin:

- (void) setBoundsOrigin: (NSPoint)newOrigin;

setBoundsRotation:

- (void) setBoundsRotation: (float)angle;

setBoundsSize:

- (void) setBoundsSize: (NSSize)newSize;

setFrame:

- (void) setFrame: (NSRect)frameRect;

setFrameOrigin:

- (void) setFrameOrigin: (NSPoint)newOrigin;

setFrameRotation:

- (void) setFrameRotation: (float)angle;

setFrameSize:

- (void) setFrameSize: (NSSize)newSize;

setInterfaceStyle:

- (void) setInterfaceStyle: (NSInterfaceStyle)interfaceStyle;

setNeedsDisplay:

- (void) setNeedsDisplay: (BOOL)flag;

setNeedsDisplayInRect:

- (void) setNeedsDisplayInRect: (NSRect)invalidRect;

setNextKeyView:

- (void) setNextKeyView: (NSView*)aView;

setPostsBoundsChangedNotifications:

- (void) setPostsBoundsChangedNotifications: (BOOL)flag;

setPostsFrameChangedNotifications:

- (void) setPostsFrameChangedNotifications: (BOOL)flag;

setToolTip:

- (void) setToolTip: (NSString*)string;

setUpGState

- (void) setUpGState;

shouldDelayWindowOrderingForEvent:

- (BOOL) shouldDelayWindowOrderingForEvent: (NSEvent*)theEvent;

shouldDrawColor

- (BOOL) shouldDrawColor;

sortSubviewsUsingFunction:context:

- (void) sortSubviewsUsingFunction: (int (*)(id,id,void*))compare context: (void*)context;

subviews

- (NSArray*) subviews;

superview

- (NSView*) superview;

tag

- (int) tag;

toolTip

- (NSString*) toolTip;

translateOriginToPoint:

- (void) translateOriginToPoint: (NSPoint)newOrigin;

unlockFocus

- (void) unlockFocus;

unregisterDraggedTypes

- (void) unregisterDraggedTypes;

viewWillMoveToSuperview:

- (void) viewWillMoveToSuperview: (NSView*)newSuperview;

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


viewWillMoveToWindow:

- (void) viewWillMoveToWindow: (NSWindow*)newWindow;

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


viewWithTag:

- (id) viewWithTag: (int)aTag;

visibleRect

- (NSRect) visibleRect;

widthAdjustLimit

- (float) widthAdjustLimit;

window

- (NSWindow*) window;

Returns the window in which the receiver resides.


writeEPSInsideRect:toPasteboard:

- (void) writeEPSInsideRect: (NSRect)aRect toPasteboard: (NSPasteboard*)pboard;