SgColorChooser(3X)SgColorChooser(3X)NAMESgColorChooser — The ColorChooser widget class
SYNOPSIS
#include <Sgm/ColorC.h>
VERSION
This page documents the version of Sgm that accompanies Motif 1.2.
DESCRIPTION
ColorChooser is a dialog widget that provides a friendly and powerful
user interface for selecting colors. The ColorChooser provides a color
hexagon and color sliders that presents the color range in Hue, Satura‐
tion, Value, (HSV) and Red, Green, Blue, (RGB) color spaces. Because
of drawing speed considiration, the color hexagon and color sliders are
available only if running under GL. For X only configuration there are
Scale widget to replace the color sliders and there is no color
hexagon. The ColorChooser includes the following: A menu for setting
options for the color chooser. A color hexagon that provides visual
selection of the Hue and Saturation components of a color in an Hue,
Saturation, Value, (HSV) color space. Color slider for each of Hue,
Saturation, Value, Red, Green, Blue color components. The color slid‐
ers are visible depening on the user color chooser menu selection.
Each of the color sliders and the color hexagon is accompanied with a
text edit widget to view the exact value of the current color component
and to set it's numerical value. Two color swatches: one for showing
the current selected color and one for enabling the user to atore a
second color for reference. Three or four buttons
The default button labels are OK, Cancel, and Help. By default an
Apply button is also created; if the parent of the ColorChooser is a
DialogShell it is managed, and otherwise it is unmanaged. Additional
children may be added to the ColorChooser after creation. The first
child is used as a work area. The work area is placed just below the
menu bar. Additional children are laid out in the following manner:
Buttons—All XmPushButton widgets or gadgets, and their subclasses are
placed after the OK button in the order of their creation. The layout
of additional children that are not in the above categories is unde‐
fined.
The user can select a color by manipulating the color hexagon and any
of the six sliders or changing the value of a color components text
widgets.
The default configuration provides control for an HSV color space. The
Hue and Saturation are controlled by the color hexagon and the Value is
controlled by the value slider.
Selecting to view the RGB sliders provides controls over RGB color
space. Selecting both RGB and HSV slider provide Hue and Saturation
slider to manipulate the Hue and Saturation in addition the the color
hexagon.
The default value for the XmBulletinBoard resource XmNcancelButton is
the Cancel button. The default value for the XmBulletinBoard resource
XmNdefaultButton is the OK button unless.
For ColorChooser and its subclasses, the default value for XmNinitial‐
Focus is the Hue text edit area.
Classes
ColorChooser inherits behavior and resources from Core, Composite, Con‐
straint, XmManager, and XmBulletinBoard Classes.
The class pointer is sgColorChooserWidgetClass.
The class name is SgColorChooser.
New Resources
The following table defines a set of widget resources used by the pro‐
grammer to specify data. The programmer can also set the resource val‐
ues for the inherited classes to set attributes for this widget. To
reference a resource by name or by class in a .Xdefaults file, remove
the SgN or SgC prefix and use the remaining letters. To specify one of
the defined values for a resource in a .Xdefaults file, remove the Sg
prefix and use the remaining letters (in either lowercase or uppercase,
but include any underscores between words). The codes in the access
column indicate if the given resource can be set at creation time (C),
set by using XtSetValues (S), retrieved by using XtGetValues (G), or is
not applicable (N/A).
SgColorChooser Resource Set
Name Class Type Default Access
───────────────────────────────────────────────────────────────────────────────────────────────
XmNapplyCallback XmCCallback XtCallbackList NULL C
XmNapplyLabelString XmCApplyLabelString XmString dynamic CSG
XmNcancelCallback XmCCallback XtCallbackList NULL C
XmNcancelLabelString XmCCancelLabelString XmString dynamic C
XmNokCallback XmCCallback XtCallbackList NULL C
XmNokLabelString XmCOkLabelString XmString dynamic CSG
XmNvalueChangedCallback XmCCallback XtCallbackList NULL C
XmNdragCallback XmCCallback XtCallbackList NULL C
SgNshowSliders SgCShowSliders SgRShowSliders SgRGB_and_HSV CSG
SgNwysiwyg SgCWysiwyg XmRBoolean True CSG
SgNuseGl SgCUseGl XmRBoolean True CSG
SgNstoredColorLabelString XmCXmString XmString "Stored Color" CSG
SgNcurrentColorLabelString XmCXmString XmString "Current Color" CSG
SgNhueLabelString XmCXmString XmString "Hue" CSG
SgNsaturationLabelString XmCXmString XmString "Saturation" CSG
SgNvalueLabelString XmCXmString XmString "Value" CSG
SgNredLabelString XmCXmString XmString "Red" CSG
SgNgreenLabelString XmCXmString XmString "Green" CSG
SgNblueLabelString XmCXmString XmString "Blue" CSG
Specifies the list of callbacks called when the user activates the
Apply button. The callback reason is SgCR_APPLY. Specifies the string
label for the Apply button. The default for this resource depends on
the locale. In the C locale the default is "Apply". Specifies the
list of callbacks called when the user activates the Cancel button.
The callback reason is SgCR_CANCEL. Specifies the string label for the
Cancel button. The default for this resource depends on the locale.
In the C locale the default is "Cancel". Specifies the string label
for the Help button. The default for this resource depends on the
locale. In the C locale the default is "Help". Specifies the list of
callbacks called when the user activates the OK button. The callback
reason is SgCR_OK. If the selection text does not match a list item,
and SgNmustMatch is True, the SgNnoMatchCallback callbacks are called
instead. Specifies the string label for the OK button. The default
for this resource depends on the locale. In the C locale the default
is "OK". Specifies the list of callbacks called when the user selects
a color. The callback reason is XmCR_VALUE_CHANGED. A color is
selected when the user changes the value of a color component via the
color hexagon, one of the color sliders, or one of the color components
text widgets. Specifies the list of callbacks called when the user
drags the mouse over the color hexagon or one of the color sliders to
select a color. The callback reason is XmCR_DRAG. Specifies which
color slider is visible. If the useGl resource is False, then SgN‐
showSliders specifies which color scales are visible. Possible values
are: Specifies the string label for the Stored Color button. Specifies
the string label for the Current Color button. Specifies the string
label for the Hue button. Specifies the string label for the Satura‐
tion button. Specifies the string label for the Value button. Speci‐
fies the string label for the Red button. Specifies the string label
for the Green button. Specifies the string label for the Blue button.
SgValueShow only the slider for the color Value SgRGB_and_ValueShow the
Value and RGB sliders SgRGB_and_HSVShow all six sliders, the HSV and
RGB sliders Specifies whether the wysiwyg mode is True or False. If the
wysiwyg mode is True, then the sliders and hexagon change color to show
the color that will be selected in each point of the hexagon or slider.
If the wysiwyg mode is False, then the hexagon color always shows with
Value (intensity) equals 1 (maximum intensity) and the RGB sliders
shows color range of black to max RGB color component value. For exam‐
ple, if the current selected color RGB value is (100, 200, 50), then
with wysiwyg mode True the Red color slider will have the colors (0,
200, 50)-(255, 200, 50), and with wysiwyg mode False the range
(0, 0, 0) - (233, 0, 0). Note that this mode is meaninful only if
useGl resource is True. Specifies whether to set the useGl mode to
True or False. If the useGl mode is True then the color hexagon and
color sliders are visble. The color hexagon and color sliders use GL's
Gouraud shading to display the colors in the hexagon and sliders. If
useGl mode is False then the widget uses only X calls. In this case
there will be no color hexagon, and the color sliders are replaced with
XmScale widgets.
Inherited Resources
ColorChooser inherits behavior and resources from the following super‐
classes. For a complete description of each resource, refer to the man
page for that superclass.
SgBulletinBoard Resource Set
Name Class Type Default Access
──────────────────────────────────────────────────────────────────────────────────
XmNallowOverlap XmCAllowOverlap Boolean True CSG
XmNautoUnmanage XmCAutoUnmanage Boolean True CG
XmNbuttonFontList XmCButtonFontList XmFontList dynamic CSG
XmNcancelButton XmCWidget Widget dynamic SG
XmNdefaultButton XmCWidget Widget dynamic SG
XmNdefaultPosition XmCDefaultPosition Boolean True CSG
XmNdialogStyle XmCDialogStyle unsigned char dynamic CSG
XmNdialogTitle XmCDialogTitle XmString NULL CSG
XmNfocusCallback XmCCallback XtCallbackList NULL C
XmNlabelFontList XmCLabelFontList XmFontList dynamic CSG
XmNmapCallback XmCCallback XtCallbackList NULL C
XmNmarginHeight XmCMarginHeight Dimension 10 CSG
XmNmarginWidth XmCMarginWidth Dimension 10 CSG
XmNnoResize XmCNoResize Boolean False CSG
XmNresizePolicy XmCResizePolicy unsigned char XmRESIZE_ANY CSG
XmNshadowType XmCShadowType unsigned char XmSHADOW_OUT CSG
XmNtextFontList XmCTextFontList XmFontList dynamic CSG
XmNtextTranslations XmCTranslations XtTranslations NULL C
XmNunmapCallback XmCCallback XtCallbackList NULL C
XmManager Resource Set
Name Class Type Default Access
──────────────────────────────────────────────────────────────────────────────────────────────────
XmNbottomShadowColor XmCBottomShadowColor Pixel dynamic CSG
XmNbottomShadowPixmap XmCBottomShadowPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG
XmNforeground XmCForeground Pixel dynamic CSG
XmNhelpCallback XmCCallback XtCallbackList NULL C
XmNhighlightColor XmCHighlightColor Pixel dynamic CSG
XmNhighlightPixmap XmCHighlightPixmap Pixmap dynamic CSG
XmNinitialFocus XmCInitialFocus Widget dynamic CSG
XmNnavigationType XmCNavigationType XmNavigationType XmTAB_GROUP CSG
XmNshadowThickness XmCShadowThickness Dimension dynamic CSG
XmNstringDirection XmCStringDirection XmStringDirection dynamic CG
XmNtopShadowColor XmCTopShadowColor Pixel dynamic CSG
XmNtopShadowPixmap XmCTopShadowPixmap Pixmap dynamic CSG
XmNtraversalOn XmCTraversalOn Boolean True CSG
XmNunitType XmCUnitType unsigned char dynamic CSG
XmNuserData XmCUserData XtPointer NULL CSG
Composite Resource Set
Name Class Type Default Access
───────────────────────────────────────────────────────────────────────
XmNchildren XmCReadOnly WidgetList NULL G
XmNinsertPosition XmCInsertPosition XtOrderProc NULL CSG
XmNnumChildren XmCReadOnly Cardinal 0 G
Core Resource Set
Name Class Type Default Access
───────────────────────────────────────────────────────────────────────────────────────────────────────────────
XmNaccelerators XmCAccelerators XtAccelerators dynamic N/A
XmNancestorSensitive XmCSensitive Boolean dynamic G
XmNbackground XmCBackground Pixel dynamic CSG
XmNbackgroundPixmap XmCPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG
XmNborderColor XmCBorderColor Pixel XtDefaultForeground CSG
XmNborderPixmap XmCPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG
XmNborderWidth XmCBorderWidth Dimension 0 CSG
XmNcolormap XmCColormap Colormap dynamic CG
XmNdepth XmCDepth int dynamic CG
XmNdestroyCallback XmCCallback XtCallbackList NULL C
XmNheight XmCHeight Dimension dynamic CSG
XmNinitialResourcesPersistent XmCInitialResourcesPersistent Boolean True C
XmNmappedWhenManaged XmCMappedWhenManaged Boolean True CSG
XmNscreen XmCScreen Screen * dynamic CG
XmNsensitive XmCSensitive Boolean True CSG
XmNtranslations XmCTranslations XtTranslations dynamic CSG
XmNwidth XmCWidth Dimension dynamic CSG
XmNx XmCPosition Position 0 CSG
XmNy XmCPosition Position 0 CSG
Callback Information
A pointer to the following structure is passed to each callback: type‐
def struct { int reason; XEvent * event;
short r, g, b; } XmColorChooserCallbackStruct; Indicates why
the callback was invoked. Points to the XEvent that triggered the
callback. Indicates the red color component of the currently selected
color. Indicates the green color component of the currently selected
color. Indicates the blue color component of the currently selected
color.
The color components range from 0 (no intensity) to 255 (maximum inten‐
sity). This is the same range used by Iris GL (RGBColor(3G)).
Translations
XmColorChooser inherits translations from XmBulletinBoard.
Additional Behavior
The ColorChooser widget has the additional behavior described below:
Calls the activate callbacks for the cancel button if it is sensitive.
If no cancel button exists and the parent of the ColorChooser is a man‐
ager, passes the event to the parent. Calls the activate callbacks for
the button with the keyboard focus. If no button has the keyboard
focus, calls the activate callbacks for the default button if it is
sensitive. Calls the XmNokCallback callbacks with reason XmCR_OK.
Calls the XmNapplyCallback callbacks with reason XmCR_APPLY. Calls the
XmNcancelCallback callbacks with reason XmCR_CANCEL. Calls the XmN‐
helpCallback callbacks with reason XmCR_HELP. Calls the callbacks for
XmNmapCallback if the ColorChooser is a child of a Dialog shell. Calls
the callbacks for XmNunmapCallback if the ColorChooser is the child of
a DialogShell.
Virtual Bindings
The bindings for virtual keys are vendor specific. For information
about bindings for virtual buttons and keys, see VirtualBindings(3X).
RELATED INFORMATIONComposite(3X), Constraint(3X), Core(3X), XmBulletinBoard(3X), SgCreate‐
ColorChooser(3X), SgCreateColorChooserDialog(3X), XmManager(3X), SgCol‐
orChooserSetColor(3X), SgColorChooserGetColor(3X), SgColorChooser‐
SetCurrentColor(3X), SgColorChooserSetStoredColor(3X), and RGB‐
Color(3G).
SgColorChooser(3X)