XmDrawingArea(3Xm) — UNIX Programmer’s Manual
NAME
XmDrawingArea — the DrawingArea widget class.
SYNOPSIS
#include <Xm/DrawingA.h>
DESCRIPTION
DrawingArea is an empty widget that is easily adaptable to a variety of purposes. It does no drawing and defines no behavior except for invoking callbacks. Callbacks notify the application when graphics need to be drawn (exposure events or widget resize) and when the widget receives input from the keyboard or mouse. Applications are responsible for defining appearance and behavior as needed in response to DrawingArea callbacks.
DrawingArea is also a composite widget and subclass of XmManager that supports minimal geometry management for multiple widget or gadget children.
Classes
DrawingArea inherits behavior and resources from the Core, Composite, Constraint, and XmManager classes.
The class pointer is xmDrawingAreaWidgetClass.
The class name is XmDrawingArea.
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).
| XmDrawingArea Resource Set | ||||
| Name | Class | Type | Default | Access |
| XmNexposeCallback | XmCCallback | XtCallbackList | NULL | C |
| XmNinputCallback | XmCCallback | XtCallbackList | NULL | C |
| XmNmarginHeight | XmCMarginHeight | short | 10 | CSG |
| XmNmarginWidth | XmCMarginWidth | short | 10 | CSG |
| XmNresizeCallback | XmCCallback | XtCallbackList | NULL | C |
| XmNresizePolicy | XmCResizePolicy | unsigned char | XmRESIZE_ANY | CSG |
XmNexposeCallback
Specifies the list of callbacks that is called when DrawingArea receives an exposure event. The callback reason is XmCR_EXPOSE. The callback structure also includes the exposure event.
XmNinputCallback
Specifies the list of callbacks that is called when the DrawingArea receives a keyboard or mouse event (key or button, up or down). The callback reason is XmCR_INPUT. The callback structure also includes the input event.
XmNmarginHeight
Specifies the minimum spacing in pixels between the top or bottom edge of DrawingArea and any child widget.
XmNmarginWidth
Specifies the minimum spacing in pixels between the left or right edge of DrawingArea and any child widget.
XmNresizeCallback
Specifies the list of callbacks that is called when the DrawingArea is resized. The callback reason is XmCR_RESIZE.
XmNresizePolicy
Controls the policy for resizing DrawingArea widgets. Possible values include XmRESIZE_NONE (fixed size), XmRESIZE_ANY (shrink or grow as needed), and XmRESIZE_GROW (grow only).
Inherited Resources
DrawingArea inherits behavior and resources from the following superclasses. For a complete description of these resources, refer to the man page for that superclass.
| XmManager 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 |
| XmNhighlightPixmap | XmCHighlightPixmap | Pixmap | dynamic | CSG |
| XmNshadowThickness | XmCShadowThickness | short | 0 | CSG |
| XmNtopShadowColor | XmCBackground | Pixel | dynamic | CSG |
| XmNtopShadowPixmap | XmCTopShadowPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
| XmNunitType | XmCUnitType | unsigned char | XmPIXELS | CSG |
| XmNuserData | XmCUserData | caddr_t | NULL | CSG |
| Composite Resource Set | ||||
| Name | Class | Type | Default | Access |
| XmNinsertPosition | XmCInsertPosition | XmRFunction | 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;
} XmDrawingAreaCallbackStruct;
reasonIndicates why the callback was invoked.
eventPoints to the XEvent that triggered the callback.
windowIs set to the widget window.
Behavior
DrawingArea behavior is summarized below.
<KeyDown>, <KeyUp>, <BtnDown>, <BtnUp>:
The callbacks for XmNinputCallback are called when a keyboard key or mouse button is pressed or released.
<Expose>:
The callbacks for XmNexposeCallback are called when the widget receives an exposure event.
<Widget Resize>:
The callbacks for XmNresizeCallback are called when the widget is resized.
Default Translations
The following are DrawingArea’s default translations:
<Btn1Down>:Arm()
<Btn1Up>:Activate()
<EnterWindow>: Enter()
<FocusIn>:FocusIn()
Keyboard Traversal
For information on keyboard traversal, see the man page for XmManager(3Xm) and its sections on behavior and default translations.
RELATED INFORMATION
Composite(3Xm), Constraint(3Xm), Core(3Xm), XmCreateDrawingArea(3Xm), and XmManager(3Xm).
7th Edition