Class CPScroller

CPObject
    extended byCPResponder
        extended byCPView
            extended byCPControl
                extended byCPScroller

@implementation CPScroller : CPControl

Method Summary
+(float)scrollerWidth
          Returns the CPScroller's width for a CPRegularControlSize.
+(float)scrollerWidthForControlSize:(CPControlSize)aControlSize
          Returns the width of a CPScroller for the specified CPControlSize.
-(id)initWithFrame:(CGRect)aFrame
          Initializes the receiver for usage with the specified bounding rectangle.
-(void)checkSpaceForParts
          Check if there's enough space in the scroller to display the knob.
-(CPControlSize)controlSize
          Returns the scroller's control size.
-(void)drawArrow:(CPScrollerArrow)anArrow highlight:(BOOL)shouldHighlight
          Draws the specified arrow and sets the highlight.
-(void)drawKnob
          Draws the knob.
-(void)drawKnobSlot
          Draws the knob's slot.
-(void)drawParts
          Caches images for the scroll arrow and knob.
-(void)highlight:(BOOL)shouldHighlight
          Draws the scroller's arrow with a possible highlight, if the user's mouse is over it.
-(CPScrollerPart)hitPart
          Returns the part of the scroller that was hit.
-(float)knobProportion
          Return's the knob's proportion.
-(void)layoutSubviews
          Lays out the scrollers subviews.
-(void)mouseDown:(CPEvent)anEvent
          Notifies the receiver that the user has clicked the mouse down in its area.
-(CGRect)rectForPart:(CPScrollerPart)aPart
-(void)setControlSize:(CPControlSize)aControlSize
          Sets the scroller's size.
-(void)setEnabled:(BOOL)shouldBeEnabled
          Sets whether the receiver responds to mouse events.
-(void)setFloatValue:(float)aValue
          Sets the scroller's knob position (ranges from 0.
-(void)setFloatValue:(float)aValue knobProportion:(float)aProportion
          Sets the position and proportion of the knob.
-(void)setFrameSize:(CGSize)aSize
          Sets the receiver's frame size.
-(CPScrollerPart)testPart:(CGPoint)aPoint
          Returns the part of the scroller that would be hit by aPoint.
-(void)trackKnob:(CPEvent)anEvent
          Tracks the knob.
-(void)trackScrollButtons:(CPEvent)anEvent
          Tracks the scroll button.
-(CPUsableScrollerParts)usableParts
          Returns all the parts of the scroller that are usable for displaying.

Methods inherited from class CPObject
initialize, alloc, class, instanceMethodForSelector, instancesRespondToSelector, isSubclassOfClass, load, new, setVersion, superclass, version, init, autorelease, awakeAfterUsingCoder, class, classForCoder, classForKeyedArchiver, className, copy, dealloc, description, doesNotRecognizeSelector, forwardInvocation, hash, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableCopy, performSelector, performSelector, performSelector, release, replacementObjectForArchiver, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, retain, self, superclass

Methods inherited from class CPResponder
acceptsFirstResponder, becomeFirstResponder, deleteBackward, doCommandBySelector, insertLineBreak, insertText, interpretKeyEvents, keyDown, keyUp, menu, mouseDown, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseUp, nextResponder, noResponderFor, performKeyEquivalent, resignFirstResponder, scrollWheel, setMenu, setNextResponder, tryToPerform, undoManager

Methods inherited from class CPView
initWithFrame, acceptsFirstMouse, addSubview, addSubview, adjustScroll, alphaValue, autoresizesSubviews, autoresizingMask, autoscroll, backgroundColor, bounds, convertPoint, convertPoint, convertRect, convertRect, convertSize, convertSize, didAddSubview, display, displayIfNeeded, displayIfNeededInRect, displayRect, displayRectIgnoringOpacity, dragImage, dragView, drawRect, enclosingMenuItem, enclosingScrollView, enterFullScreenMode, exitFullScreenModeWithOptions, frame, hitTest, hitTests, isDescendantOf, isFlipped, isHidden, isHiddenOrHasHiddenAncestor, isInFullScreenMode, isOpaque, lockFocus, mouseDown, mouseDownCanMoveWindow, needsDisplay, postsBoundsChangedNotifications, postsFrameChangedNotifications, reflectScrolledClipView, registerForDraggedTypes, registeredDraggedTypes, removeFromSuperview, replaceSubview, resizeSubviewsWithOldSize, resizeWithOldSuperviewSize, scrollClipView, scrollPoint, scrollRectToVisible, scrollRect, setAlphaValue, setAutoresizesSubviews, setAutoresizingMask, setBackgroundColor, setBounds, setBoundsOrigin, setBoundsSize, setFrame, setFrameOrigin, setFrameSize, setHidden, setHitTests, setNeedsDisplay, setNeedsDisplayInRect, setPostsBoundsChangedNotifications, setPostsFrameChangedNotifications, subviews, superview, unlockFocus, unregisterDraggedTypes, viewDidMoveToSuperview, viewDidMoveToWindow, viewWillMoveToSuperview, viewWillMoveToWindow, visibleRect, willRemoveSubview, window

