DwtColorMixCreate(3Dwt)
Name
DwtColorMixCreate − Creates a color mixing widget.
Syntax
Widget DwtColorMixCreate (parent_widget, name,
override_arglist, override_argcount)
Widget parent_widget;
char *name;
ArgList override_arglist;
int override_argcount;
Arguments
parent_widget
Specifies the parent widget ID.
nameSpecifies the name of the created widget.
override_arglist
Specifies the application override argument list.
override_argcount
Specifies the number of attributes in the application override argument list (override_arglist).
Description
The DwtColorMixCreate function creates a color mixing widget and returns its associated widget ID. Note that unlike most of the other widgets in the XUI toolkit, a color mixing widget cannot be created with a high-level function. When calling DwtColorMixCreate, you specify a list of attribute name/value pairs that represents all the possible color mixing widget attributes.
The color mixing widget is a composite widget; that is, it is composed of a parent widget and several child widgets at creation time. The parent widget is a pop-up dialog box that has some labels, handles geometry management, calls back to the application and contains the following child widgets by default:
•A color display subwidget that displays the colors being mixed
•A color mixer subwidget that allows the user to specify colors
•An optional work area widget
While the color mixing widget contains these three child widgets by default, the application can replace either or both the color display and color mixer subwidgets. Thus, applications can provide any type of color display or color mixer tool model.
The default color display widget displays both the original color (the color value supplied by the application when the mixing began) and the current new color. Applications can set the following values:
•The original color values for red, green, and blue
•The new color values for red, green, and blue
•The background color of the display widget
•The dimensions of the color display windows and background area
If the display device is a gray scale, pseudo color, or static color device, the color display widget allocates a maximum of three color cells whenever it becomes managed. If fewer than three color cells are available, the order of precedence is as follows:
1Original color cell
2New color cell
3Background color cell
These color cells are deallocated whenever the widget becomes unmanaged.
If an application replaces the default color display subwidget, the application may provide a function to allow the color mixing widget to pass the current new color value from the color mixer subwidget. Otherwise, the color mixing widget cannot inform the color display subwidget of color changes. The application can return to the default color display subwidget at any time by using XtSetValues to set DwtNdisplayWindow to NULL.
The default RGB color mixer subwidget provides three scales, each of which represents a percentage of red, green, and blue. Users may also type in the actual X color values (0 to 65535) in the entry fields. When color mixing begins, the color mixer subwidget is set to the current new color values.
If an application replaces the default color mixer subwidget, the new color mixer subwidget must inform the color mixing widget of changes to the current color value. The fastest way to do this is to call the convenience function DwtColorMixSetNewColor, although you can also use XtSetValues. The application can return to the default color mixer subwidget at any time by using XtSetValues to set DwtNmixerWindow to NULL.
Note that setting DwtNdisplayWindow and DwtNmixerWindow to NULL when the color mixing widget is created results in no color display subwidget and no color mixer subwidget. Setting these attributes to NULL after the color mixing widget is created results in returning to the default color display and color mixer subwidgets.
The color mixing widget runs on any XUI display device. On gray scale devices, the default color display subwidget shows the RGB values in gray scale. On static gray (monochrome) devices, the default color display subwidget is not visible.
As far as geometry management is concerned, the color mixing widget conforms to the size of its children.
As far as resizing is concerned, the color mixing widget uses the dialog box shrink wrap mode. It expands and shrinks relative to the size of its children.
Inherited Attributes
| Attribute Name | Data Type | Default |
| Core Attributes | ||
| DwtNx | Position | Determined by the geometry manager |
| DwtNy | Position | Determined by the geometry manager |
| DwtNwidth | Dimension | Zero pixels |
| DwtNheight | Dimension | Zero pixels |
| DwtNborderWidth | Dimension | One pixel |
| DwtNborder | Pixel | Default foreground color |
| DwtNborderPixmap | Pixmap | NULL |
| DwtNbackground | Pixel | Default background color |
| DwtNbackgroundPixmap | Pixmap | NULL |
| DwtNcolormap | Colormap | Default color map |
| DwtNsensitive | Boolean | True |
| DwtNancestorSensitive | Boolean | The bitwise AND of the parent widget’s DwtNsensitive and DwtNancestorSensitive attributes |
| DwtNaccelerators | XtTranslations | NULL |
| DwtNdepth | int | Depth of the parent window |
| DwtNtranslations | XtTranslations | NULL |
| DwtNmappedWhenManaged | Boolean | True |
| DwtNscreen | Screen * | The parent screen |
| DwtNdestroyCallback | DwtCallbackPtr | NULL |
| Dialog Box Pop-Up Attributes | ||
| DwtNforeground | Pixel | Default foreground color |
| DwtNhighlight | Pixel | Default foreground color |
| DwtNhighlightPixmap | Pixmap | NULL |
| DwtNuserData | Opaque * | NULL |
| DwtNdirectionRToL | unsigned char | DwtDirectionRightDown |
| DwtNfont | DwtFontList | The default XUI Toolkit font |
| DwtNhelpCallback | DwtCallbackPtr | NULL |
| DwtNunits | unsigned char | DwtFontUnits |
| DwtNstyle | unsigned char | DwtModeless |
| DwtNfocusCallback | DwtCallbackPtr | NULL |
| DwtNtextMergeTranslations | XtTranslations | NULL |
| DwtNmarginWidth | Dimension | 10 pixels |
| DwtNmarginHeight | Dimension | 10 pixels |
| DwtNdefaultPosition | Boolean | False |
| DwtNchildOverlap | Boolean | True |
| DwtNresize | unsigned char | DwtResizeShrinkWrap |
| DwtNnoResize | Boolean | True |
| DwtNtitle | DwtCompString | "Color Mixing" |
| DwtNmapCallback | DwtCallbackPtr | NULL |
| DwtNunmapCallback | DwtCallbackPtr | NULL |
| DwtNtakeFocus | Boolean | True for modal dialog box |
| False for modeless dialog box |
||
| DwtNautoUnmanage | Boolean | False |
| DwtNdefaultButton | Widget | NULL |
| DwtNcancelButton | Widget | NULL |
| DwtNgrabKeySyms | KeySym | The default array contains the Tab key symbol. |
| DwtNgrabMergeTranslations | XtTranslations | The default syntax is: "~Shift<KeyPress>0xff09: DWTDIMOVEFOCUSNEXT()\\n\\ Shift<KeyPress>0xff09: DWTDIMOVEFOCUSPREV()"; |
Widget-Specific Attributes
| Attribute Name | Data Type | Default |
| DwtNmainLabel | DwtCompString | NULL |
| DwtNdisplayLabel | DwtCompString | NULL |
| DwtNmixerLabel | DwtCompString | NULL |
| DwtNorigRedValue | unsigned short | Zero |
| DwtNorigGreenValue | unsigned short | Zero |
| DwtNorigBlueValue | unsigned short | Zero |
| DwtNnewRedValue | unsigned short | Zero, unless DwtNmatchColors is True, in which case DwtNnewRedValue is set to match DwtNorigRedValue whenever the widget is created and mapped. |
| DwtNnewGreenValue | unsigned short | Zero, unless DwtNmatchColors is True, in which case DwtNnewGreenValue is set to match DwtNorigGreenValue whenever the widget is created and mapped. |
| DwtNnewBlueValue | unsigned short | Zero, unless DwtNmatchColors is True, in which case DwtNnewBlueValue is set to match DwtNorigBlueValue whenever the widget is created and mapped. |
| DwtNdisplayWindow | Widget | The color mixing widget display subwidget |
| DwtNsetNewColorProc | char * | The function used by the color mixing widget to update the new color values displayed in the color display subwidget. |
| DwtNmixerWindow | Widget | The color mixing widget’s RGB color mixer subwidget |
| DwtNworkWindow | Widget | NULL |
| DwtNokLabel | DwtCompString | "OK" |
| DwtNapplyLabel | DwtCompString | "Apply" |
| DwtNresetLabel | DwtCompString | "Reset" |
| DwtNcancelLabel | DwtCompString | "Cancel" |
| DwtNokCallback | DwtCallbackPtr | NULL |
| DwtNapplyCallback | DwtCallbackPtr | NULL |
| DwtNcancelCallback | DwtCallbackPtr | NULL |
| DwtNmatchColors | Boolean | True This attribute can be set only if the default color display widget is used. |
| DwtNresize | unsigned short | Gray (32767) This attribute can be set only if the default color display widget is used. |
| DwtNbackGreenValue | unsigned short | Gray (32767) This attribute can be set only if the default color display widget is used. |
| DwtNbackBlueValue | unsigned short | Gray (32767) This attribute can be set only if the default color display widget is used. |
| DwtNdisplayColWinWidth | Dimension | 80 pixels This attribute can be set only if the default color display widget is used. |
| DwtNdisplayColWinHeight | Dimension | 80 pixels This attribute can be set only if the default color display widget is used. |
| DwtNdispWinMargin | Dimension | 20 pixels This attribute can be set only if the default color display widget is used. |
| DwtNsliderLabel | DwtCompString | "Percentage" This attribute can be set only if the default color mix tool widget is used. |
| DwtNvalueLabel | DwtCompString | "Value" This attribute can be set only if the default color mix tool widget is used. |
| DwtNredLabel | DwtCompString | "Red" This attribute can be set only if the default color mix tool widget is used. |
| DwtNgreenLabel | DwtCompString | "Green" This attribute can be set only if the default color mix tool widget is used. |
| DwtNblueLabel | DwtCompString | "Blue" This attribute can be set only if the default color mix tool widget is used. |
DwtNmainLabelSpecifies the text of the main label, which is centered at the top of the color mixing widget.
DwtNdisplayLabel
Specifies the text of the label centered above the color display widget.
DwtNmixerLabelSpecifies the text of the label centered color mixing widget.
DwtNorigRedValue
Specifies the original red color value for the color mixing widget. Applications should set the original red value.
DwtNorigGreenValue
Specifies the original green color value for the color mixing widget. Applications should set the original green value.
DwtNorigBlueValue
Specifies the original blue color value for the color mixing widget. Applications should set the original blue value.
DwtNnewRedValue
Specifies the new red color value for the color mixing widget.
DwtNnewGreenValue
Specifies the new green color value for the color mixing widget.
DwtNnewBlueValue
Specifies the new blue color value for the color mixing widget.
DwtNdisplayWindow
Specifies the color display widget. Setting this attribute to NULL at widget creation time causes the color display widget to not be displayed.
If an application substitutes its own color display widget for the default color display widget, the application is responsible for managing the widget, that is, making it visible and controlling its geometry management. An application can return to the default color display widget by using XtSetValues to set this attribute to NULL.
DwtNsetNewColorProc
Specifies the function used by the color mixing widget to update the new color values displayed in the color display subwidget. If the application replaces the default color display subwidget and wants the color mixing widget to update the new color, the application must set this attribute. Otherwise, replacing the default color display subwidget sets this attribute to NULL.
DwtNmixerWindow
Specifies the color mixer subwidget. The default color mixer subwidget is based on the red, green, and blue (RGB) color model. Setting this attribute to NULL at widget creation time causes the color mixer subwidget to not be displayed.
If an application substitutes its own color mixer subwidget for the default color mixer subwidget, the application is responsible for managing the widget, that is, making it visible and controlling its geometry management. An application can later return to the default color mixer subwidget by using XtSetValues to set this attribute to NULL.
Applications that use the default color mixer subwidget need not worry about updating the new color. However, applications that provide their own color mixer subwidget are responsible for updating the new color. Applications can do this by using either XtSetValues or DwtColorMixSetNewColor. Using DwtColorMixSetNewColor is recommended because it is more efficient.
DwtNworkWindowSpecifies an optional work area widget. If this attribute is set and the application manages this widget, the work window is placed below the color display and color mixer subwidgets (if present) and above the color mixing widget push buttons.
DwtNokLabelSpecifies the label for the OK push button.
DwtNapplyLabelSpecifies the label for the Apply push button.
DwtNresetLabelSpecifies the label for the Reset push button.
DwtNcancelLabel
Specifies the label for the Cancel push button.
DwtNokCallbackSpecifies the callback function or functions called when the user clicks on the OK push button. For this callback, the reason is DwtCRActivate.
DwtNapplyCallback
Specifies the callback function or functions called when the user clicks on the Apply push button. For this callback, the reason is DwtCRApply.
DwtNcancelCallback
Specifies the callback function or functions called when the user clicks on the Cancel button. For this callback, the reason is DwtCRCancel.
DwtNmatchColors
Specifies a boolean value that, when True, indicates that the new color values are matched to original color values. If False, new color values are not matched to original color values.
This attribute can be set only if the default color display widget is used.
DwtNbackRedValue
Specifies the default color display widget’s red background color. This attribute can be set only if the default color display widget is used.
DwtNbackGreenValue
Specifies the default color display widget’s green background color. This attribute can be set only if the default color display widget is used.
DwtNbackBlueValue
Specifies the default color display widget’s blue background color. This attribute can be set only if the default color display widget is used.
DwtNdisplayColWinWidth
Specifies the width of the original and new color display windows. This attribute can be set only if the default color display widget is used.
DwtNdisplayColWinHeight
Specifies the height of the original and new color display windows. This attribute can be set only if the default color display widget is used.
DwtNdispWinMargin
Specifies the margin between the original and the new color display windows and the edge of the color display widget. The margin is the area affected by the background attributes (set gray by default).
This attribute can be set only if the default color display widget is used.
DwtNsliderLabel
Specifies the text of the label above the slider representing the RGB scales. This attribute can be set only if the default color mix tool widget is used.
DwtNvalueLabelSpecifies the text of the label above the RGB text entry fields. This attribute can be set only if the default color mix tool widget is used.
DwtNredLabelSpecifies the label for the RGB red scale widget. This attribute can be set only if the default color mix tool widget is used.
DwtNgreenLabelSpecifies the label for the RGB green scale widget. This attribute can be set only if the default color mix tool widget is used.
DwtNblueLabelSpecifies the label for the RGB blue scale widget. This attribute can be set only if the default color mix tool widget is used.
Return Values
This function returns the ID of the created widget.
Callback Information
The following structure is returned to your callback:
typedef struct {
int reason;
XEvent *event;
unsigned short newred;
unsigned short newgrn;
unsigned short newblu;
unsigned short origred;
unsigned short origgrn;
unsigned short origblu;
} DwtColorMixCallbackStruct;
The reason member is set to a constant that represents the reason why this callback was invoked. For this callback, the reason member can be set to:
| DwtCRActivate | The user has activated the OK push button. |
| DwtCRApply | The user has selected the Apply push button. |
| DwtCRCancel | The user has activated the Cancel push button. |
The event member is a pointer to the Xlib structure XEvent, which describes the event that generated this callback. This structure is a union of the individual structures declared for each event type. For information on XEvent and event processing, see the Guide to the Xlib Library: C Language Binding.
The newred member is set to the new red color value for the color mix widget. The newgrn member is set to the new green color value for the color mix widget. The newblu member is set to the new blue color value for the color mix widget.
The origred member is set to the original red color value for the color mix widget. The origgrn member is set to the original green color value for the color mix widget. The origblu member is set to the original blue color value for the color mix widget.
See Also
DwtColorMixSetNewColor (3Dwt), DwtColorMixGetNewColor (3Dwt)
Guide to the XUI Toolkit: C Language Binding
Guide to the XUI Toolkit Intrinsics: C Language Binding