XmDrawingArea(library call) XmDrawingArea(library call)
NAME [Toc] [Back]
XmDrawingArea - The DrawingArea widget class
SYNOPSIS [Toc] [Back]
#include <Xm/DrawingA.h>
DESCRIPTION [Toc] [Back]
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.
DrawingArea uses the XmNinitialFocus resource of XmManager to define
whether or not DrawingArea will receive focus when it is traversed to,
even if it has traversable children. If XmNinitialFocus is NULL,
DrawingArea receives focus only if it does not have any traversable
children. If XmNinitialFocus is not NULL, then DrawingArea receives
focus when traversed to. In the latter case, the application first
needs to be able to realize that the DrawingArea will receive focus,
then, as appropriate, needs to either call the XmProcessTraversal
function for the desired child, or to navigate across the private
DrawingArea graphics objects.
The following resources are not currently used by the DrawingArea
widget: XmNshadowThickness, XmNtopShadowPixmap, XmNbottomShadowPixmap,
XmNtopShadowColor, and XmNbottomShadowColor
Data Transfer Behavior [Toc] [Back]
DrawingArea has no widget class conversion or destination procedure.
Subclasses and the XmNconvertCallback procedures are responsible for
any conversion of selections. Subclasses and the
XmNdestinationCallback procedures are responsible for any data
transfers to the widget.
Classes [Toc] [Back]
DrawingArea inherits behavior and resources from the Core, Composite,
Constraint, and XmManager classes.
The class pointer is xmDrawingAreaWidgetClass.
The class name is XmDrawingArea.
- 1 - Formatted: January 24, 2005
XmDrawingArea(library call) XmDrawingArea(library call)
New Resources [Toc] [Back]
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 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).
___________________________________________________________________________________
| XmDrawingArea Resource Set |
|Name Class Type Default Access |
|_______________________|_________________|________________|______________|________|
|XmNconvertCallback | XmCCallback | XtCallbackList | NULL | C |
|_______________________|_________________|________________|______________|________|
|XmNdestinationCallback | XmCCallback | XtCallbackList | NULL | C |
|_______________________|_________________|________________|______________|________|
|XmNexposeCallback | XmCCallback | XtCallbackList | NULL | C |
|_______________________|_________________|________________|______________|________|
|XmNinputCallback | XmCCallback | XtCallbackList | NULL | C |
|_______________________|_________________|________________|______________|________|
|XmNmarginHeight | XmCMarginHeight | Dimension | 10 | CSG |
|_______________________|_________________|________________|______________|________|
|XmNmarginWidth | XmCMarginWidth | Dimension | 10 | CSG |
|_______________________|_________________|________________|______________|________|
|XmNresizeCallback | XmCCallback | XtCallbackList | NULL | C |
|_______________________|_________________|________________|______________|________|
|XmNresizePolicy | XmCResizePolicy | unsigned char | XmRESIZE_ANY | CSG |
|_______________________|_________________|________________|______________|________|
|_______________________|_________________|________________|______________|________|
XmNconvertCallback [Toc] [Back]
Specifies a list of callbacks called when the DrawingArea is
asked to convert a selection. The type of the structure
whose address is passed to these callbacks is
XmConvertCallbackStruct. The reason is XmCR_OK.
XmNdestinationCallback [Toc] [Back]
Specifies a list of callbacks called when the DrawingArea is
the destination of a transfer operation. The type of the
structure whose address is passed to these callbacks is
XmDestinationCallbackStruct. The reason is XmCR_OK.
XmNexposeCallback [Toc] [Back]
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
- 2 - Formatted: January 24, 2005
XmDrawingArea(library call) XmDrawingArea(library call)
exposure event.
The default bit gravity for Manager windows is
NorthWestGravity. This may cause the XmNexposeCallback
procedures not to be invoked when the DrawingArea window is
made smaller.
XmNinputCallback [Toc] [Back]
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 [Toc] [Back]
Specifies the minimum spacing in pixels between the top or
bottom edge of DrawingArea and any child widget.
XmNmarginWidth [Toc] [Back]
Specifies the minimum spacing in pixels between the left or
right edge of DrawingArea and any child widget.
XmNresizeCallback [Toc] [Back]
Specifies the list of callbacks that is called when the
DrawingArea is resized. The callback reason is XmCR_RESIZE.
XmNresizePolicy [Toc] [Back]
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 [Toc] [Back]
DrawingArea inherits behavior and resources from the following
superclasses. For a complete description of each resource, refer to
the reference page for that superclass.
- 3 - Formatted: January 24, 2005
XmDrawingArea(library call) XmDrawingArea(library call)
_____________________________________________________________________________________________________
| XmManager Resource Set |
|Name Class Type Default Access |
|________________________|_______________________|___________________|______________________|________|
|XmNbottomShadowColor | XmCBottomShadowColor | Pixel | dynamic | CSG |
|________________________|_______________________|___________________|______________________|________|
|XmNbottomShadowPixmap | XmCBottomShadowPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
|________________________|_______________________|___________________|______________________|________|
|XmNforeground | XmCForeground | Pixel | dynamic | CSG |
|________________________|_______________________|___________________|______________________|________|
|XmNhelpCallback | XmCCallback | XtCallbackList | NULL | C |
|________________________|_______________________|___________________|______________________|________|
|XmNhighlightColor | XmCHighlightColor | Pixel | dynamic | CSG |
|________________________|_______________________|___________________|______________________|________|
|XmNhighlightPixmap | XmCHighlightPixmap | Pixmap | dynamic | CSG |
|________________________|_______________________|___________________|______________________|________|
|XmNinitialFocus | XmCInitialFocus | Widget | NULL | CSG |
|________________________|_______________________|___________________|______________________|________|
|XmNlayoutDirection | XmCLayoutDirection | XmDirection | dynamic | CG |
|________________________|_______________________|___________________|______________________|________|
|XmNnavigationType | XmCNavigationType | XmNavigationType | XmTAB_GROUP | CSG |
|________________________|_______________________|___________________|______________________|________|
|XmNpopupHandlerCallback | XmCCallback | XtCallbackList | NULL | C |
|________________________|_______________________|___________________|______________________|________|
|XmNshadowThickness | XmCShadowThickness | Dimension | 0 | CSG |
|________________________|_______________________|___________________|______________________|________|
|XmNstringDirection | XmCStringDirection | XmStringDirection | dynamic | CG |
|________________________|_______________________|___________________|______________________|________|
|XmNtopShadowColor | XmCTopShadowColor | Pixel | dynamic | CSG |
|________________________|_______________________|___________________|______________________|________|
|XmNtopShadowPixmap | XmCTopShadowPixmap | Pixmap | dynamic | CSG |
|________________________|_______________________|___________________|______________________|________|
|XmNtraversalOn | XmCTraversalOn | Boolean | True | CSG |
|________________________|_______________________|___________________|______________________|________|
|XmNunitType | XmCUnitType | unsigned char | dynamic | CSG |
|________________________|_______________________|___________________|______________________|________|
|XmNuserData | XmCUserData | XtPointer | NULL | CSG |
|________________________|_______________________|___________________|______________________|________|
|________________________|_______________________|___________________|______________________|________|
________________________________________________________________________
Composite Resource Set
Name Class Type Default Access
________________________________________________________________________
XmNchildren XmCReadOnly WidgetList NULL G
________________________________________________________________________
XmNinsertPosition XmCInsertPosition XtOrderProc NULL CSG
________________________________________________________________________
XmNnumChildren XmCReadOnly Cardinal 0 G
________________________________________________________________________
________________________________________________________________________
- 4 - Formatted: January 24, 2005
XmDrawingArea(library call) XmDrawingArea(library call)
| | | | | |
________________________________________________________________________________________________________________
| | | Core Resource Set | |
|Name | Class | | | Type | Default Access |
|______________________________|_______________________________|________________|______________________|________|
|XmNaccelerators | | XmCAccelerators | | XtAccelerators | dynamic | CSG |
|______________________________|_______________________________|________________|______________________|________|
|XmNancestorSensitive | XmCSensitive | | Boolean| | dynamic | G |
|______________________________|_______________________________|________________|______________________|________|
|XmNbackground | | XmCBackground | | Pixel | | dynamic | CSG |
|______________________________|_______________________________|________________|______________________|________|
|XmNbackgroundPixmap | XmCPixmap | | Pixmap | | XmUNSPECIFIED_PIXMAP | CSG |
|______________________________|_______________________________|________________|______________________|________|
|XmNborderColor | | XmCBorderColor | | Pixel | | XtDefaultForeground | CSG |
|______________________________|_______________________________|________________|______________________|________|
|XmNborderPixmap | | XmCPixmap | | Pixmap | | XmUNSPECIFIED_PIXMAP | CSG |
|______________________________|_______________________________|________________|______________________|________|
|XmNborderWidth | | XmCBorderWidth | | Dimension | 0 | CSG |
|______________________________|_______________________________|________________|______________________|________|
|XmNcolormap | | XmCColormap | | Colormap | dynamic | CG |
|______________________________|_______________________________|________________|______________________|________|
|XmNdepth | | XmCDepth | | int | | dynamic | CG |
|______________________________|_______________________________|________________|______________________|________|
|XmNdestroyCallback| | XmCCallback | | XtCallbackList | NULL | C |
|______________________________|_______________________________|________________|______________________|________|
|XmNheight | | XmCHeight | | Dimension | dynamic | CSG |
|______________________________|_______________________________|________________|______________________|________|
|XmNinitialResourcesPersistent | XmCInitialResourcesPersistent | Boolean| | True | C |
|______________________________|_______________________________|________________|______________________|________|
|XmNmappedWhenManaged | XmCMappedWhenManaged| | Boolean| | True | CSG |
|______________________________|_______________________________|________________|______________________|________|
|XmNscreen | | XmCScreen | | Screen * | dynamic | CG |
|______________________________|_______________________________|________________|______________________|________|
|XmNsensitive | | XmCSensitive | | Boolean| | True | CSG |
|______________________________|_______________________________|________________|______________________|________|
|XmNtranslations | | XmCTranslations | | XtTranslations | dynamic | CSG |
|______________________________|_______________________________|________________|______________________|________|
|XmNwidth | | XmCWidth | | Dimension | dynamic | CSG |
|______________________________|_______________________________|________________|______________________|________|
|XmNx | | XmCPosition | | Position | 0 | CSG |
|______________________________|_______________________________|________________|______________________|________|
|XmNy | | XmCPosition | | Position | 0 | CSG |
|______________________________|_______________________________|________________|______________________|________|
|______________________________|_______________________________|________________|______________________|________|
Callback Information [Toc] [Back]
A pointer to the following structure is passed to the
XmNexposeCallback, XmNinputCallback, and XmNresizeCallback procedures:
- 5 - Formatted: January 24, 2005
XmDrawingArea(library call) XmDrawingArea(library call)
typedef struct
{
int reason;
XEvent * event;
Window window;
} XmDrawingAreaCallbackStruct;
reason Indicates why the callback was invoked.
event Points to the XEvent that triggered the callback. This is
NULL for the XmNresizeCallback.
window Is set to the widget window.
A pointer to the following structure is passed to the
XmNconvertCallback procedures:
typedef struct
{
int reason;
XEvent *event;
Atom selection;
Atom target;
XtPointer source_data;
XtPointer location_data;
int flags;
XtPointer parm;
int parm_format;
unsigned long parm_length;
int status;
XtPointer value;
Atom type;
int format;
unsigned long length;
} XmConvertCallbackStruct;
reason Indicates why the callback was invoked.
event Points to the XEvent that triggered the callback. It can be
NULL.
selection Indicates the selection for which conversion is being
requested. Possible values are CLIPBOARD, PRIMARY,
SECONDARY, and _MOTIF_DROP.
target Indicates the conversion target.
source_data
Contains information about the selection source. When the
selection is _MOTIF_DROP, source_data is the DragContext.
Otherwise, it is NULL.
- 6 - Formatted: January 24, 2005
XmDrawingArea(library call) XmDrawingArea(library call)
location_data
Contains information about the location of data to be
converted. If the value is NULL, the data to be transferred
consists of the widget's current selection.
flags Indicates the status of the conversion. Following are the
possible values:
XmCONVERTING_NONE [Toc] [Back]
This flag is currently unused.
XmCONVERTING_PARTIAL [Toc] [Back]
The target widget was able to be converted, but
some data was lost.
XmCONVERTING_SAME [Toc] [Back]
The conversion target is the source of the data to
be transferred.
XmCONVERTING_TRANSACT [Toc] [Back]
This flag is currently unused.
parm Contains parameter data for this target. If no parameter
data exists, the value is NULL.
When selection is CLIPBOARD and target is
_MOTIF_CLIPBOARD_TARGETS or
_MOTIF_DEFERRED_CLIPBOARD_TARGETS, the value is the
requested operation (XmCOPY, XmMOVE, or XmLINK).
parm_format
Specifies whether the data in parm should be viewed as a
list of char, short, or long quantities. Possible values
are 0 (when parm is NULL), 8 (when the data in parm should
be viewed as a list of chars), 16 (when the data in parm
should be viewed as a list of shorts), or 32 (when the data
in parm should be viewed as a list of longs). Note that
parm_format symbolizes a data type, not the number of bits
in each list element. For example, on some machines, a
parm_format of 32 means that the data in parm should be
viewed as a list of 64-bit quantities, not 32-bit
quantities.
parm_length
Specifies the number of elements of data in parm, where each
element has the size specified by parm_format. When parm is
NULL, the value is 0.
status An IN/OUT member that specifies the status of the
conversion. The initial value is XmCONVERT_DEFAULT. The
callback procedure can set this member to one of the
- 7 - Formatted: January 24, 2005
XmDrawingArea(library call) XmDrawingArea(library call)
following values:
XmCONVERT_DEFAULT [Toc] [Back]
This value means that the widget class conversion
procedure, if any, is called after the callback
procedures return. If the widget class conversion
procedure produces any data, it overwrites the
data provided by the callback procedures in the
value member.
XmCONVERT_MERGE [Toc] [Back]
This value means that the widget class conversion
procedure, if any, is called after the callback
procedures return. If the widget class conversion
procedure produces any data, it appends its data
to the data provided by the callback procedures in
the value member. This value is intended for use
with targets that result in lists of data, such as
TARGETS.
XmCONVERT_DONE [Toc] [Back]
This value means that the callback procedure has
successfully finished the conversion. The widget
class conversion procedure, if any, is not called
after the callback procedures return.
XmCONVERT_REFUSE [Toc] [Back]
This value means that the callback procedure has
terminated the conversion process without
completing the requested conversion. The widget
class conversion procedure, if any, is not called
after the callback procedures return.
value An IN/OUT parameter that contains any data that the callback
procedure produces as a result of the conversion. The
initial value is NULL. If the callback procedure sets this
member, it must ensure that the type, format, and length
members correspond to the data in value. The callback
procedure is responsible for allocating, but not for
freeing, memory when it sets this member.
type An IN/OUT parameter that indicates the type of the data in
the value member. The initial value is INTEGER.
format An IN/OUT parameter that specifies whether the data in value
should be viewed as a list of char, short, or long
quantities. The initial value is 8. The callback procedure
can set this member to 8 (for a list of char), 16 (for a
list of short), or 32 (for a list of long).
- 8 - Formatted: January 24, 2005
XmDrawingArea(library call) XmDrawingArea(library call)
length An IN/OUT member that specifies the number of elements of
data in value, where each element has the size symbolized by
format. The initial value is 0.
A pointer to the following callback structure is passed to the
XmNdestinationCallback procedures:
typedef struct
{
int reason;
XEvent *event;
Atom selection;
XtEnum operation;
int flags;
XtPointer transfer_id;
XtPointer destination_data;
XtPointer location_data;
Time time;
} XmDestinationCallbackStruct;
reason Indicates why the callback was invoked.
event Points to the XEvent that triggered the callback. It can be
NULL.
selection Indicates the selection for which data transfer is being
requested. Possible values are CLIPBOARD, PRIMARY,
SECONDARY, and _MOTIF_DROP.
operation Indicates the type of transfer operation requested.
+ When the selection is PRIMARY, possible values are
XmMOVE, XmCOPY, and XmLINK.
+ When the selection is SECONDARY or CLIPBOARD, possible
values are XmCOPY and XmLINK.
+ When the selection is _MOTIF_DROP, possible values are
XmMOVE, XmCOPY, XmLINK, and XmOTHER. A value of
XmOTHER means that the callback procedure must get
further information from the XmDropProcCallbackStruct
in the destination_data member.
flags Indicates whether or not the destination widget is also the
source of the data to be transferred. Following are the
possible values:
XmCONVERTING_NONE [Toc] [Back]
The destination widget is not the source of the
data to be transferred.
- 9 - Formatted: January 24, 2005
XmDrawingArea(library call) XmDrawingArea(library call)
XmCONVERTING_SAME [Toc] [Back]
The destination widget is the source of the data
to be transferred.
transfer_id
Serves as a unique ID to identify the transfer transaction.
destination_data
Contains information about the destination. When the
selection is _MOTIF_DROP, the callback procedures are called
by the drop site's XmNdropProc, and destination_data is a
pointer to the XmDropProcCallbackStruct passed to the
XmNdropProc procedure. When the selection is SECONDARY,
destination_data is an Atom representing a target
recommmended by the selection owner for use in converting
the selection. Otherwise, destination_data is NULL.
location_data
Contains information about the location where data is to be
transferred. The value is always NULL when the selection is
SECONDARY or CLIPBOARD. If the value is NULL, the data is
to be inserted at the widget's cursor position.
location_data is only valid for the duration of a transfer.
Once XmTransferDone procedures start to be called,
location_data will no longer be stable.
time Indicates the time when the transfer operation began.
Translations [Toc] [Back]
XmDrawingArea inherits translations from XmManager. Before calling
the XmManager actions, all events in the inherited translations except
<BtnMotion>, <EnterWindow>, <LeaveWindow>, <FocusIn>, and <FocusOut>
also call the DrawingAreaInput() action.
XmDrawingArea has the following additional translations. The
following key names are listed in the X standard key event translation
table syntax. This format is the one used by Motif to specify the
widget actions corresponding to a given key. A brief overview of the
format is provided under VirtualBindings(3). For a complete
description of the format, please refer to the X Toolkit Instrinsics
Documentation.
<BtnDown>:
DrawingAreaInput()
<BtnUp>: DrawingAreaInput()
<KeyDown>:
DrawingAreaInput() ManagerGadgetKeyInput()
- 10 - Formatted: January 24, 2005
XmDrawingArea(library call) XmDrawingArea(library call)
<KeyUp>: DrawingAreaInput()
Action Routines [Toc] [Back]
The XmDrawingArea action routines are
DrawingAreaInput():
Unless the event takes place in a gadget, calls the
callbacks for XmNinputCallback
ManagerGadgetKeyInput():
Causes the current gadget to process a keyboard event
Additional Behavior [Toc] [Back]
The XmDrawingArea widget has the following additional behavior:
<Expose>: Calls the callbacks for XmNexposeCallback
<Widget Resize>:
Calls the callbacks for XmNresizeCallback
Virtual Bindings [Toc] [Back]
The bindings for virtual keys are vendor specific. For information
about bindings for virtual buttons and keys, see VirtualBindings(3).
RELATED [Toc] [Back]
Composite(3), Constraint(3), Core(3), XmCreateDrawingArea(3), and
XmManager(3).
- 11 - Formatted: January 24, 2005 [ Back ] |