XmDrawnButton(3Xm) — UNIX Programmer’s Manual
NAME
XmDrawnButton — the DrawnButton widget class.
SYNOPSIS
#include <Xm/DrawnB.h>
DESCRIPTION
The DrawnButton widget consists of an empty widget window surrounded by a shadow border. It provides the application developer with a graphics area that can have PushButton input semantics.
Callback types are defined for widget exposure and resize to allow the application to redraw or reposition its graphics. If the DrawnButton widget has a highlight and shadow thickness, the application should not draw in that area. To avoid drawing in the highlight and shadow area, create the graphics context with a clipping rectangle for drawing in the widget. The clipping rectangle will take into account the size of the widget’s highlight thickness and shadow.
Classes
DrawnButton inherits behavior and resources from Core, XmPrimitive, and XmLabel Classes.
The class pointer is xmDrawnButtonWidgetClass.
The class name is XmDrawnButton.
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 or XmC prefix and use the remaining letters. To specify one of the defined values for a resource in a .Xdefaults file, remove the Xm prefix and use the remaining letters (in either lower case or upper case, 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).
| XmDrawnButton Resource Set | ||||
| Name | Class | Type | Default | Access |
| XmNactivateCallback | XmCCallback | XtCallbackList | NULL | C |
| XmNarmCallback | XmCCallback | XtCallbackList | NULL | C |
| XmNdisarmCallback | XmCCallback | XtCallbackList | NULL | C |
| XmNexposeCallback | XmCCallback | XtCallbackList | NULL | C |
| XmNpushButtonEnabled | XmCPushButtonEnabled | Boolean | False | CSG |
| XmNresizeCallback | XmCCallback | XtCallbackList | NULL | C |
| XmNshadowType | XmCShadowType | unsigned char | XmSHADOW_ETCHED_IN | CSG |
XmNactivateCallback
Specifies the list of callbacks that is called when the widget becomes selected. The reason sent by the callback is XmCR_ACTIVATE.
XmNarmCallback
Specifies the list of callbacks that is called when the widget becomes armed. The reason sent by the callback is XmCR_ARM.
XmNdisarmCallback
Specifies the list of callbacks that is called when the widget becomes disarmed. The reason sent by the callback is XmCR_DISARM.
XmNexposeCallback
Specifies the list of callbacks that is called when the widget receives an exposure event. The reason sent by the callback is XmCR_EXPOSE.
XmNpushButtonEnabled
Enables or disables the three-dimensional shadow drawing as in PushButton.
XmNresizeCallback
Specifies the list of callbacks that is called when the widget receives a resize event. The reason sent by the callback is XmCR_RESIZE. The event returned for this callback is NULL.
XmNshadowType
Describes the drawing style for the DrawnButton. This resource can have the following values:
•XmSHADOW_IN — draws the DrawnButton such that the shadow appears inset. This means that the bottom shadow visuals and top shadow visuals are reversed.
•XmSHADOW_OUT — draws the DrawnButton such that the shadow appears outset.
•XmSHADOW_ETCHED_IN — draws the DrawnButton using a double line. This gives the effect of a line etched into the window. The thickness of the double line is equal to the value of XmNshadowThickness.
•XmSHADOW_ETCHED_OUT — draws the DrawnButton using a double line. This gives the effect of a line coming out of the window. The thickness of the double line is equal to the value of XmNshadowThickness.
Inherited Resources
DrawnButton inherits behavior and resources from the following superclasses. For a complete description of these resources, refer to the man page for that superclass.
| XmLabel Resource Set | ||||
| Name | Class | Type | Default | Access |
| XmNaccelerator | XmCAccelerator | String | NULL | CSG |
| XmNacceleratorText | XmCAcceleratorText | XmString | NULL | CSG |
| XmNalignment | XmCAlignment | unsigned char | XmALIGNMENT_CENTER | CSG |
| XmNfontList | XmCFontList | XmFontList | "Fixed" | CSG |
| XmNlabelInsensitivePixmap | XmCLabelInsensitivePixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
| XmNlabelPixmap | XmCPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
| XmNlabelString | XmCXmString | XmString | ‘\0’ | CSG |
| XmNlabelType | XmCLabelType | unsigned char | XmSTRING | CSG |
| XmNmarginBottom | XmCMarginBottom | short | 0 | CSG |
| XmNmarginHeight | XmCMarginHeight | short | dynamic | CSG |
| XmNmarginLeft | XmCMarginLeft | short | 0 | CSG |
| XmNmarginRight | XmCMarginRight | short | 0 | CSG |
| XmNmarginTop | XmCMarginTop | short | 0 | CSG |
| XmNmarginWidth | XmCMarginWidth | short | dynamic | CSG |
| XmNmnemonic | XmCMnemonic | char | ‘\0’ | CSG |
| XmNrecomputeSize | XmCRecomputeSize | Boolean | True | CSG |
| XmNstringDirection | XmCStringDirection | XmStringDirection | XmSTRING_DIRECTION_L_TO_R | CSG |
| XmPrimitive Resource Set | ||||
| Name | Class | Type | Default | Access |
| XmNbottomShadowColor | XmCForeground | Pixel | dynamic | CSG |
| XmNbottomShadowPixmap | XmCBottomShadowPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
| XmNforeground | XmCForeground | Pixel | dynamic | CSG |
| XmNhelpCallback | XmCCallback | XtCallbackList | NULL | C |
| XmNhighlightColor | XmCForeground | Pixel | Black | CSG |
| XmNhighlightOnEnter | XmCHighlightOnEnter | Boolean | False | CSG |
| XmNhighlightPixmap | XmCHighlightPixmap | Pixmap | dynamic | CSG |
| XmNhighlightThickness | XmCHighlightThickness | short | 0 | CSG |
| XmNshadowThickness | XmCShadowThickness | short | 2 | CSG |
| XmNtopShadowColor | XmCBackground | Pixel | dynamic | CSG |
| XmNtopShadowPixmap | XmCTopShadowPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
| XmNtraversalOn | XmCTraversalOn | Boolean | False | CSG |
| XmNunitType | XmCUnitType | unsigned char | XmPIXELS | CSG |
| XmNuserData | XmCUserData | caddr_t | NULL | CSG |
| Core Resource Set | ||||
| Name | Class | Type | Default | Access |
| XmNaccelerators | XmCAccelerators | XtTranslations | NULL | CSG |
| XmNancestorSensitive | XmCSensitive | Boolean | True | G |
| XmNbackground | XmCBackground | Pixel | dynamic | CSG |
| XmNbackgroundPixmap | XmCPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
| XmNborderColor | XmCBorderColor | Pixel | Black | CSG |
| XmNborderPixmap | XmCPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
| XmNborderWidth | XmCBorderWidth | Dimension | 0 | CSG |
| XmNcolormap | XmCColormap | Colormap | XtCopyFromParent | CG |
| XmNdepth | XmCDepth | int | XtCopyFromParent | CG |
| XmNdestroyCallback | XmCCallback | XtCallbackList | NULL | C |
| XmNheight | XmCHeight | Dimension | 0 | CSG |
| XmNmappedWhenManaged | XmCMappedWhenManaged | Boolean | True | CSG |
| XmNscreen | XmCScreen | Pointer | XtCopyScreen | CG |
| XmNsensitive | XmCSensitive | Boolean | True | CSG |
| XmNtranslations | XmCTranslations | XtTranslations | NULL | CSG |
| XmNwidth | XmCWidth | Dimension | 0 | CSG |
| XmNx | XmCPosition | Position | 0 | CSG |
| XmNy | XmCPosition | Position | 0 | CSG |
Callback Information
The following structure is returned with each callback:
typedef struct
{
intreason;
XEvent∗ event;
Windowwindow;
} XmDrawnButtonCallbackStruct;
reasonIndicates why the callback was invoked.
eventPoints to the XEvent that triggered the callback. NULL is returned by the event for XmNresizeCallback. This event will be NULL for the XmNactivateCallback if the callback was triggered when Primitive’s resource XmNtraversalOn was True or if the callback was accessed through the ArmAndActivate action routine.
windowIs set to the window ID in which the event occurred.
Behavior
<Btn1Down>:
A selection on the DrawnButton causes its shadow to be drawn in the selected state if the XmNpushButtonEnabled flag is set to True. The callbacks for XmNarmCallback are also called.
<Btn1Up>:
If <Btn1Up> occurs when the pointer is within the DrawnButton, the shadows are redrawn in the unselected state if the XmNpushButtonEnabled flag is set to True. The callbacks for XmNactivateCallback are called, followed by callbacks for XmdisarmCallback.
If <Btn1Up> occurs when the pointer is outside the DrawnButton, the callbacks for XmNdisarmCallback are called.
<Leave Window>:
If the mouse button is pressed and the cursor leaves the DrawnButtons window, the shadow is redrawn to its unselected state if the XmNpushButtonEnabled flag is set to True.
<Enter Window>:
If the mouse button is pressed and the cursor reenters the DrawnButton window, the shadow is drawn in the same manner as when the button was first selected.
Default Translations
<Btn1Down>:Arm()
<Btn1Up>:Activate()
Disarm()
<Key>Return:ArmAndActivate()
<Key>space:ArmAndActivate()
<EnterWindow>: Enter()
<LeaveWindow>: Leave()
Keyboard Traversal
For information on keyboard traversal, see the man page for XmPrimitive(3Xm) and its sections on behavior and default translations.
RELATED INFORMATION
Core(3Xm), XmCreateDrawnButton, XmLabel(3Xm), XmPrimitive(3Xm), XmPushButton, and XmSeparator(3Xm).
7th Edition