Methods inherited from class CPControl
initWithFrame, action, alignment, backgroundColorForName, floatValue, font, isEnabled, mouseUp, sendAction, setAction, setAlignment, setBackgroundColor, setBackgroundColorWithName, setBackgroundColor, setEnabled, setFloatValue, setFont, setTarget, setTextColor, setTextShadow, target, textColor, textShadow


Method Detail

scrollerWidth

+(float)scrollerWidth
Returns the CPScroller's width for a CPRegularControlSize.

scrollerWidthForControlSize

+(float)scrollerWidthForControlSize:(CPControlSize)aControlSize
Returns the width of a CPScroller for the specified CPControlSize.
Parameters:
aControlSize - the size of a controller to return the width for

initWithFrame

-(id)initWithFrame:(CGRect)aFrame
Initializes the receiver for usage with the specified bounding rectangle
Parameters:
aFrame
Returns:
the initialized view

checkSpaceForParts

-(void)checkSpaceForParts
Check if there's enough space in the scroller to display the knob

controlSize

-(CPControlSize)controlSize
Returns the scroller's control size

drawArrow

-(void)drawArrow:(CPScrollerArrow)anArrow highlight:(BOOL)shouldHighlight
Draws the specified arrow and sets the highlight.
Parameters:
anArrow - the arrow to draw
shouldHighlight - sets whether the arrow should be highlighted

drawKnob

-(void)drawKnob
Draws the knob

drawKnobSlot

-(void)drawKnobSlot
Draws the knob's slot

drawParts

-(void)drawParts
Caches images for the scroll arrow and knob.

highlight

-(void)highlight:(BOOL)shouldHighlight
Draws the scroller's arrow with a possible highlight, if the user's mouse is over it.
Parameters:
shouldHighlight - YES will draw the arrow highlighted if the mouse is hovering over it.

hitPart

-(CPScrollerPart)hitPart
Returns the part of the scroller that was hit.

knobProportion

-(float)knobProportion
Return's the knob's proportion

layoutSubviews

-(void)layoutSubviews
Lays out the scrollers subviews

mouseDown

-(void)mouseDown:(CPEvent)anEvent
Notifies the receiver that the user has clicked the mouse down in its area.
Parameters:
anEvent - contains information about the click

rectForPart

-(CGRect)rectForPart:(CPScrollerPart)aPart
Parameters:
aPart

setControlSize

-(void)setControlSize:(CPControlSize)aControlSize
Sets the scroller's size.
Parameters:
aControlSize - the scroller's size

setEnabled

-(void)setEnabled:(BOOL)shouldBeEnabled
Sets whether the receiver responds to mouse events.
Parameters:
shouldBeEnabled

setFloatValue

-(void)setFloatValue:(float)aValue
Sets the scroller's knob position (ranges from 0.0 to 1.0).
Parameters:
aValue - the knob position (ranges from 0.0 to 1.0)

setFloatValue

-(void)setFloatValue:(float)aValue knobProportion:(float)aProportion
Sets the position and proportion of the knob.
Parameters:
aValue - the knob position (ranges from 0.0 to 1.0)
aProportion - the knob's proportion (ranges from 0.0 to 1.0)

setFrameSize

-(void)setFrameSize:(CGSize)aSize
Sets the receiver's frame size. If aSize is the same as the frame's current dimensions, this method simply returns. The method posts a CPViewFrameDidChangeNotification to the default notification center if the receiver is configured to do so.
Parameters:
aSize - the new size for the frame

testPart

-(CPScrollerPart)testPart:(CGPoint)aPoint
Returns the part of the scroller that would be hit by aPoint.
Parameters:
aPoint - the simulated point hit
Returns:
the part of the scroller that intersects the point

trackKnob

-(void)trackKnob:(CPEvent)anEvent
Tracks the knob.
Parameters:
anEvent - the input event

trackScrollButtons

-(void)trackScrollButtons:(CPEvent)anEvent
Tracks the scroll button.
Parameters:
anEvent - the input event

usableParts

-(CPUsableScrollerParts)usableParts
Returns all the parts of the scroller that are usable for displaying.

Created on Sat Sep 13 14:15:43 PDT 2008