_____________________________________________________XawPlus

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 core extension class Add3dExt is 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 an inherited method of the Add3dExt class. Since XawPlus only supply rectangular buttons, the resources shapeStyle and cornerRoundPercent lost their 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.

Since release 1.5 this widget provide a help function. If a help text and useHelp is set in the resources, a help window is popped up afer 1.2 seconds when the mouse pointer stay over the widgets window.

Since release 2.0 command has a new highlight mode. The old highlight mode is not longer available. By default a button now looks flat like a label. If the mouse pointer enters the widgets window, a raised button shape is displayed.

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
ADD3DEXT:
highlightColor
shadowColor
buttonBorderWidth
Background
Background
Width
Pixel
Pixel
Dimension
grey90
grey40
2
SIMPLE:
cursor
cursorName
pointerColor
pointerColorBackground
insensitiveBorder
Cursor
Cursor
Foreground
Background
Insensitive
Cursor
String
Pixel
Pixel
Pixmap
None
NULL
XtDefaultForeground
XtDefaultBackground
NULL
LABEL:
internalHeight
internalWidth
justify
resize
truncateLabel
truncLeftSide
font
encoding
foreground
label
leftBitmap
leftClipMask
bitmap
clipMask
Height
Width
Justify
Resize
Truncate
Truncate
Font
Encoding
Foreground
Label
LeftBitmap
LeftBitmap
Pixmap
Pixmap
Dimension
Dimension
XtJustify
Boolean
Boolean
Boolean
XFontStruct*
unsigned char
Pixel
String
Bitmap
ClipMask
Bitmap
ClipMask
2
4
XtJustifyCenter
True
True
False
XtDefaultFont
XawTextEncoding8bit
XtDefaultForeground
NULL
None
None
None
None
COMMAND:
helpText
helpEncoding
helpBackground
useHelp
highlightThickness
highlightMode
callback
translations
accelerators
ancestorSensitive
Label
Encoding
Background
Boolean
Thickness
Boolean
Callback
Translations
Accelerators
AncestorSensitive
String
unsigned char
Pixel
Boolean
Dimension
Boolean
XtCallbackList
TranslationTable
AcceleratorTable
Boolean
NULL
XawTextEncoding8bit
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:

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.

XawPlus_____________________________________________________