Next | Prev | Up | Top | Contents | Index

xmDrawingArea and xmDrawnButton

Tm has limited support for the Xlib drawable area or buttons--you can draw only strings on them. This is the only currently defined drawing method for manipulating the xmDrawingArea and xmDrawnButton widgets:

dw drawImageString gc x y string


Use the given graphical context gc to draw the text string starting at position x,y. The 0,0 coordinate is at the upper left of the widget.
The following example produces a familiar "Hello world" widget. It is necessary to use an exposeCallback to get the message redisplayed when needed.

#! /usr/sgitcl/bin/moat 
xtAppInitialize
xmDrawingArea .top managed -height 30 -width 150
.top exposeCallback {
    set gc [.top getGC -foreground black]
    .top drawImageString $gc 10 20 "Hello world"
}
. realizeWidget
. mainLoop

Figure 4-12 : xmDrawingArea Table 4-47 lists the resources associated with xmDrawingArea.

xmDrawingArea Resources
Resource NameDefault ValueType or Legal Values
-marginHeight10Dimension
-marginWidth10Dimension
-resizePolicy resize_anyresize_any
resize_grow
resize_none

Table 4-48 lists the resources associated with xmDrawnButton.

xmDrawnButton Resources
Resource NameDefault ValueType or Legal Values
-multiClickInherited from
display
multiclick_discard
multiclick_keep
-pushButtonEnabledFalseBoolean
-shadowTypeshadow_outshadow_in
shadow_out
shadow_etched_in
shadow_etched_out

Table 4-49 lists the callbacks associated with xmDrawingArea and xmDrawnButton.

Drawing Widget Callbacks
Method Name Why
exposeCallback The area/button should be redrawn.
inputCallback A keyboard or mouse event arrived for the area.
resizeCallback The area/button is resized.
activateCallback The button was activated.
armCallback The button is squashed.
disarmCallback The button is released.


Next | Prev | Up | Top | Contents | Index