Command widget


Application Header file <Xraw/Command.h>
Class Header file <Xraw/CommandP.h>
Class commandWidgetClass
Class Name Command
Superclass Simple --> Core

The Command widget is an area, often rectangular, 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 by drawing a rectangle around its perimeter. This highlighting indicates that the button is ready for selection. When pointer button 1 is pressed, the Command widget indicates that it has been selected by reversing its foreground and background colors. 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 reverts to its normal foreground and background colors, and releasing the button has no effect. This behavior allows the user to cancel an action.


New Resources

Name Class Type Notes Default Value
callback Callback XtCallbackList NULL
cornerRoundPercent CornerRoundPercent Dimension 25
highlightThickness Thickness Dimension A 2 (0 if Shaped)
shapeStyle ShapeStyle ShapeStyle Rectangle
callback A list of routines to be called when the notify action is invoked.
cornerRoundPercent When a ShapeStyle of roundedRectangle is used, this resource controls the radius of the rounded corner. The radius of the rounded corners is specified as a percentage of the length of the shortest side of the widget.
highlightThickness The thickness of the rectangle that is used to highlight the internal border of this widget, alerting the user that it is ready to be selected. The default value is 2 pixels if the shapeStyle is rectangle, and 0 Pixels (no highlighting) otherwise.
shapeStyle Nonrectangular buttons may be created using this resource. Nonrectangular buttons are supported only on a server that supports the Shape Extension. If nonrectangular buttons are specified for a server lacking this extension, the shape is ignored and the widgets will be rectangular. The following shapes are currently supported: XmuShapeRectangle, XmuShapeOval, XmuShapeEllipse, and XmuShapeRoundedRectangle.

Command Actions

The Command widget supports the following actions:
Switching the button's interior between the foreground and background colors 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:

        <Btn1Down>:       highlight() set()
        <Btn1Up>:         notify() unset() reset()
Old translation bindings were:
	<EnterWindow>:	highlight()
	<LeaveWindow>:	reset()
	<Btn1Down>:	set()
	<Btn1Up>:	notify() unset()

The full list of actions supported by Command is:
highlight(condition) Displays the internal highlight border in the color (foreground or background ) that contrasts with the interior color of the Command widget. The conditions WhenUnset and Always are understood by this action procedure. If no argument is passed, WhenUnset is assumed.
unhighlight() Displays the internal highlight border in the color (foreground or background ) that matches the interior color of the Command widget.
set() Enters the set state, in which notify is possible. This action causes the button to display its interior in the foreground color. The label or bitmap is displayed in the background color.
unset() Cancels the set state and displays the interior of the button in the background color. The label or bitmap is displayed in the foreground color.
reset() Cancels any set or highlight and displays the interior of the button in the background color, with the label or bitmap displayed in the foreground color.
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.

Note

When a bitmap of depth greater that one (1) is specified the set(), unset(), and reset() actions have no effect, since there are no foreground and background colors used in a multi-plane pixmap.

[
Xraw home] [Xraw widget class hierarchy]
Vladimir T. Romanovski
romsky@hp1.oea.ihep.su