------------------------------------------------------------------------
#include <Xm/Xm.h>
#include <Xm/PushB.h>
#include <stdio.h>
static char *FallBack[] = {
"*.geometrySlop: 1",
"*red: red",
"*blue: blue",
NULL
};
typedef struct appres {
Pixel red;
Pixel blue;
} *appresp, appres;
appres Appres;
XtResource res[] = {
{ "red", "Red", XmRPixel, sizeof(Pixel), XtOffset(appresp, red),
XmRImmediate, (XtPointer)1},
{ "blue", "Blue", XmRPixel, sizeof(Pixel), XtOffset(appresp, blue),
XmRImmediate, (XtPointer)2}
};
int
main(int argc, char **argv)
{
Widget toplevel, one;
XtAppContext app;
XmString xmstr1 = XmStringCreateLtoR("Here Is A\nLabel", "MY_FONT");
XtSetLanguageProc(NULL, NULL, NULL);
toplevel = XtVaAppInitialize(&app, "Label", NULL, 0, &argc, argv, FallBack,
NULL);
XtGetApplicationResources(toplevel, &Appres, res, XtNumber(res), NULL, 0);
fprintf(stderr, "Red is %08p, blue is %08p\n", Appres.red, Appres.blue);
one = XtVaCreateManagedWidget("One", xmPushButtonWidgetClass, toplevel,
XmNlabelString, xmstr1,
XtNborderWidth, 20,
XmNforeground, Appres.red,
XmNbackground, Appres.blue,
NULL);
XtRealizeWidget(toplevel);
XtAppMainLoop(app);
exit(0);
}