PtColorSel

Superclass for color-selector widgets

Class hierarchy:

PtWidgetPtBasicPtContainerPtCompoundPtColorSel

Immediate subclasses:

For more information, see the diagram of the widget hierarchy.

PhAB icon:

None — not normally instantiated.

Public header:

<photon/PtColorSel.h>

Description:

PtColorSel is a superclass for all color-selection widgets. It defines a common interface to widgets that let you select colors. To maintain consistency, any widget that implements color selection should be a descendant of PtColorSel.

New resources:

Resource C type Pt type Default
Pt_ARG_CS_COLOR PgColor_t Scalar Pg_BLACK
Pt_ARG_CS_COLOR_MODELS PgColorModel_t *,
short
Array {Pg_CM_RGB}
Pt_ARG_CS_CURRENT_MODEL uint8_t Scalar 0
Pt_ARG_CS_FLAGS uint16_t Flags 0
Pt_ARG_CS_PALETTE PgPalette_t * Alloc NULL
Pt_CB_CS_COLOR_CHANGED PtCallback_t * Link NULL

Pt_ARG_CS_COLOR

C type Pt type Default
PgColor_t Scalar Pg_BLACK

The currently selected color. See PgColor_t in the Photon Library Reference.

Pt_ARG_CS_COLOR_MODELS

C type Pt type Default
PgColorModel_t *, short Array {Pg_CM_RGB}

A list of color models that this color selector supports. When you set a color using a color model that the selector doesn't support, the actual color can still be calculated; ensuring that the color model is supported can reduce roundoff errors if the color doesn't cleanly map between RGB and the color model in question.

In addition, this resource is useful for widgets that let you choose from the different color models that the widget supports.

The following color models are defined:

Pg_CM_RGB
Red-green-blue.
Pg_CM_HSB
Hue-saturation-brightness.
Pg_CM_HLS
Hue-lightness-saturation. A modified HSB model that's more intuitive for selecting colors in a GUI.
Pg_CM_CMYK
Cyan-magenta-yellow-black.

Here's an example of how to set this resource:

PgColorModel_t const *models[]={Pg_CM_RGB, Pg_CM_CMYK,
                                Pg_CM_HSB};

PtSetResource( my_widget, Pt_ARG_CS_COLOR_MODELS,
               models, 3 );

Pt_ARG_CS_CURRENT_MODEL

C type Pt type Default
uint8_t Scalar 0

An index to the currently active model into the array of color models that this widget supports. Indexes start at 0.

Pt_ARG_CS_FLAGS

C type Pt type Default
uint16_t Flags 0

Flags that control the widget's behavior:

Pt_CS_FAST_UPDATE
If the selector is undergoing a high-bandwidth change, do any rendering (if applicable) in a “fast” manner. This is a meta-flag that doesn't actually affect the behavior of PtColorSel itself, but may be observed by subclasses (PtColorPatch uses it to render the two-dimensional patch).
Pt_CS_QUANTIZE_COLOR
Ensure Pt_ARG_CS_COLOR is always mapped (quantized) to the nearest match in the palette if a palette is set. The PtColorSel widget always does this matching, so subclasses don't need to implement it.

Pt_ARG_CS_PALETTE

C type Pt type Default
PgPalette_t * Alloc NULL

The color palette supported by this PtColorSel. A palette serves these main purposes:

Pt_CB_CS_COLOR_CHANGED

C type Pt type Default
PtCallback_t * Link NULL

A list of PtCallback_t structures that define the callbacks that are invoked when the selected color changes.

Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:

reason
Pt_CB_CS_COLOR_CHANGED
reason_subtype
A combination of the following:
event
A pointer to a PhEvent_t structure that describes the event that caused the callback to be invoked.
cbdata
A pointer to a PtColorSelCallback_t structure that contains at least these members:

These callbacks should return Pt_CONTINUE.

Inherited resources:

If the widget modifies an inherited resource, the “Default override” column indicates the new value. This modification affects any subclasses of the widget.

Resource Inherited from Default override
Pt_ARG_ANCHOR_FLAGS PtWidget
Pt_ARG_ANCHOR_OFFSETS PtWidget
Pt_ARG_AREA PtWidget
Pt_ARG_BANDWIDTH_THRESHOLD PtBasic Not used by this class.
Pt_ARG_BASIC_FLAGS PtBasic
Pt_ARG_BEVEL_WIDTH PtWidget 0
Pt_ARG_BITMAP_CURSOR PtWidget
Pt_ARG_BEVEL_COLOR PtBasic
Pt_ARG_BEVEL_CONTRAST PtBasic
Pt_ARG_COLOR PtBasic
Pt_ARG_CONTAINER_FLAGS PtContainer
Pt_ARG_CONTRAST PtBasic
Pt_ARG_CURSOR_COLOR PtWidget
Pt_ARG_CURSOR_OVERRIDE PtContainer
Pt_ARG_CURSOR_TYPE PtWidget
Pt_ARG_DARK_BEVEL_COLOR PtBasic
Pt_ARG_DARK_FILL_COLOR PtBasic
Pt_ARG_DATA PtWidget
Pt_ARG_DIM PtWidget
Pt_ARG_EFLAGS PtWidget
Pt_ARG_EXTENT PtWidget
Pt_ARG_FILL_COLOR PtBasic
Pt_ARG_FILL_PATTERN PtBasic
Pt_ARG_FLAGS PtWidget
Pt_ARG_HEIGHT PtWidget
Pt_ARG_HELP_TOPIC PtWidget
Pt_ARG_HIGHLIGHT_ROUNDNESS PtBasic
Pt_ARG_INLINE_COLOR PtBasic
Pt_ARG_LIGHT_BEVEL_COLOR PtBasic
Pt_ARG_LIGHT_FILL_COLOR PtBasic
Pt_ARG_MARGIN_HEIGHT PtBasic
Pt_ARG_MARGIN_WIDTH PtBasic
Pt_ARG_MAXIMUM_DIM PtWidget
Pt_ARG_MINIMUM_DIM PtWidget
Pt_ARG_OUTLINE_COLOR PtBasic
Pt_ARG_POINTER PtWidget
Pt_ARG_POS PtWidget
Pt_ARG_RESIZE_FLAGS PtWidget Pt_RESIZE_XY_AS_REQUIRED
Pt_ARG_STYLE PtBasic
Pt_ARG_TITLE PtContainer
Pt_ARG_TITLE_FONT PtContainer
Pt_ARG_TRANS_PATTERN PtBasic
Pt_ARG_USER_DATA PtWidget
Pt_ARG_WIDTH PtWidget
Pt_CB_ACTIVATE PtBasic
Pt_CB_ARM PtBasic
Pt_CB_BALLOONS PtContainer
Pt_CB_BLOCKED PtWidget
Pt_CB_CHILD_ADDED_REMOVED PtContainer
Pt_CB_DESTROYED PtWidget
Pt_CB_DISARM PtBasic
Pt_CB_DND PtWidget
Pt_CB_FILTER PtWidget
Pt_CB_GOT_FOCUS PtBasic
Pt_CB_HOTKEY PtWidget
Pt_CB_IS_DESTROYED PtWidget
Pt_CB_LOST_FOCUS PtBasic
Pt_CB_MENU PtBasic
Pt_CB_OUTBOUND PtWidget
Pt_CB_RAW PtWidget
Pt_CB_REALIZED PtWidget
Pt_CB_REPEAT PtBasic
Pt_CB_RESIZE PtContainer
Pt_CB_UNREALIZED PtWidget