[ Previous | Next | Contents | Glossary | Home | Search ]
Motif 2.1 Widget Writer's Guide



Nonenumerated Representation Types

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
},

Pixmap Converter for Scaling

To support the automatic scaling of Pixmaps, the following representation types are available:

  1. XmRNoScalingBitmap

  2. XmRNoScalingDynamicPixmap

    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.

  3. Dimensions and Positions Representation Types

    Resources whose values symbolize dimensions or positions should use the following representation types:

    1. XmRHorizontalDimension, which converts a horizontal dimension to a Dimension.

    2. XmRHorizontalPosition, which converts a horizontal position to a Position.

    3. XmRVerticalDimension, which converts a vertical dimension to a Dimension.

    4. XmRVerticalPosition, which converts a vertical position to a Position.

      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.

    5. Bitmap and Pixmap Representation Types

      Motif provides the following three representation types for converting bitmaps and pixmaps.

      1. XmRBitmap, which converts an input xbm file to a Pixmap of depth 1.

      2. XmRPixmap, which converts an input xbm or xpm file to a Pixmap with the same depth as the widget's visual.

      3. XmRDynamicPixmap, which depends on the value of the XmNbitmapConversionModel resource of XmScreen. If this resource's value is XmMATCH_DEPTH, XmRDynamicPixmap converts an input xbm or xpm file to a Pixmap of appropirate depth for the widget. If this resource's value is XmDYNAMIC_DEPTH, XmRDynamicPixmap converts an input xbm file to a Pixmap of depth 1 and an input xpm file to a Pixmap the same depth as the widget.

      4. [ Previous | Next | Contents | Glossary | Home | Search ]