Superclass for color-selector widgets
PtWidget → PtBasic → PtContainer → PtCompound → PtColorSel
Immediate subclasses:
For more information, see the diagram of the widget hierarchy.
None — not normally instantiated.
<photon/PtColorSel.h>
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.
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 |
C type | Pt type | Default |
---|---|---|
PgColor_t | Scalar | Pg_BLACK |
The currently selected color. See PgColor_t in the Photon Library Reference.
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:
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 );
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.
C type | Pt type | Default |
---|---|---|
uint16_t | Flags | 0 |
Flags that control the widget's behavior:
C type | Pt type | Default |
---|---|---|
PgPalette_t * | Alloc | NULL |
The color palette supported by this PtColorSel. A palette serves these main purposes:
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:
These callbacks should return Pt_CONTINUE.
If the widget modifies an inherited resource, the “Default override” column indicates the new value. This modification affects any subclasses of the widget.