Pixmaps provide support for colored bitmaps. Unfortunately in Motif,
the handling of pixmaps has always been a weak area. Motif has provided
minimal support for pixmaps and left it up to developers to fix the problem.
Over the years there have been attempts to provide a standard file format
and api for pixmaps. Finally, the xpm library has become the defacto
standard for handling pixmaps. To provide seemless support for pixmaps,
the xpm library is built into Xarm. The version of the xpm library
used is based on 3.4.8 (less so) and 3.4.7 (more so).
Xarm provides a string to pixmap converter. This allows pixmaps to
be displayed on any widget as specified by a resource file. For those
of you who are using LessTif, there is a compile time option (C preprocessor
macro) that will provide a string to pixmap converter. Here is an
! cdplayer resources
! Version 1.0.0
! Copyright (c) 1995, 1996 by Peter G. Williams
! This resource file was generated by cdplayer.
*.dialogTitle: CD Player
*PlayTime.labelString: Play Time:
*ElaspedTime.labelString: Time Elapsed:
Here's the result:
The class WObjectClass provides two functions for obtaining a pixmap id.
These routines are called getPixmap
Here's an example of the getPixmapFromData routine:
pmap = getPixmapFromData(cd_play);
args(XmNlabelPixmap, (XtArgVal) pmap)
(XmNlabelType, (XtArgVal) XmPIXMAP);
p_play = new PushButton(this->widget(), args, "Play");
Returns a pixmap id for the file if successful. Otherwise XmUNSPECIFIED_PIXMAP
is returned. Also, the pixmap id will be added to the global image
cache if necessary. For further information on the image cache see
Returns a Pixmap id for the data if successful. Otherwise XmUNSPECIFIED_PIXMAP