Class CPColorWell

CPObject
    extended byCPResponder
        extended byCPView
            extended byCPControl
                extended byCPColorWell

@implementation CPColorWell : CPControl

CPColorWell is a CPControl for selecting and displaying a single color value. An example of a CPColorWell object (or simply color well) is found in CPColorPanel, which uses a color well to display the current color selection.

An application can have one or more active CPColorWells. You can activate multiple CPColorWells by invoking the activate: method with NO as its argument. When a mouse-down event occurs on an CPColorWell's border, it becomes the only active color well. When a color well becomes active, it brings up the color panel also.


Method Summary
-(id)initWithFrame:(CGRect)aFrame
          Initializes the receiver for usage with the specified bounding rectangle.
-(void)activate:(BOOL)shouldBeExclusive
          Activates the color well, displays the color panel, and makes the panel's current color the same as its own.
-(CPColor)color
          Returns the color well's current color.
-(void)colorPanelDidChangeColor:(CPNotification)aNotification
-(void)colorPanelWillClose:(CPNotification)aNotification
-(void)colorWellDidBecomeExclusive:(CPNotification)aNotification
-(void)deactivate
          Deactivates the color well.
-(void)drawBezelWithHighlight:(BOOL)shouldHighlight
-(void)drawWellInside:(CGRect)aRect
          Draws the colored area inside the color well without borders.
-(BOOL)isActive
          Returns YES if the color well is active.
-(void)mouseDown:(CPEvent)anEvent
          Notifies the receiver that the user has clicked the mouse down in its area.
-(void)mouseDragged:(CPEvent)anEvent
          Notifies the receiver that the user has initiated a drag over it.
-(void)mouseUp:(CPEvent)anEvent
          Notifies the receiver that the user has released the left mouse button.
-(void)setColor:(CPColor)aColor
          Sets the color well's current color.
-(void)takeColorFrom:(id)aSender
          Changes the color of the well to that of aSender.

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

initWithFrame

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

activate

-(void)activate:(BOOL)shouldBeExclusive
Activates the color well, displays the color panel, and makes the panel's current color the same as its own. If exclusive is YES, deactivates any other CPColorWells. NO, keeps them active.
Parameters:
shouldBeExclusive - whether other color wells should be deactivated.

color

-(CPColor)color
Returns the color well's current color.

colorPanelDidChangeColor

-(void)colorPanelDidChangeColor:(CPNotification)aNotification
Parameters:
aNotification

colorPanelWillClose

-(void)colorPanelWillClose:(CPNotification)aNotification
Parameters:
aNotification

colorWellDidBecomeExclusive

-(void)colorWellDidBecomeExclusive:(CPNotification)aNotification
Parameters:
aNotification

deactivate

-(void)deactivate
Deactivates the color well.

drawBezelWithHighlight

-(void)drawBezelWithHighlight:(BOOL)shouldHighlight
Parameters:
shouldHighlight

drawWellInside

-(void)drawWellInside:(CGRect)aRect
Draws the colored area inside the color well without borders.
Parameters:
aRect - the location at which to draw

isActive

-(BOOL)isActive
Returns YES if the color well is active.

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

mouseDragged

-(void)mouseDragged:(CPEvent)anEvent
Notifies the receiver that the user has initiated a drag over it. A drag is a mouse movement while the left button is down.
Parameters:
anEvent - contains information about the drag

mouseUp

-(void)mouseUp:(CPEvent)anEvent
Notifies the receiver that the user has released the left mouse button.
Parameters:
anEvent - contains information about the release

setColor

-(void)setColor:(CPColor)aColor
Sets the color well's current color.
Parameters:
aColor

takeColorFrom

-(void)takeColorFrom:(id)aSender
Changes the color of the well to that of aSender.
Parameters:
aSender - the object from which to retrieve the color

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