Class CPControl

CPObject
    extended byCPResponder
        extended byCPView
            extended byCPControl
Direct Known Subclasses:
CPButton, CPColorWell, CPImageView, CPScroller, CPSegmentedControl, CPSlider, CPTextField, NSControl,

@implementation CPControl : CPView

CPControl is an abstract superclass used to implement user interface elements. As a subclass of CPView and CPResponder it has the ability to handle screen drawing and handling user input.


Method Summary
-(id)initWithCoder:(CPCoder)aCoder
          Initializes the control by unarchiving it from a coder.
-(id)initWithFrame:(CGRect)aFrame
          Initializes the receiver for usage with the specified bounding rectangle.
-(id)NS_initWithCoder:(CPCoder)aCoder
-(SEL)action
          Returns the receiver's target action.
-(CPTextAlignment)alignment
          Returns the receiver's alignment.
-(CPColor)backgroundColorForName:(CPString)aName
-(void)encodeWithCoder:(CPCoder)aCoder
          Archives the control to the provided coder.
-(float)floatValue
          Returns the receiver's float value.
-(CPFont)font
          Returns the receiver's font.
-(BOOL)isEnabled
          Returns YES if the receiver responds to mouse events.
-(void)mouseUp:(CPEvent)anEvent
          Notifies the receiver that the user has released the left mouse button.
-(void)sendAction:(SEL)anAction to:(id)anObject
          Causes anAction to be sent to anObject.
-(void)setAction:(SEL)anAction
          Sets the receiver's target action.
-(void)setAlignment:(CPTextAlignment)anAlignment
          Sets the receiver's alignment.
-(void)setBackgroundColor:(CPColor)aColor
          Sets the background color of the receiver.
-(void)setBackgroundColorWithName:(CPString)aName
-(void)setBackgroundColor:(CPColor)aColor forName:(CPString)aName
-(void)setEnabled:(BOOL)isEnabled
          Sets whether the receiver responds to mouse events.
-(void)setFloatValue:(float)aValue
          Sets the receiver's float value.
-(void)setFont:(CPFont)aFont
          Sets the receiver's font.
-(void)setTarget:(id)aTarget
          Sets the receiver's target.
-(void)setTextColor:(CPColor)aColor
          Sets the color of the receiver's text.
-(void)setTextShadow:(CPShadow)aTextShadow
          Sets the shadow for the receiver's text.
-(id)target
          Returns the receiver's target.
-(CPColor)textColor
          Returns the color of the receiver's text.
-(CPShadow)textShadow
          Returns the receiver's text shadow.

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


Method Detail

initWithCoder

-(id)initWithCoder:(CPCoder)aCoder
Initializes the control by unarchiving it from a coder.
Parameters:
aCoder - the coder from which to unarchive the control
Returns:
the initialized control

initWithFrame

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

NS_initWithCoder

-(id)NS_initWithCoder:(CPCoder)aCoder
Parameters:
aCoder

action

-(SEL)action
Returns the receiver's target action

alignment

-(CPTextAlignment)alignment
Returns the receiver's alignment

backgroundColorForName

-(CPColor)backgroundColorForName:(CPString)aName
Parameters:
aName

encodeWithCoder

-(void)encodeWithCoder:(CPCoder)aCoder
Archives the control to the provided coder.
Parameters:
aCoder - the coder to which the control will be archived.

floatValue

-(float)floatValue
Returns the receiver's float value

font

-(CPFont)font
Returns the receiver's font

isEnabled

-(BOOL)isEnabled
Returns YES if the receiver responds to mouse events.

mouseUp

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

sendAction

-(void)sendAction:(SEL)anAction to:(id)anObject
Causes anAction to be sent to anObject.
Parameters:
anAction - the action to send
anObject - the object to which the action will be sent

setAction

-(void)setAction:(SEL)anAction
Sets the receiver's target action
Parameters:
anAction - Sets the action message that gets sent to the target.

setAlignment

-(void)setAlignment:(CPTextAlignment)anAlignment
Sets the receiver's alignment
Parameters:
anAlignment - the receiver's alignment

setBackgroundColor

-(void)setBackgroundColor:(CPColor)aColor
Sets the background color of the receiver.
Parameters:
aColor - the new color for the receiver's background

setBackgroundColorWithName

-(void)setBackgroundColorWithName:(CPString)aName
Parameters:
aName

setBackgroundColor

-(void)setBackgroundColor:(CPColor)aColor forName:(CPString)aName
Parameters:
aColor
aName

setEnabled

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

setFloatValue

-(void)setFloatValue:(float)aValue
Sets the receiver's float value
Parameters:
aValue

setFont

-(void)setFont:(CPFont)aFont
Sets the receiver's font
Parameters:
aFont - the font for the receiver

setTarget

-(void)setTarget:(id)aTarget
Sets the receiver's target. The target receives action messages from the receiver.
Parameters:
aTarget - the object that will receive the message specified by action

setTextColor

-(void)setTextColor:(CPColor)aColor
Sets the color of the receiver's text.
Parameters:
aColor

setTextShadow

-(void)setTextShadow:(CPShadow)aTextShadow
Sets the shadow for the receiver's text.
Parameters:
aTextShadow - the text shadow

target

-(id)target
Returns the receiver's target. The target receives action messages from the receiver.

textColor

-(CPColor)textColor
Returns the color of the receiver's text

textShadow

-(CPShadow)textShadow
Returns the receiver's text shadow

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