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
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
addSubview:
aView
Adds aView as a subview of the receiver.
addSubview:
aView
positioned:
place
relativeTo:
otherView
addToPageSetup
addToolTipRect:
aRect
owner:
anObject
userData:
data
addTrackingRect:
aRect
owner:
anObject
userData:
data
assumeInside:
flag
adjustPageHeightNew:
newBottom
top:
oldTop
bottom:
oldBottom
limit:
bottomLimit
adjustPageWidthNew:
newRight
left:
oldLeft
right:
oldRight
limit:
rightLimit
adjustScroll:
newVisible
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
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
beginPageInRect:
aRect
atPlacement:
location
beginPageSetupRect:
aRect
placement:
location
beginPrologueBBox:
bBox
creationDate:
dateCreated
createdBy:
anApplication
fonts:
fontNames
forWhom:
user
pages:
numPages
title:
aTitle
beginSetup
beginTrailer
bounds
boundsRotation
canDraw
centerScanRect:
aRect
convertPoint:
aPoint
fromView:
aView
convertPoint:
aPoint
toView:
aView
convertRect:
aRect
fromView:
aView
convertRect:
aRect
toView:
aView
convertSize:
aSize
fromView:
aView
convertSize:
aSize
toView:
aView
dataWithEPSInsideRect:
aRect
dataWithPDFInsideRect:
aRect
didAddSubview:
subview
discardCursorRects
display
displayIfNeeded
displayIfNeededIgnoringOpacity
displayIfNeededInRect:
aRect
displayIfNeededInRectIgnoringOpacity:
aRect
displayRect:
rect
displayRectIgnoringOpacity:
aRect
dragFile:
filename
fromRect:
rect
slideBack:
slideFlag
event:
event
dragImage:
anImage
at:
viewLocation
offset:
initialOffset
event:
event
pasteboard:
pboard
source:
sourceObject
slideBack:
slideFlag
drawPageBorderWithSize:
borderSize
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
enclosingScrollView
endDocument
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
heightAdjustLimit
hitTest:
aPoint
Returns the subview, lowest in the receiver's
hierarchy, which contains aPoint
initWithFrame:
frameRect
isDescendantOf:
aView
Returns YES
if aView is an
ancestor of the receiver.
isFlipped
isOpaque
isRotatedFromBase
isRotatedOrScaledFromBase
knowsPageRange:
range
knowsPagesFirst:
firstPageNum
last:
lastPageNum
locationOfPrintRect:
aRect
lockFocus
lockFocusIfCanDraw
menuForEvent:
theEvent
mouse:
aPoint
inRect:
aRect
Returns whether or not aPoint lies
within aRect
needsDisplay
nextKeyView
nextValidKeyView
opaqueAncestor
performKeyEquivalent:
theEvent
performMnemonic:
aString
postsBoundsChangedNotifications
postsFrameChangedNotifications
previousKeyView
previousValidKeyView
print:
sender
printJobTitle
rectForPage:
page
reflectScrolledClipView:
aClipView
registerForDraggedTypes:
types
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
removeCursorRect:
aRect
cursor:
anObject
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
removeTrackingRect:
tag
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:
oldSize
resizeWithOldSuperviewSize:
oldSize
rotateByAngle:
angle
scaleUnitSquareToSize:
newSize
scrollClipView:
aClipView
toPoint:
aPoint
scrollPoint:
aPoint
scrollRect:
aRect
by:
delta
scrollRectToVisible:
aRect
setAutoresizesSubviews:
flag
setAutoresizingMask:
mask
setBounds:
aRect
setBoundsOrigin:
newOrigin
setBoundsRotation:
angle
setBoundsSize:
newSize
setFrame:
frameRect
setFrameOrigin:
newOrigin
setFrameRotation:
angle
setFrameSize:
newSize
setNeedsDisplay:
flag
setNeedsDisplayInRect:
rect
setNextKeyView:
aView
setPostsBoundsChangedNotifications:
flag
setPostsFrameChangedNotifications:
flag
setPreviousKeyView:
aView
setToolTip:
string
setUpGState
shouldDelayWindowOrderingForEvent:
anEvent
shouldDrawColor
sortSubviewsUsingFunction:
compare
context:
context
subviews
superview
tag
toolTip
translateOriginToPoint:
point
unlockFocus
unregisterDraggedTypes
viewDidMoveToSuperview
viewDidMoveToWindow
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
visibleRect
widthAdjustLimit
willRemoveSubview:
subview
window
Returns the window in which the receiver resides.
writeEPSInsideRect:
rect
toPasteboard:
pasteboard
writePDFInsideRect:
aRect
toPasteboard:
pboard