Name

ExmCommandButton — The ExmCommandButton widget class

Synopsis

#include <Exm/CommandB.h>

DESCRIPTION

ExmCommandButton is a demonstration widget. OSF provides this widget solely to teach programmers how to write their own Motif widgets. OSF does not support this widget in any way.

The source code for the ExmCommandButton widget illustrates how to do the following:

  • Create a Motif button widget. Such a button widget could serve, for example, as an OK button in a Dialog box.

  • Establish Motif-style actions for buttons.

  • Install the XmQTactivatable trait.

  • Install the XmQTtakesDefault trait.

  • Establish a simple Motif activate callback.

ExmCommandButton is an instantiable widget.

ExmCommandButton is a subclass of the ExmString widget and is also used as a superclass for other widgets, such as ExmTabButton. Therefore, ExmCommandButton inherits all of ExmString's resources for rendering compound strings. ExmCommandButton provides many action methods, but ExmString does not.

When a user activates an ExmCommandButton widget, the widget calls the callback procedure associated with the XmNactivateCallback resource.

Classes

CommandButton inherits behavior and resources from Core, XmPrimitive, ExmSimple, and ExmString.

The class pointer is exmCommandButtonWidgetClass.

The class name is ExmCommandButton.

New Resources

The following table defines a set of widget resources used by the programmer to specify data. The programmer can also set the resource values for the inherited classes to set attributes for this widget. To reference a resource by name or by class in a .Xdefaults file, remove the XmN, ExmN, XmC or ExmC prefix and use the remaining letters. To specify one of the defined values for a resource in a .Xdefaults file, remove the Xm or Exm prefix and use the remaining letters (in either lowercase or uppercase, but include any underscores between words). The codes in the "Access" column indicate if the given resource can be set at creation time (C), set by using XtSetValues (S), retrieved by using XtGetValues (G), or is not applicable (N/A).

ExmCommandButton Resource Set
NameClassTypeDefaultAccess
XmNactivateCallbackXmCCallbackXtCallbackListNULLC

XmNactivateCallback 

Specifies the list of callbacks that is called when ExmCommandButton is activated. The type of the structure whose address is passed to this callback is XmAnyCallbackStruct. The reason is XmCR_ACTIVATE.

Inherited Resources

CommandButton inherits behavior and resources from the following superclasses. For a complete description of each resource, refer to the reference page for that superclass.

ExmString Resource Set
NameClassTypeDefaultAccess
ExmNcompoundStringExmCCompoundStringXmStringNULLCSG
XmNalignmentXmCAlignmentunsigned charXmALIGNMENT_CENTERCSG
XmNrecomputeSizeXmCRecomputeSizeBooleantrueCSG
XmNrenderTableXmCRenderTableXmRenderTabledynamicCSG

ExmSimple Resource Set
NameClassTypeDefaultAccess
ExmNsimpleShapeExmCSimpleShapeunsigned charExmSHAPE_OVALCSG
XmNmarginHeightXmCMarginHeightDimension4CSG
XmNmarginWidthXmCMarginWidthDimension4CSG

XmPrimitive Resource Set
NameClassTypeDefaultAccess
XmNbottomShadowColorXmCBottomShadowColorPixeldynamicCSG
XmNbottomShadowPixmapXmCBottomShadowPixmapPixmapXmUNSPECIFIED_PIXMAPCSG
XmNconvertCallbackXmCCallbackXtCallbackListNULLC
XmNforegroundXmCForegroundPixeldynamicCSG
XmNhelpCallbackXmCCallbackXtCallbackListNULLC
XmNhighlightColorXmCHighlightColorPixeldynamicCSG
XmNhighlightOnEnterXmCHighlightOnEnterBooleanfalseCSG
XmNhighlightPixmapXmCHighlightPixmapPixmapdynamicCSG
XmNhighlightThicknessXmCHighlightThicknessDimension2CSG
XmNlayoutDirectionXmCLayoutDirectionXmDirectiondynamicCG
XmNnavigationTypeXmCNavigationTypeXmNavigationTypeXmNONECSG
XmNpopupHandlerCallbackXmCCallbackXtCallbackListNULLC
XmNshadowThicknessXmCShadowThicknessDimension3CSG
XmNtopShadowColorXmCTopShadowColorPixeldynamicCSG
XmNtopShadowPixmapXmCTopShadowPixmapPixmapdynamicCSG
XmNtraversalOnXmCTraversalOnBooleantrueCSG
XmNunitTypeXmCUnitTypeunsigned chardynamicCSG
XmNuserDataXmCUserDataXtPointerNULLCSG

