XmColorSelector(3X) XmColorSelector(3X)

The Color Selector widget

#include <Xm/ColorS.h>

The Color Selector widget allows users to choose a color by using either a set of RGB sliders or choosing from a list of all colors available in the rgb database. The name or rgb value, as well as the color selected, are dynamically displayed to the user as they pick and choose different colors.

Name Class Type Initial Value
blueSliderLabel SliderLabel XmString "Blue"
colorListTogLabel TogLabel XmString "Color List"
colorMode ColorMode XiColorMode XmScaleMode
colorName String String White
fileReadError FileReadError XmString "Could not read
RGB.txt file"
greenSliderLabel SliderLabel XmString "Green"
marginHeight MarginHeight VerticalDimension 2
marginWidth MarginWidth HorizontalDimension 2
noCellError NoCellError XmString "No Color Cell
Available"
redSliderLabel SliderLabel XmString "Red"
rgbFile String String /usr/lib/X11/rgb.txt
sliderTogLabel TogLabel XmString "Color Sliders"

All resource names begin with XmN and all resource class names begin with XmC.

The string appearing for the label of the blue slider

The string appearing for the label of the color list toggle

The color list can be used in either slider or list mode. Acceptable values are XmListMode and XmScaleMode. This resource allows the application to determine the mode that the color selector should use when it is created. After this point, the user may freely change modes by utilizing a pair of radio buttons in the color selector. A type converter is registered to convert the strings "ScaleMode" and "ListMode" to color modes for use with the resource database.

This resource controls the color name that is currently displayed to the user. This value can be modified to change the color displayed in the color selector or queried to find the color the user has selected. The string returned here is either a color name or a pound sign (#) followed by a set of rgb values as specified in the Xlib specification.

The message which is displayed when the Color Selector cannot read the rgb.txt file. The message is displayed at the top of the window in which the color list would normally appear.

The string appearing for the label of the green slider

This is the amount of space left between each of the children in the color selector and between the outside children and the edge of the color selector widget.

This resource controls the message which is displayed in the sample color field when the Color Selector cannot allocate a read/write color cell

The string appearing for the label of the red slider

This is the name of the file to be loaded, which contains the valid color names. Each of these names is sorted and the duplicates removed before being shown to the user.

The string appearing for the label of the color slider toggle

Widget XmCreateColorSelector( 
	Widget parent,     /* Widget id of parent for ColorSelector */
	String name,       /* Name of the created widget */
	ArgList args,      /* argument list */
	Cardinal num_args  /* number of items in argument list */
	)				 

The color selector is composed of many sub-widgets. As with all widgets, most values are passed to this widget through the argument list at creation time or via set values and are passed to each of this widget's children, although get values requests must be made on a child-by-child basis. The children of the color selector are listed below. The documentation for each of the children should be consulted for a list of resources for each child.

XmColorSelector <named by application>

XmScrolledWindow scrolled

XmScrollBar ListvScrollBar

XmScrollBar ListhScrollBar

XmList list

XmButtonBox buttonBox

XmScale scale

XmLabelGadget scale_title

XmScrollBar scale_scrollbar

XmRowColumn radioBox

XmToggleButton colorListToggle

XmToggleButton colorSlidersToggle

XmFrame colorFrame

XmLabel colorWindow

Copyright (c) 1992 by Integrated Computer Solutions, Inc.