API  1.0.0
CPButton Class Reference

#import <CPButton.h>

+ Inheritance diagram for CPButton:

Instance Methods

(BOOL) - allowsMixedState
 
(CPImage- alternateImage
 
(CPString- alternateTitle
 
(CGRect) - bezelRectForBounds:
 
(unsigned) - bezelStyle
 
(CGRect) - contentRectForBounds:
 
(CPView- createEphemeralSubviewNamed:
 
(void) - encodeWithCoder:
 
(CPInteger) - highlightsBy
 
(CPImage- image
 
(BOOL) - imageDimsWhenDisabled
 
(float) - imageOffset
 
(id) - initWithCoder:
 
(id) - initWithFrame:
 
(void) - invalidateTimers
 
(BOOL) - isBordered
 
(CPString- keyEquivalent
 
(unsigned) - keyEquivalentModifierMask
 
(void) - layoutSubviews
 
(void) - mouseDown:
 
(CPInteger) - nextState
 
(void) - onContinousEvent:
 
(void) - performClick:
 
(BOOL) - performKeyEquivalent:
 
(CGRect) - rectForEphemeralSubviewNamed:
 
(void) - setAllowsMixedState:
 
(void) - setAlternateImage:
 
(void) - setAlternateTitle:
 
(void) - setBezelStyle:
 
(void) - setBordered:
 
(void) - setButtonType:
 
(void) - setControlSize:
 
(void) - setHighlightsBy:
 
(void) - setImage:
 
(void) - setImageDimsWhenDisabled:
 
(void) - setImageOffset:
 
(void) - setKeyEquivalent:
 
(void) - setKeyEquivalentModifierMask:
 
(void) - setNextState
 
(void) - setObjectValue:
 
(void) - setPeriodicDelay:interval:
 
(void) - setShowsStateBy:
 
(void) - setState:
 
(void) - setTitle:
 
(CPInteger) - showsStateBy
 
(void) - sizeToFit
 
(BOOL) - startTrackingAt:
 
(CPInteger) - state
 
(void) - stopTracking:at:mouseIsUp:
 
(CPString- title
 
(void) - viewWillMoveToWindow:
 
- Instance Methods inherited from CPControl
(BOOL) - acceptsFirstMouse:
 
(SEL) - action
 
(CPTextAlignment) - alignment
 
(CPWritingDirection) - baseWritingDirection
 
(BOOL) - continueTracking:at:
 
(CPControlSize) - controlSize
 
(double) - doubleValue
 
(float) - floatValue
 
(CPFont- font
 
(CPFormatter- formatter
 
(void) - highlight:
 
(CPCellImagePosition) - imagePosition
 
(CPUInteger) - imageScaling
 
(int) - integerValue
 
(int) - intValue
 
(BOOL) - isContinuous
 
(BOOL) - isEnabled
 
(BOOL) - isHighlighted
 
(CPLineBreakMode) - lineBreakMode
 
(unsigned) - mouseDownFlags
 
(void) - mouseEntered:
 
(void) - mouseExited:
 
(id) - objectValue
 
(BOOL) - sendAction:to:
 
(int) - sendActionOn:
 
(BOOL) - sendsActionOnEndEditing
 
(void) - setAction:
 
(void) - setAlignment:
 
(void) - setBaseWritingDirection:
 
(void) - setContinuous:
 
(void) - setDoubleValue:
 
(void) - setEnabled:
 
(void) - setFloatValue:
 
(void) - setFont:
 
(void) - setFormatter:
 
(void) - setHighlighted:
 
(void) - setImagePosition:
 
(void) - setImageScaling:
 
(void) - setIntegerValue:
 
(void) - setIntValue:
 
(void) - setLineBreakMode:
 
(void) - setSendsActionOnEndEditing:
 
(void) - setStringValue:
 
(void) - setTarget:
 
(void) - setTextColor:
 
(void) - setTextShadowColor:
 
(void) - setTextShadowOffset:
 
(void) - setVerticalAlignment:
 
(CPString- stringValue
 
(void) - takeDoubleValueFrom:
 
(void) - takeFloatValueFrom:
 
(void) - takeIntegerValueFrom:
 
(void) - takeIntValueFrom:
 
(void) - takeObjectValueFrom:
 
(void) - takeStringValueFrom:
 
(id) - target
 
(CPColor- textColor
 
(void) - textDidBeginEditing:
 
(void) - textDidChange:
 
(void) - textDidEndEditing:
 
(CPColor- textShadowColor
 
(CGSize) - textShadowOffset
 
(void) - trackMouse:
 
(BOOL) - tracksMouseOutsideOfFrame
 
(void) - unhighlightButtonTimerDidFinish:
 
(void) - updateTrackingAreas
 
(CPTextVerticalAlignment) - verticalAlignment
 
- Instance Methods inherited from CPView
(void) - addSubview:
 
(void) - addSubview:positioned:relativeTo:
 
(void) - addTrackingArea:
 
(CGRect) - adjustScroll:
 
(float) - alphaValue
 
(CAAnimation- animationForKey:
 
(CPDictionary- animations
 
(id) - animator
 
(BOOL) - autoresizesSubviews
 
(unsigned) - autoresizingMask
 
(BOOL) - autoscroll:
 
(CPColor- backgroundColor
 
(BOOL) - becomeFirstResponder
 
(CGRect) - bounds
 
(CGPoint) - boundsOrigin
 
(CGSize) - boundsSize
 
(BOOL) - canBecomeKeyView
 
(CGPoint) - center
 
(BOOL) - clipsToBounds
 
(CGPoint) - convertPoint:fromView:
 
(CGPoint) - convertPoint:toView:
 
(CGPoint) - convertPointFromBase:
 
(CGPoint) - convertPointToBase:
 
(CGRect) - convertRect:fromView:
 
(CGRect) - convertRect:toView:
 
(CGRect) - convertRectFromBase:
 
(CGRect) - convertRectToBase:
 
(CGSize) - convertSize:fromView:
 
(CGSize) - convertSize:toView:
 
(CPString- debug_description
 
(void) - didAddSubview:
 
(void) - display
 
(void) - displayIfNeeded
 
(void) - displayIfNeededInRect:
 
(void) - displayRect:
 
(void) - displayRectIgnoringOpacity:inContext:
 
(void) - dragImage:at:offset:event:pasteboard:source:slideBack:
 
(void) - dragView:at:offset:event:pasteboard:source:slideBack:
 
(void) - drawRect:
 
(CPAppearance- effectiveAppearance
 
(CPMenuItem- enclosingMenuItem
 
(CPScrollView- enclosingScrollView
 
(BOOL) - enterFullScreenMode
 
(BOOL) - enterFullScreenMode:withOptions:
 
(CPView- ephemeralSubviewNamed:
 
(void) - exitFullScreenMode
 
(void) - exitFullScreenModeWithOptions:
 
(CGRect) - frame
 
(CGPoint) - frameOrigin
 
(CGRect) - frameRectOfView:inSuperviewSize:
 
(CGSize) - frameSize
 
(CGRect) - frameWithNewSuperviewSize:
 
(BOOL) - hasCustomDrawRect
 
(BOOL) - hasCustomLayoutSubviews
 
(CPView- hitTest:
 
(BOOL) - hitTests
 
(id) - init
 
(BOOL) - inLiveResize
 
(BOOL) - isDescendantOf:
 
(BOOL) - isFlipped
 
(BOOL) - isHidden
 
(BOOL) - isHiddenOrHasHiddenAncestor
 
(BOOL) - isInFullScreenMode
 
(BOOL) - isOpaque
 
(CALayer- layer
 
(void) - layout
 
(CPView- layoutEphemeralSubviewNamed:positioned:relativeToEphemeralSubviewNamed:
 
(void) - layoutIfNeeded
 
(void) - lockFocus
 
(CPMenu- menuForEvent:
 
(BOOL) - mouseDownCanMoveWindow
 
(BOOL) - needsDisplay
 
(BOOL) - needsLayout
 
(BOOL) - needsPanelToBecomeKey
 
(CPView- nextKeyView
 
(CPView- nextValidKeyView
 
(void) - objectDidChangeTheme
 
(BOOL) - postsBoundsChangedNotifications
 
(BOOL) - postsFrameChangedNotifications
 
(CPView- previousKeyView
 
(CPView- previousValidKeyView
 
(void) - reflectScrolledClipView:
 
(CPArray) - registeredDraggedTypes
 
(void) - registerForDraggedTypes:
 
(void) - removeFromSuperview
 
(void) - removeTrackingArea:
 
(void) - replaceSubview:with:
 
(BOOL) - resignFirstResponder
 
(void) - resizeSubviewsWithOldSize:
 
(void) - resizeWithOldSuperviewSize:
 
(void) - rightMouseDown:
 
(CGSize) - scaleSize
 
(void) - scaleUnitSquareToSize:
 
(void) - scrollClipView:toPoint:
 
(void) - scrollPoint:
 
(void) - scrollRect:by:
 
(BOOL) - scrollRectToVisible:
 
(void) - setAlphaValue:
 
(void) - setAnimations:
 
(void) - setAppearance:
 
(void) - setAutoresizesSubviews:
 
(void) - setAutoresizingMask:
 
(void) - setBackgroundColor:
 
(void) - setBounds:
 
(void) - setBoundsOrigin:
 
(void) - setBoundsSize:
 
(void) - setCenter:
 
(void) - setClipsToBounds:
 
(void) - setDOMClassName:
 
(void) - setFrame:
 
(void) - setFrameOrigin:
 
(void) - setFrameSize:
 
(void) - setHidden:
 
(void) - setHitTests:
 
(void) - setLayer:
 
(void) - setNeedsDisplay:
 
(void) - setNeedsDisplayInRect:
 
(void) - setNeedsLayout
 
(void) - setNeedsLayout:
 
(void) - setNextKeyView:
 
(void) - setPostsBoundsChangedNotifications:
 
(void) - setPostsFrameChangedNotifications:
 
(void) - setScaleSize:
 
(void) - setSubviews:
 
(void) - setTag:
 
(void) - setThemeClass:
 
(BOOL) - setThemeState:
 
(void) - setToolTip:
 
(void) - setValue:forThemeAttribute:
 
(void) - setValue:forThemeAttribute:inState:
 
(void) - setWantsLayer:
 
(CPArray) - subviews
 
(CPView- superview
 
(CPInteger) - tag
 
(void) - unlockFocus
 
(void) - unregisterDraggedTypes
 
(BOOL) - unsetThemeState:
 
(void) - viewDidEndLiveResize
 
(void) - viewDidHide
 
(void) - viewDidLayout
 
(void) - viewDidMoveToSuperview
 
(void) - viewDidMoveToWindow
 
(void) - viewDidUnhide
 
(void) - viewWillDraw
 
(void) - viewWillLayout
 
(void) - viewWillMoveToSuperview:
 
(void) - viewWillStartLiveResize
 
(CPView- viewWithTag:
 
(CGRect) - visibleRect
 
(BOOL) - wantsLayer
 
(void) - willRemoveSubview:
 
(CPWindow- window
 

Class Methods

(id) + buttonWithTitle:
 
(id) + buttonWithTitle:theme:
 
(CPString+ defaultThemeClass
 
(CPDictionary+ themeAttributes
 
- Class Methods inherited from CPControl
(void) + initialize
 
- Class Methods inherited from CPView
(Class) + animatorClass
 
(CAAnimation+ defaultAnimationForKey:
 
(CPMenu+ defaultMenu
 
(BOOL) + isHighDPIDrawingEnabled
 
(CPSet) + keyPathsForValuesAffectingBounds
 
(CPSet) + keyPathsForValuesAffectingFrame
 
(void) + setHighDPIDrawingEnabled:
 

Detailed Description

CPButton is a subclass of CPControl that intercepts mouse-down events and sends an action message to a target object when it's clicked or pressed.

Definition at line 2 of file CPButton.h.

Method Documentation

◆ allowsMixedState()

- (BOOL) allowsMixedState
implementation

Returns a Boolean value indicating whether the button allows a mixed state.

Returns
YES if the button has a 'mixed' state in addition to on and off.

Definition at line 213 of file CPButton.j.

◆ alternateImage()

- (CPImage) alternateImage
implementation

Returns the image used when the button is in an alternate state.

Reimplemented in CPRadio, and CPCheckBox.

Definition at line 394 of file CPButton.j.

◆ alternateTitle()

- (CPString) alternateTitle
implementation

Definition at line 367 of file CPButton.j.

◆ bezelRectForBounds:()

- (CGRect) bezelRectForBounds: (CGRect)  bounds
implementation

Definition at line 616 of file CPButton.j.

◆ bezelStyle()

- (unsigned) bezelStyle
implementation

Provided by category CPButton(NS).

Definition at line 917 of file CPButton.j.

◆ buttonWithTitle:()

+ (id) buttonWithTitle: (CPString aTitle
implementation

Definition at line 124 of file CPButton.j.

◆ buttonWithTitle:theme:()

+ (id) buttonWithTitle: (CPString aTitle
theme: (CPTheme aTheme 
implementation

Definition at line 129 of file CPButton.j.

◆ contentRectForBounds:()

- (CGRect) contentRectForBounds: (CGRect)  bounds
implementation

Definition at line 609 of file CPButton.j.

◆ createEphemeralSubviewNamed:()

- (CPView) createEphemeralSubviewNamed: (CPString aName
implementation

Reimplemented from CPView.

Definition at line 680 of file CPButton.j.

◆ defaultThemeClass()

+ (CPString) defaultThemeClass
implementation

Reimplemented from CPView.

Reimplemented in CPRadio, CPPopUpButton, and CPCheckBox.

Definition at line 140 of file CPButton.j.

◆ encodeWithCoder:()

- (void) encodeWithCoder: (CPCoder aCoder
implementation

Archives this button into the provided coder.

Parameters
aCoderthe coder to which the button's instance data will be written.

Reimplemented from CPControl.

Reimplemented in CPRadio.

Provided by category CPButton(CPCoding).

Definition at line 998 of file CPButton.j.

◆ highlightsBy()

- (CPInteger) highlightsBy
implementation

Definition at line 447 of file CPButton.j.

◆ image()

- (CPImage) image
implementation

Reimplemented in CPRadio, and CPCheckBox.

Definition at line 377 of file CPButton.j.

◆ imageDimsWhenDisabled()

- (BOOL) imageDimsWhenDisabled
implementation

Definition at line 518 of file CPButton.j.

◆ imageOffset()

- (float) imageOffset
implementation

Definition at line 404 of file CPButton.j.

◆ initWithCoder:()

- (id) initWithCoder: (CPCoder aCoder
implementation

Initializes the button by unarchiving data from aCoder.

Parameters
aCoderthe coder containing the archived CPButton.

Reimplemented from CPControl.

Reimplemented in CPRadio, and CPPopUpButton.

Provided by category CPButton(CPCoding).

Definition at line 946 of file CPButton.j.

◆ initWithFrame:()

- (id) initWithFrame: (CGRect)  aFrame
implementation

Initializes and returns a newly allocated CPButton object with a specified frame rectangle.

Parameters
aFrameThe frame rectangle for the created button object.
Returns
An initialized CPView object or nil if the object couldn't be created.

Reimplemented from CPControl.

Reimplemented in CPRadio, CPDisclosureButton, CPPopUpButton, and CPCheckBox.

Definition at line 161 of file CPButton.j.

◆ invalidateTimers()

- (void) invalidateTimers
implementation

Definition at line 594 of file CPButton.j.

◆ isBordered()

- (BOOL) isBordered
implementation

Definition at line 776 of file CPButton.j.

◆ keyEquivalent()

- (CPString) keyEquivalent
implementation

Returns the keyboard shortcut for this button.

Definition at line 816 of file CPButton.j.

◆ keyEquivalentModifierMask()

- (unsigned) keyEquivalentModifierMask
implementation

Sets the mask to be used with this button's key equivalent.

Definition at line 832 of file CPButton.j.

◆ layoutSubviews()

- (void) layoutSubviews
implementation

Reimplemented from CPView.

Definition at line 694 of file CPButton.j.

◆ mouseDown:()

- (void) mouseDown: (CPEvent anEvent
implementation

Reimplemented from CPControl.

Reimplemented in CPPopUpButton.

Definition at line 529 of file CPButton.j.

◆ nextState()

- (CPInteger) nextState
implementation

Returns the button's next state.

Returns
The button's state. A button can have two or three states. If it has two, this value is either CPOffState (the normal or unpressed state) or CPOnState (the alternate or pressed state). If it has three, this value can be CPOnState (the feature is in effect everywhere), CPOffState (the feature is in effect nowhere), or CPMixedState (the feature is in effect somewhere).

Reimplemented from CPControl.

Reimplemented in CPRadio.

Definition at line 287 of file CPButton.j.

◆ onContinousEvent:()

- (void) onContinousEvent: (CPTimer aTimer
implementation

Definition at line 545 of file CPButton.j.

◆ performClick:()

- (void) performClick: (id)  sender
implementation

Perform a click on the receiver.

Parameters
sender- The sender object

Reimplemented from CPControl.

Definition at line 860 of file CPButton.j.

◆ performKeyEquivalent:()

- (BOOL) performKeyEquivalent: (CPEvent anEvent
implementation

Checks the button's key equivalent against that in the event, and if they match simulates a button click.

Reimplemented from CPView.

Definition at line 841 of file CPButton.j.

◆ rectForEphemeralSubviewNamed:()

- (CGRect) rectForEphemeralSubviewNamed: (CPString aName
implementation

Reimplemented from CPView.

Definition at line 669 of file CPButton.j.

◆ setAllowsMixedState:()

- (void) setAllowsMixedState: (BOOL)  aFlag
implementation

Sets whether the button can have a 'mixed' state.

Parameters
aFlagspecifies whether a 'mixed' state is allowed or not

Definition at line 222 of file CPButton.j.

◆ setAlternateImage:()

- (void) setAlternateImage: (CPImage anImage
implementation

Sets the button's image which is used in its alternate state.

Parameters
anImagethe image to be used while the button is in an alternate state

Definition at line 386 of file CPButton.j.

◆ setAlternateTitle:()

- (void) setAlternateTitle: (CPString aTitle
implementation

Definition at line 356 of file CPButton.j.

◆ setBezelStyle:()

- (void) setBezelStyle: (unsigned)  aBezelStyle
implementation

Provided by category CPButton(NS).

Definition at line 900 of file CPButton.j.

◆ setBordered:()

- (void) setBordered: (BOOL)  shouldBeBordered
implementation

Definition at line 768 of file CPButton.j.

◆ setButtonType:()

- (void) setButtonType: (CPButtonType)  aButtonType
implementation

Definition at line 452 of file CPButton.j.

◆ setControlSize:()

- (void) setControlSize: (CPControlSize)  aControlSize
implementation

Sets the control's size.

Parameters
aControlSizethe control's size

Reimplemented from CPControl.

Definition at line 197 of file CPButton.j.

◆ setHighlightsBy:()

- (void) setHighlightsBy: (CPInteger)  aMask
implementation

Definition at line 433 of file CPButton.j.

◆ setImage:()

- (void) setImage: (CPImage anImage
implementation

Reimplemented in CPPopUpButton.

Definition at line 372 of file CPButton.j.

◆ setImageDimsWhenDisabled:()

- (void) setImageDimsWhenDisabled: (BOOL)  imageShouldDimWhenDisabled
implementation

Definition at line 502 of file CPButton.j.

◆ setImageOffset:()

- (void) setImageOffset: (float)  theImageOffset
implementation

Definition at line 399 of file CPButton.j.

◆ setKeyEquivalent:()

- (void) setKeyEquivalent: (CPString aString
implementation

Sets the keyboard shortcut for this button. For special keys see CPEvent.j CP...FunctionKey and CPText.j CP...Character.

Parameters
aStringthe keyboard shortcut as a string

Definition at line 787 of file CPButton.j.

◆ setKeyEquivalentModifierMask:()

- (void) setKeyEquivalentModifierMask: (unsigned)  aMask
implementation

Returns the mask used with this button's key equivalent.

Definition at line 824 of file CPButton.j.

◆ setNextState()

- (void) setNextState
implementation

Sets the button's state to the next available state.

Parameters
aStatePossible states are any of the CPButton globals: CPOffState, CPOnState, CPMixedState

Definition at line 304 of file CPButton.j.

◆ setObjectValue:()

- (void) setObjectValue: (id)  anObjectValue
implementation

Sets the value of the button using an Objective-J object.

Parameters
anObjectValueThe value of the button interpreted as an Objective-J object.

Reimplemented from CPControl.

Reimplemented in CPRadio, and CPPopUpButton.

Definition at line 239 of file CPButton.j.

◆ setPeriodicDelay:interval:()

- (void) setPeriodicDelay: (float)  aDelay
interval: (float)  anInterval 
implementation

Definition at line 523 of file CPButton.j.

◆ setShowsStateBy:()

- (void) setShowsStateBy: (CPInteger)  aMask
implementation

Definition at line 409 of file CPButton.j.

◆ setState:()

- (void) setState: (CPInteger)  aState
implementation

Sets the button's state to aState.

Parameters
aStatePossible states are any of the CPButton globals: CPOffState, CPOnState, CPMixedState

Reimplemented from CPControl.

Reimplemented in CPDisclosureButton.

Definition at line 317 of file CPButton.j.

◆ setTitle:()

- (void) setTitle: (CPString aTitle
implementation

Sets the title displayed by the button when in its normal state.

Parameters
aTitleThe string to set as the button's title. This title is always shown on buttons that don’t use their alternate contents when highlighting or displaying their alternate state.

Reimplemented in CPPopUpButton.

Definition at line 335 of file CPButton.j.

◆ showsStateBy()

- (CPInteger) showsStateBy
implementation

Definition at line 428 of file CPButton.j.

◆ sizeToFit()

- (void) sizeToFit
implementation

Adjust the size of the button to fit the title and surrounding button image.

Definition at line 659 of file CPButton.j.

◆ startTrackingAt:()

- (BOOL) startTrackingAt: (CGPoint)  aPoint
implementation

Reimplemented from CPControl.

Reimplemented in CPRadio, and CPCheckBox.

Definition at line 551 of file CPButton.j.

◆ state()

- (CPInteger) state
implementation

Returns the button's current state

Definition at line 325 of file CPButton.j.

◆ stopTracking:at:mouseIsUp:()

- (void) stopTracking: (CGPoint)  lastPoint
at: (CGPoint)  aPoint
mouseIsUp: (BOOL)  mouseIsUp 
implementation

Reimplemented from CPControl.

Definition at line 575 of file CPButton.j.

◆ themeAttributes()

+ (CPDictionary) themeAttributes
implementation

Reimplemented from CPControl.

Definition at line 145 of file CPButton.j.

◆ title()

- (CPString) title
implementation

Returns the title displayed on the button when it’s in its normal state.

Returns
The title displayed on the receiver when it’s in its normal state or the empty string if the button doesn’t display a title.

Definition at line 351 of file CPButton.j.

◆ viewWillMoveToWindow:()

- (void) viewWillMoveToWindow: (CPWindow aWindow
implementation

Called when the receiver is about to be moved to a new window.

Parameters
aWindowthe window to which the receiver will be moved.

Reimplemented from CPView.

Definition at line 799 of file CPButton.j.


The documentation for this class was generated from the following files: