Copyright ©1995 by NeXT Computer, Inc.  All Rights Reserved.

NXColorWell



Inherits From: Control : View : Responder : Object
Declared In: appkit/NXColorWell.h



Class Description

NXColorWell is a Control for selecting and displaying a single color value.  An example of NXColorWell is found in NXColorPanel, which uses a well to display the current color selection.  NXColorWell is available from the Palettes panel of Interface Builder.

An application can have one or more active NXColorWells.  You can activate multiple NXColorWells by invoking the activate: method with NO as its argument.  You can set the same color for all active color wells by invoking the class method activeWellsTakeColorFrom:.  You can deactivate multiple wells using the class method deactivateAllWells.  When a mouse-down event occurs in an NXColorWell, it becomes the only active well.

The mouseDown: method enables an instance of NXColorWell to send its color to another NXColorWell or any other subclass of View that implements the NXDraggingDestination protocol.

See also:  NXColorPanel



Instance Variables

NXColor color;


color The current color of the NXColorWell.



Method Types

Initializing an NXColorWell initFrame:
Multiple NXColorWells + activeWellsTakeColorFrom:
+ activeWellsTakeColorFrom:continuous:
+ deactivateAllWells
Drawing drawSelf::
drawWellInside:
Handling events acceptsFirstMouse
mouseDown:
setContinuous:
isContinuous
Activating and enabling activate:
deactivate
isActive
setEnabled:
Setting color setColor:
color
takeColorFrom:
Borders setBordered:
isBordered
Target and action setTarget:
target
setAction:
action
Archiving awake



Class Methods

activeWellsTakeColorFrom:
+ activeWellsTakeColorFrom:sender

This method changes the color of all active NXColorWells by invoking their takeColorFrom: method with sender as the argument.  Returns the NXColorWell class object.

See also:  activate:, + activeWellsTakeColorFrom:continuous:, deactivate+ deactivateAllWells, takeColorFrom:



activeWellsTakeColorFrom:continuous:
+ activeWellsTakeColorFrom:sender continuous:(BOOL)flag

If flag is YES, this method changes the color of all active NXColorWells that are continuous; If NO, all active NXColorWells, continuous or not, change their color.  NXColorWells are updated by invoking their takeColorFrom: method with sender as the argument.  Use this method in a modal event loop with YES as flag if you want active NXColorWells to continuously update to reflect the current color of sender.  Returns the NXColorWell class object.

See also:  activate:, deactivate, + deactivateAllWells, isContinuous,
setContinuous:, takeColorFrom:



deactivateAllWells
+ deactivateAllWells

Deactivates all currently active NXColorWells.  Returns the NXColorWell class object.

See also:  activate:, deactivate



Instance Methods

acceptsFirstMouse
(BOOL)acceptsFirstMouse

Returns YES.  NXColorWells by default accept mouse clicks.



action
(SEL)action

Returns the action sent by the NXColorWell to its target.



activate:
(int)activate:(int)exclusive

If exclusive is YES, this method activates the receiving NXColorWell and deactivates any other active NXColorWells.  If NO, this method activates the receiving NXColorWell and keeps previously active NXColorWells active.  Redraws the receiver.  An active NXColorWell will have its color updated when the NXColorPanel's current color changes (continuously, if set to do so).

This method returns the number of active NXColorWells.

See also:  + activeWellsTakeColorFrom:, deactivate, isContinuous



awake
awake

Performs additional initialization after the receiver is unarchived.  Returns self.



color
(NXColor)color

Returns the color of the NXColorWell.

See also:  setColor:, takeColorFrom:



deactivate
deactivate

Sets the NXColorWell to inactive and redraws it.  Returns self.



drawSelf::
drawSelf:(const NXRect *)rects :(int)rectCount

Draws the entire NXColorWell, including its border.  Returns self.



drawWellInside:
drawWellInside:(const NXRect *)insideRect

Draws the inside of the NXColorWell only, the area where the color is displayed.  Returns self.



initFrame:
initFrame:(const NXRect *)theFrame

Initializes and returns the receiver, a new instance of NXColorPanel within theFrame.  By default, the color is NX_COLORWHITE and the NXColorWell is bordered and inactive.  Returns self.



isActive
(BOOL)isActive

Returns YES if the receiving NXColorWell is active, NO if not active.

See also:  activate:



isBordered
(BOOL)isBordered

Returns YES if the receiving NXColorWell is bordered.

See also:  setBordered:



isContinuous
(BOOL)isContinuous

Returns YES if the receiving NXColorWell will update its color and send its action message to its target when the class receives the message activeWellsTakeColorFrom:sender continuous:YES.

See also:  setContinuous:



mouseDown:
mouseDown:(NXEvent *)theEvent

Makes the receiver the only active NXColorWell if theEvent is on the border of the NXColorWell; begins dragging the NXColorWell's color if theEvent is in the colored area of the NXColorWell.  When color dragging begins, this method lets the user drag the color from the NXColorWell to another NXColorWell or to another View that implements the NXDraggingDestination protocol.  Returns self.

You never invoke this method.  It's sent when an NX_MOUSEDOWN event occurs within the bounds of the NXColorWell.

See also:  activate, deactivate, isActive



setAction:
setAction:(SEL) aSelector

Sets the action method of the NXColorWell.  The action message is sent to the target by NXColorWell's takeColorFrom: method.  Returns self.



setBordered:
setBordered:(BOOL)flag

If flag is YES, sets the NXColorWell to display its border.  Redraws the receiver and returns self.



setColor:
setColor:(NXColor)color

Sets the color of the NXColorWell to color.  Redraws the receiver and returns self.



setContinuous:
setContinuous:(BOOL)flag

If flag is YES, the NXColorWell will update its color and sends its action message to its target each time the class receives an activeWellsTakeColorFrom:sender continuous:YES message.  If NO, the NXColorWell won't be updated in response to this message.  Returns self.

See also:  isContinuous



setEnabled:
setEnabled:(BOOL)flag

If flag is YES, the receiving NXColorWell is enabled.  If NO, the receiver is disabled.  An NXColorWell cannot be both disabled and active; enabling an NXColorWell doesn't activate it.  Returns self.

See also:  activate, deactivate, isActive



setTarget:
setTarget:anObject

Sets the target of the NXColorWell to anObject.  The action message is sent to the target by NXColorWell's takeColorFrom: method.  Returns self.



takeColorFrom:
takeColorFrom:sender

Causes the receiving NXColorWell to set its color by sending a color message to sender.  Sends the NXColorWell's action message to its target and returns self.

See also:  color



target
target

Returns the target of the NXColorWell.  The action message is sent to the target by NXColorWell's takeColorFrom: method. Returns self.

See also:  setTarget: