12.7 Exercise
The following exercise is intended to stimulate and encourage other creative uses of labels and buttons.
Generic X windows have a background pixmap property that can be set using
XSetWindowBackgroundPixmap(). See Volume One, Xlib Programming Manual, for details on
XSetWindowBackgroundPixmap(). Whenever the background pixmap is set, the image is tiled on the
window. If the window is larger than the image, the image is replicated in a checkerboard fashion until the
window's background is filled; if the window is the same size or smaller than the image, the image is centered
in the window. The image is automatically rendered into the window appropriately by the server whenever
necessary. Since widgets have windows, the X Toolkit Intrinsics provides a resource for the Core widget class
that allows you to set the background pixmap using XtN-backgroundPixmap. (Motif's
XmNbackgroundPixmap resource is identical except that the naming convention provides consistency
among resource names.) Write a program that displays a Label that contains both graphics and a text label by
setting both XmNlabelString and XmNbackgroundPixmap to appropriate values.
•
12 Labels and Buttons 12.7 Exercise
340