http://invisible-island.net/athena_widgets/XawPlus

_________________________________________________________XawPlus

The DrawingArea Widget

Application Header file
Class Header file
Class
Class Name
Superclass
<X11/XawPlus/DrawingArea.h>
<X11/XawPlus/DrawingAreaP.h>
drawingAreaWidgetClass
drawingArea
Simple

The DrawingArea widget adds a backing store machanism to the Simple widget, so it becomes usable as a drawing area. With this backing store DrawingArea is able to handle resize and redisplay events without any action from your application. A set of drawing functions is provided which are equivalent to the Xlib drawing functions, except that these functions work on a DrawingArea widget.

It is possible to use DrawingArea directly, using the drawing functions with their procedural interface. It is also possible (and a good idea) to use this widget as superclass of an application specific drawing widget.

Differences between Xaw and XawPlus

This widget is new in XawPlus and not available with the Xaw widget set.

Resources

When creating a DrawingArea widget instance, the following resources are retrieved from the argument list of XtSetValues() or XtVaSetValues() or from the resource database:


Name Class Type Default Value
OBJECT:
destroyCallback Callback Pointer NULL
RECTANGLE:
borderWidth
height
sensitive
width
x
y
BorderWidth
Height
Sensitive
Width
Position
Position
Dimension
Dimension
Boolean
Dimension
Position
Position
0
12
True
12
0
0
CORE:
border
background
mappedWhenManaged
BorderColor
Background
MappedWhenManaged
Pixel
Pixel
Boolean
XtDefaultForeground
grey75
True
SIMPLE:
cursor
cursorName
pointerColor
pointerColorBackground
insensitiveBorder
international
highlightColor
shadowColor
buttonBorderWidth
Cursor
Cursor
Foreground
Background
Insensitive
International
Background
Background
Width
Cursor
String
Pixel
Pixel
Pixmap
Boolean
Pixel
Pixel
Dimension
None
NULL
XtDefaultForeground
XtDefaultBackground
NULL
False
grey90
grey40
2

DrawingArea adds no new resources to the resource list.

Drawing functions

DrawingArea comes with a set of drawing functions. These functions are known from the Xlib. The difference is, that these function work directly on a DrawingArea widget including support of the backing store. That is the reason why you never should try to use the Xlib functions on a DrawingArea widget.

This is not a complete description of the drawing functions. To learn more about these functions take a look to the Xlib reference. To find the equivalent function, replace Xaw with X in the function name.

Function Name Arguments Description
XawClearWindow w Drawing area widget

Use this function to clear the drawing area.


Function Name Arguments Description
XawDrawPoint w
gc
x, y
Drawing area widget
graphics context
coordinates of the point

Use this function to draw a point using the given graphics context gc in the drawing area.


Function Name Arguments Description
XawDrawPoints w
gc
points[]
npoints
mode
Drawing area widget
graphics context
list of point coordinates
number of points
drawing mode: Relative to origin or previous point

Use this function to draw a set of points using the given gc in the drawing area.


Function Name Arguments Description
XawDrawLine w
gc
x1, y1
x2, y2
Drawing area widget
graphics context
starting point
end point

Use this function to draw a line using the given gc in the drawing area.


Function Name Arguments Description
XawDrawLines w
gc
points[]
npoints
mode
Drawing area widget
graphics context
list of point coordinates
number of points
drawing mode: Relative to origin or previous point

Use this function to draw connected lines using the given gc in the drawing area.


Function Name Arguments Description
XawDrawSegments w
gc
segments[]
nsegments
Drawing area widget
graphics context
list of line coordinates
number of segments

Use this function to draw unconnected lines using the given gc in the drawing area.


Function Name Arguments Description
XawDrawRectangle w
gc
x, y
width, height
Drawing area widget
graphics context
upper left edge of the rectangle
widht and height of the rectangle

Use this function to draw a rectangle using the given graphics context gc in the drawing area.


Function Name Arguments Description
XawDrawRectangles w
gc
rectangles
n
Drawing area widget
graphics context
list of rectangle coordinates
number of rectangles

Use this function to draw a set of rectangles using the given graphics context gc in the drawing area.


