Motif provides several Xme functions for rendering geometric objects (arrows, diamonds, and so on). Whenever possible, your Motif widgets should render geometric objects with these Xme routines. By using the Xme functions, you are ensuring that the geometric objects in your Motif widget will look like the geometric objects in other Motif widgets.
Table 8-2 lists the Xme functions pertaining to drawing.
Table 12. Xme Drawing Functions
Xme Function | What It Does: |
XmeClearBorder | Clears any rectangular area (such as a widget border) |
XmeDrawArrow | Draws a Motif-style, three-dimensional arrow |
XmeDrawCircle | Draws a Motif-style, three-dimensional circle |
XmeDrawDiamond | Draws a Motif-style, three-dimensional diamond |
XmeDrawHighlight | Draws a Motif-style highlight around a widget's border |
XmeDrawIndicator | Draws a Motif-style cross or check mark |
XmeDrawPolygonShadow | Draws a Motif-style, three-dimensional shadow around a polygon |
XmeDrawSeparator | Draws a Motif-style, three-dimensional line to separate two visual components |
XmeDrawShadows | Draws a Motif-style, three-dimensional shadow around a rectangle |
For example, the ExmSimple widget calls the XmeDrawShadows function to draw its border shadows. In order to make this call, the Simple.c file includes the header file for the Xme drawing functions as follows:
#include <Xm/DrawP.h>
The call to XmeDrawShadows appears as follows:
XmeDrawShadows (XtDisplay (sw), XtWindow (sw), sw->primitive.top_shadow_GC, sw->primitive.bottom_shadow_GC, sw->primitive.highlight_thickness, sw->primitive.highlight_thickness, sw->core.width - (2 * sw->primitive.highlight_thickness), sw->core.height - (2 * sw->primitive.highlight_thickness), sw->primitive.shadow_thickness, XmSHADOW_ETCHED_OUT);
Most Motif widgets inherit routines to draw and erase window decorations. However, if your widget takes the responsibility for its own window decorations, then your widget will draw the decorations with XmeDrawHighlight and XmeDrawShadows and clear the decorations with XmeClearBorders. Actually, the XmeClearBorders call can be used to clear out any rectangular area, not just window decorations.
If you want to draw shadows around any polygon (instead of just a rectangle), call XmeDrawPolygonShadows instead of XmeDrawShadows.
XmeDrawDiamond, XmeDrawCircle, and XmeDrawIndicator are particularly useful for creating toggle indicators.