Up
Authors
- Scott Christley (
scottc@net-community.com)
-
- Felipe A. Rodriguez (
far@ix.netcom.com)
-
Date: Generated at 2025-12-03
Control for selecting and display a single color value.
Copyright: (C) 1996 Free Software Foundation, Inc.
- Declared in:
- AppKit/NSColorWell.h
- Conforms to:
- NSCoding
Availability: OpenStep
NSColorWell provides a simple, compact interface
for displaying and selecting colors within applications.
It appears as a rectangular well that displays the current
color and allows users to click to open the system
color panel for color selection. Key features include:
* Visual color display with customizable border appearance
* Integration with the system color panel for color
selection * Drag-and-drop color support for easy
color sharing * Activation/deactivation states for
color panel interaction * Target-action pattern for
color change notifications * Automatic color well
management and exclusivity handling * Support for
both bordered and borderless display styles * Full
integration with Interface Builder and archiving
Color wells can be activated to connect with the shared
color panel, allowing users to select new colors
through the full range of system color pickers. The
well automatically manages its activation state and
ensures only one color well is active at a time when
exclusive activation is used. The control supports
standard target-action patterns, sending action
messages when the color changes. Color wells also
participate in the responder chain and can take
colors from other controls that implement the color
sharing protocol. Visual appearance can be customized
with bordered or borderless styles, making color wells
suitable for various interface designs from utility
panels to integrated application interfaces.
NSColorWell declares 7 Instance Variables
- (void)
activate: (BOOL)exclusive;
Availability: OpenStep
Activates the color well to connect with the
shared color panel. exclusive:
YES to
deactivate other color wells,
NO to
allow multiple active wells
Activates the NSColorWell and displays the
NSColorPanel with the current NSColorWell's
color. The NSColorWell can take color from the
NSColorPanel. If exclusive is
YES other NSColorWells are
desacivated (through notifications).
See Also:
-deactivate
- (
NSColor*)
color;
Availability: OpenStep
Returns the current color displayed in the color
well. Returns: The NSColor currently shown in the
well
Returns the current NSColor of the NSColorWell.
See Also:
-setColor:
- (void)
deactivate;
Availability: OpenStep
Deactivates the color well, disconnecting it
from the color panel.
Deactivates the NSColorWell and marks self
for display. It is usally call from an observer, when
another NSColorWell is activate.
See Also:
-activate:
- (void)
drawWellInside: (
NSRect)insideRect;
Availability: OpenStep
Draws the color well's interior within the specified
rectangle. insideRect: The rectangle defining
the interior area to draw the color
Draws the NSColorWell inside the rectangle
insideRect.
See Also:
[NSColor -drawSwatchInRect:]
- (void)
encodeWithCoder: (
NSCoder*)aCoder;
Availability: OpenStep
Encodes the color well's state to the specified
coder. aCoder: The coder to write the color well's
data to
- (id)
initWithCoder: (
NSCoder*)aDecoder;
Availability: OpenStep
Initializes a color well from data in the
specified decoder. aDecoder: The decoder
containing the color well's archived data
Returns: An initialized NSColorWell instance, or
nil if initialization fails
- (BOOL)
isActive;
Availability: OpenStep
Returns whether the color well is currently active.
Returns:
YES if the color well is
connected to the color panel,
NO
otherwise
Returns whether the NSColorWell is active. By
default a NSColorWell is not active.
See Also:
-activate:
-deactivate
- (BOOL)
isBordered;
Availability: OpenStep
Returns whether the color well displays a border.
Returns:
YES if the well has a
border,
NO for borderless display
Returns whether the NSColorWell has border. By
default a NSColorWell has border.
See Also:
-setBordered:
- (void)
setBordered: (BOOL)bordered;
Availability: OpenStep
Sets whether the color well should display a border.
bordered:
YES to show a border
around the well,
NO for borderless
appearance
Sets whether the NSColorWell has border and marks
self for display. By default a NSColorWell has
border.
See Also:
-isBordered
- (void)
setColor: (
NSColor*)color;
Availability: OpenStep
Sets the
color to display in the
color well. color: The NSColor to display
in the well
Sets the NSColorWell to color and marks
self for display.
Sets the NSColorPanel if
active.
Does NOT notify target of
color change.
See Also: -color
- (void)
takeColorFrom: (id)sender;
Availability: OpenStep
Takes the color from the specified
sender
object. sender: An object that responds to the
-color
method to provide a color
Sets the NSColorWell's color to the
sender color.
See Also:
-setColor:
Instance Variables for NSColorWell Class
@protected SEL
_action;
Availability: OpenStep
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
@protected BOOL
_is_active;
Availability: OpenStep
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
@protected BOOL
_is_bordered;
Availability: OpenStep
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
@protected NSPoint
_mouseDownPoint;
Availability: OpenStep
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
@protected id
_target;
Availability: OpenStep
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
@protected NSColor*
_the_color;
Availability: OpenStep
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
@protected NSRect
_wellRect;
Availability: OpenStep
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
Up