Function Name Arguments Description
XawDrawArc w
gc
x, y
width, height
angle1, angle2
Drawing area widget
graphics context
center position of the circle/elipsoid
widht and height of the circle/elipsoid
draw from angle 1 to angle 2

Use this function to draw a circle, an elpsoid or a part of it using the given graphics context gc in the drawing area.


Function Name Arguments Description
XawDrawArcs w
gc
arcs
n
Drawing area widget
graphics context
parameters of the circles/elipsoids
number of circles

Use this function to draw a set of circles using the given graphics context gc in the drawing area.


Function Name Arguments Description
XawFillRectangle w
gc
x, y
width, height
Drawing area widget
graphics context
upper left edge of the rectangle
widht and height of the rectangle

Use this function to draw a filled rectangle using the given graphics context gc in the drawing area.


Function Name Arguments Description
XawFillRectangles w
gc
rectangles
n
Drawing area widget
graphics context
list of rectangle coordinates
number of rectangles

Use this function to draw a set of filled rectangles using the given graphics context gc in the drawing area.


Function Name Arguments Description
XawFillArc w
gc
x, y
width, height
angle1, angle2
Drawing area widget
graphics context
center position of the circle/elipsoid
widht and height of the circle/elipsoid
draw from angle 1 to angle 2

Use this function to draw a filled circle, a filled elpsoid or a part of it using the given graphics context gc in the drawing area.


Function Name Arguments Description
XawFillArcs w
gc
arcs
n
Drawing area widget
graphics context
parameters of the circles/elipsoids
number of circles

Use this function to draw a set of filled circles using the given graphics context gc in the drawing area.


Function Name Arguments Description
XawFillPolygon w
gc
points[]
npoints
shape
mode
Drawing area widget
graphics context
list of point coordinates
number of points
drawing mode complex, convex or nonconvex
relative or absolute coordinates

Use this function to draw a filled polygon using the given gc in the drawing area.


Function Name Arguments Description
XawDrawString w
gc
x, y
str
n
Drawing area widget
graphics context
position of the string in the widget
the text string
number of characters

Use this function to draw a string on a transparent background using the given graphics context gc in the drawing area.


Function Name Arguments Description
XawDrawString16 w
gc
x, y
str16
n
Drawing area widget
graphics context
position of the string in the widget
the 2 byte text string
number of characters

Use this function to draw a 2 byte string on a transparent background using the given graphics context gc in the drawing area.


Function Name Arguments Description
XawDrawImageString w
gc
x, y
str
n
Drawing area widget
graphics context
position of the string in the widget
the text string
number of characters

Use this function to draw a string with a filled background using the given graphics context gc in the drawing area.


Function Name Arguments Description
XawDrawImageString16 w
gc
x, y
str16
n
Drawing area widget
graphics context
position of the string in the widget
the 2 byte text string
number of characters

Use this function to draw a 2 byte string with a filled background using the given graphics context gc in the drawing area.


Function Name Arguments Description
XawDrawText w
gc
x, y
items
nitems
Drawing area widget
graphics context
position of the string in the widget
array of XTextItems
number of XTextItems

XTextItem is defined in Xlib.h as follows:

Data Type Variable Description
char *
int
int
Font
chars
nchars
delta
font
a pointer to the string
lenght of the string
delta between the strings
font to draw the string or None to use the default

Use this function to draw a set of strings using the parameters in the XTextItem array. Every string may use its own font and its own spacing, defined in the corresponding XTextItem entry. If there is no font defined, the default font found in the gc is used.


Function Name Arguments Description
XawDrawText16 w
gc
x, y
items
nitems
Drawing area widget
graphics context
position of the string in the widget
array of XTextItem16s
number of XTextItem16s

XTextItem16 is defined in Xlib.h as follows:

Data Type Variable Description
XChar2b *
int
int
Font
chars
nchars
delta
font
a pointer to the 2 byte string
lenght of the string in characters (not in byte!)
delta between the strings
font to draw the string or None to use the default

Use this function to draw a set of strings using the parameters in the XTextItem16 array. Every string may use its own font and its own spacing, defined in the corresponding XTextItem16 entry. If there is no font defined, the default font found in the gc is used.

XawPlus_________________________________________________________