8.3.3 The Control Area
The Form widget is the control area, so it is created as a child of the PanedWindow, as shown in the following
fragment:
form = XtVaCreateWidget ("form1", xmFormWidgetClass, pane, NULL);
As far as the PanedWindow is concerned, the Form widget is a single child whose width is stretched to the left and
right edges of the shell. Within the Form, we add two widgets: a Label widget that contains the help pixmap and a
ScrolledText for the help information.
In order to create the Label, we must first create the pixmap it is going to use. The following code fragment shows
how we create the pixmap and then create the Label:
XtVaGetValues (form,
XmNforeground, &fg,
XmNbackground, &bg,
NULL);
pixmap = XCreatePixmapFromBitmapData (XtDisplay (form),
RootWindowOfScreen (XtScreen (form)),
bitmap_bits, bitmap_width, bitmap_height,
fg, bg, DefaultDepthOfScreen (XtScreen (form)));
label = XtVaCreateManagedWidget ("label", xmLabelGadgetClass, form,
XmNlabelType, XmPIXMAP,
XmNlabelPixmap, pixmap,
XmNleftAttachment, XmATTACH_FORM,
XmNtopAttachment, XmATTACH_FORM,
XmNbottomAttachment, XmATTACH_FORM,
NULL);
We cannot create the pixmap until we know the foreground and background colors, so we retrieve these colors from
the Form, since it has a valid window and colormap. This approach works for either monochrome or color screens.
We use these values as the foreground and background for the pixmap we create in the call to
XCreatePixmapFromBitmapData(). We could have used XmGetPixmap() to ...