Representation types are also useful for defining
nonenumerated resource values. Table 6-1 lists all the useful nonenumerated
Motif representation types and their C data type equivalents.
Table 5. Common Nonenumerated Representation Types
Motif Representation Type | Converts to C Data Type |
XmRHorizontalDimension | Dimension |
XmRHorizontalPosition | Position |
XmRVerticalDimension | Dimension |
XmRVerticalPosition | Position |
XmRBitmap | Pixmap |
XmRPixmap | Pixmap |
XmRDynamicPixmap | Pixmap |
XmRRenderTable | XmRenderTable |
XmRXmString | XmString |
XmRXmStringTable | XmString * |
XmRTabList | XmTabList |
XmRValueWcs | wchar_t * |
The fourth field of each resource record specifies the size required to store the resource's value. The second column of Table 6-2 will help you determine this size. For example, the ExmString widget defines a resource record for the XmNrenderTable resource. This resource defines a representation type of XmRRenderTable. According to the table, the C data type associated with this representation type is XmRenderTable. Therefore, the resource record specifies the size of the resource's value as follows:
{ XmNrenderTable, XmCRenderTable, XmRRenderTable, sizeof(XmRenderTable), /* size of the resource */ XtOffsetOf( ExmStringRec,string.render_table), XtRCallProc, (XtPointer) DefaultFont },
To support the automatic scaling of Pixmaps, the following representation types are available:
The converters for these representation types ignore the scaling ratio that might be present in their print shell hierarchy and behave normally; that is, they convert XBM and XPM files to Pixmap. These are used when Pixmap is employed for tiling, rather than when it is used for images and icons.
The semantics of the XmRBitmap and XmRDynamic representation type converters apply a scaling ratio to the resulting Pixmap that is equal to the print shell resolution divided by the value of the XmNdefaultPixmapResolution of their XmPrintShell. No scaling is applied if the widget for which a Pixmap resource is being converted is not a descendant of XmPrintShell. See Chapter 16 for more information on XmPrintShell.
Resources whose values symbolize dimensions or positions should use the following representation types:
For example, the ExmSimple widget associates the XmRHorizontalDimension representation type with the XmNmarginWidth resource. Similarly, the XNmarginHeight resource is associated with the XmRVerticalDimension representation type. The unit type conversion functions (XmeFromHorizontalPixels, XmeFromVerticalPixels, XmeToHorizontalPixels, and XmeToVerticalPixels) depend on these representation types.
Motif provides the following three representation types for converting bitmaps and pixmaps.