### _________________________________________________________Xaw Plus

### The Command Widget

Application Header file Class Header file Class Class Name Superclass | <X11/XawPlus/Command.h> <X11/XawPlus/CommandP.h> commandWidgetClass Command Label

The Command widget is an rectangular area, that contains a text label or bitmap image. Those selectable areas are often referred to as "buttons". When the pointer cursor is on a button, it becomes highlighted. This highlighting indicates that the button is ready for selection. When pointer button 1 (normally the left mouse button) is pressed, the Command widget indicates that it has been selected by changing its shape so it looks like a sunken button. When the button is released, the Command widget's notify action will be invoked, calling all functions on its callback list. If the pointer is moved out of the widget before the button is released, the widget changed the shape to an unpressed button. Releasing the button has no effect in this case. This behavior allows the user to cancel an action.

### Differences between Xaw and XawPlus

Since the 3D extensions of Simple are inserted, the Command widget has the additional resources highlightColor, shadowColor and buttonBorderWidth. The default background color is now grey75. These three colors and the width of the button border are used to draw the shape of a button with the inherited methods of the Simple class. Since XawPlus only supply rectangular buttons, the resources shapeStyle and cornerRoundPercent has no meaning.

The bitmap and leftBitmap resources now also provide support of XPM styled pixmaps. These resources are inherited from the Label widget class. Look there for a description of this new feature.

Command provides tooltips. If a help text and useHelp is set in the resources, a help window is popped up after 1.2 seconds when the mouse pointer stay over the widgets window.

### Resources

When creating a Command widget instance, the following resources are retrieved from the argument list of XtSetValues() or XtVaSetValues() or from the resource database:

Name | Class | Type | Default Value
OBJECT: |  |  |
destroyCallback | Callback | Pointer | NULL
RECTANGLE: |  |  |
borderWidth height sensitive width x y | BorderWidth Height Sensitive Width Position Position | Dimension Dimension Boolean Dimension Position Position | 0 12 True 12 0 0
CORE: |  |  |
border background mappedWhenManaged | BorderColor Background MappedWhenManaged | Pixel Pixel Boolean | XtDefaultForeground grey75 True
SIMPLE: |  |  |
cursor cursorName pointerColor pointerColorBackground insensitiveBorder international highlightColor shadowColor buttonBorderWidth | Cursor Cursor Foreground Background Insensitive International Background Background Width | Cursor String Pixel Pixel Pixmap Boolean Pixel Pixel Dimension | None NULL XtDefaultForeground XtDefaultBackground NULL False grey90 grey40 2
LABEL: |  |  |
font fontset encoding foreground internalHeight internalWidth justify resize truncateLabel truncLeftSide label leftBitmap leftClipMask bitmap clipMask | Font FontSet Encoding Foreground Height Width Justify Resize Truncate Truncate Label LeftBitmap LeftBitmap Pixmap Pixmap | XFontStruct* FontSet unsigned char Pixel Dimension Dimension XtJustify Boolean Boolean Boolean String Bitmap ClipMask Bitmap ClipMask | XtDefaultFont XtDefaultFontSet XawTextEncoding8bit XtDefaultForeground 2 4 XtJustifyCenter True True False NULL None None None None
COMMAND: |  |  |
helpText helpBackground useHelp highlightThickness highlightMode callback translations accelerators ancestorSensitive | Label Background Boolean Thickness Boolean Callback Translations Accelerators AncestorSensitive | String Pixel Boolean Dimension Boolean XtCallbackList TranslationTable AcceleratorTable Boolean | NULL LightGoldenrodYellow True 2 True NULL see doc or source NULL True

helpText | The help text, used in the help popup window.
helpBackground | The background color of the help window.
useHelp | If this resource is set to True and a help text is set, the help function is activated. Command creates an override shell, containing a Label widget. The Label widget get the helpBackground resource as background color and the helpText resource as label text.
highlightMode | If this resource is set to True, the new highlighting of the command widget is activated. By default the button looks flat. If the mouse pointer enters the button, the interior looks like a raised button shape. If this resource is set to False no highlighting is available. The button shows its raised interior by default. The old hightlight mode of Xaw is not longer supported.

### Command Actions

The Command widget supports the following actions:

- Switching the button's interior between raised and sunken and flat button shape
  with set, unset and reset.
- Processing application callbacks with notify.
- Switching the internal border between highlighted and unhighlighted states with
  highlight and unhighlight.

The following are the default translation bindings used by the Command widget:

> <EnterWindow> <LeaveWindow> <Btn1Down> <Btn1Up> | highlight() reset() set() notify(), unset()

The full list of actions supported by Command is:

highlight() | Displays the interior of the button in the raised button style, if highlightMode is set to True. If not, the button is always displayed in the raised button style. In this case highlight() has no meaning. Since XawPlus 2.0 the conditions WhenUnset and Always are not longer supported.
unhighlight() | Displays a flat button border if highlightMode is set to True. If not, the button is displayed in the raised button style. In this case unhighlight() has no meaning.
set() | Enters the set state, in which notify is possible. This action causes the button to display its interior in the sunken button style.
unset() | Cancels the set state and displays the interior of the button in the raised button style.
reset() | Cancels any set or highlight and displays the interior of the button in the flat button style if highlightMode is set to True. If not, the button is displayed in the raised button style.
notify() | When the button is in the set state this action calls all functions in the callback list named by the callback resource. The value of the call_data argument passed to these functions is undefined.

In contrast to Xaw, with XawPlus the set(), unset(), and reset() actions have the same effect with a multi-plane XPM pixmap.

### Xaw Plus_________________________________________________________