Core Resource Set
NameClassTypeDefaultAccess
XmNacceleratorsXmCAcceleratorsXtAcceleratorsdynamicCSG
XmNancestorSensitiveXmCSensitiveBooleandynamicG
XmNbackgroundXmCBackgroundPixeldynamicCSG
XmNbackgroundPixmapXmCPixmapPixmapXmUNSPECIFIED_PIXMAPCSG
XmNborderColorXmCBorderColorPixelXtDefaultForegroundCSG
XmNborderPixmapXmCPixmapPixmapXmUNSPECIFIED_PIXMAPCSG
XmNborderWidthXmCBorderWidthDimension0CSG
XmNcolormapXmCColormapColormapdynamicCG
XmNdepthXmCDepthintdynamicCG
XmNdestroyCallbackXmCCallbackXtCallbackListNULLC
XmNheightXmCHeightDimensiondynamicCSG
XmNinitialResourcesPersistentXmCInitialResourcesPersistentBooleantrueC
XmNmappedWhenManagedXmCMappedWhenManagedBooleantrueCSG
XmNscreenXmCScreenScreen *dynamicCG
XmNsensitiveXmCSensitiveBooleantrueCSG
XmNtranslationsXmCTranslationsXtTranslationsdynamicCSG
XmNwidthXmCWidthDimensiondynamicCSG
XmNxXmCPositionPosition0CSG
XmNyXmCPositionPosition0CSG

Callback Information

A pointer to the following structure is passed to each callback:

typedef struct
{
        int     reason;
        XEvent * event;
} XmAnyCallbackStruct;
reason 

Indicates why the callback was invoked.

event 

Points to the XEvent that triggered the callback.

Translations

ExmCommandButton provides the following translations:

EnterWindow: 

ExmCommandButtonEnter()

LeaveWindow: 

ExmCommandButtonLeave()

~c <Btn1Down>: 

ExmCommandButtonArm()

Btn1Up: 

ExmCommandButtonActivate() ExmCommandButtonDisarm()

~s ~m ~a <Key>space: 

ExmCommandButtonArmAndActivate()

~s ~m ~a <Key>Return: 

PrimitiveParentActivate()

In addition to the preceding translations, ExmCommandButton also inherits all the traversal translations of XmPrimitive. For details on these translations, see the XmPrimitive(3) reference page.

Action Routines

The ExmCommandButton action routines are as follows:

ExmCommandButtonActivate() 

If the pointer is within the widget, calls the callback list of XmNactivateCallback.

ExmCommandButtonArm() 

Arms the widget. Renders the border in the selected state and the shadow in the armed state.

ExmCommandButtonArmAndActivate() 

Draws the shadow in the armed state. Calls the callbacks named by XmNactivateCallback. Upon completion, draws the shadow in the disarmed state.

ExmCommandButtonDisarm() 

If the widget is armed, this action disarms it. Draws the shadow in the disarmed state.

ExmCommandButtonEnter() 

If the widget is already armed, draws the shadow in the armed state. Otherwise, this action does nothing.

ExmCommandButtonLeave() 

If the widget is already armed, draws the shadow in the disarmed state. Otherwise, this action does nothing.

Virtual Bindings

For information about bindings for virtual buttons and keys, see VirtualBindings(3).

RELATED

Core(3), ExmSimple(3), ExmString(3), and XmPrimitive(3).