                                        /*-------------------------------
                                         |    example4a.c               |
                                         -------------------------------*/
#include <Xm/PushB.h>
#include <X11/xpm.h>
#include "rcalc.xpm"

                                        /*-------------------------------------
                                         |              MAIN                  |
                                         ------------------------------------*/
int main(argc, argv)
  unsigned int argc;
  char **argv;
{
   Widget toplevel, pb;
   XtAppContext context;
   Display *dpy;
   Pixmap pix_returned, pix_mask_returned, pix_armed;
   XpmAttributes xpmatts;
   XpmColorSymbol XpmTransparentColor[1] = {{NULL, "none", 0}};
   Pixel bg_pixel, armbg_pixel;
   int depth = 1;

     
					   	    /* Initialize the toolkit */
   toplevel = XtAppInitialize(&context, "Eample4a", NULL, 0, &argc, argv,
                              NULL, NULL, 0);
   dpy = XtDisplay(toplevel);

						     /* Create the pushbutton */
   pb = XtVaCreateManagedWidget("button", xmPushButtonWidgetClass, 
				toplevel, NULL);


   XtVaGetValues(pb, XmNbackground, &bg_pixel, 
			XmNarmColor, &armbg_pixel,
			XmNdepth, &depth,
			NULL);

   XpmTransparentColor[0].pixel = bg_pixel;
   xpmatts.valuemask = XpmColorSymbols | XpmCloseness |XpmDepth;
   xpmatts.colorsymbols = XpmTransparentColor;
   xpmatts.numsymbols = 1;
   xpmatts.closeness = 65535;
   xpmatts.depth = depth;			 /* Pixmap for DISARMED  */
   XpmCreatePixmapFromData(XtDisplay(toplevel),
			DefaultRootWindow(dpy),
			xcalc_xpm,
			&pix_returned,
			&pix_mask_returned,
			&xpmatts);
	if(pix_mask_returned)
		XFreePixmap(dpy, pix_mask_returned );

						/* Pixmap for ARMED  */
   XpmTransparentColor[0].pixel = armbg_pixel;
   XpmCreatePixmapFromData(XtDisplay(toplevel),
			DefaultRootWindow(dpy),
			xcalc_xpm,
			&pix_armed,
			&pix_mask_returned,
			&xpmatts);
	if(pix_mask_returned)
		XFreePixmap(dpy, pix_mask_returned );

   XtVaSetValues(pb, XmNwidth, 100,
			XmNheight, 100,
			XmNlabelType, XmPIXMAP,
			XmNlabelPixmap, pix_returned,
			XmNarmPixmap, pix_armed,
			NULL);

					      /* Realize the top level widget */
   XtRealizeWidget(toplevel);

					  /* Loop forever and wait for events */
   XtAppMainLoop(context);

}/*------------------------------------------------------------ End of MAIN --*/
