home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / m / master12.zip / mastering / lab00.c < prev    next >
C/C++ Source or Header  |  1992-08-19  |  1KB  |  55 lines

  1. #include <Xm/PushB.h>
  2. #include <Xm/BulletinB.h>
  3.  
  4. /***********************************************************************
  5.  ***                             MAIN                                ***
  6.  ***********************************************************************/
  7. void main(argc, argv)
  8.   unsigned int argc;
  9.   char **argv;
  10. {
  11.    Widget toplevel, bboard, pbutton;
  12.    Arg args[10];
  13.    int n;
  14.    char *text = "Push Me";
  15.    XmString label_text;
  16.    XtAppContext app_context;
  17.      
  18. /*
  19.  * Initialize the toplevel shell widget
  20.  */
  21.    toplevel = XtAppInitialize(&app_context, "Lab00", NULL, 0, &argc, argv,
  22.                               NULL, args,0);
  23. /*
  24.  * Create the bulletin board Widget
  25.  */
  26.  
  27.  n = 0;
  28.  bboard = XmCreateBulletinBoard (toplevel, "bboard", args, n);
  29.  XtManageChild(bboard);
  30.  
  31. /*
  32.  * Create a compound string for the button label
  33.  */
  34.    label_text = XmStringCreateLtoR(text, XmFONTLIST_DEFAULT_TAG);
  35.    
  36. /*
  37.  * Create the pushbutton.
  38.  */
  39.  n = 0;
  40.    XtSetArg(args[n], XmNlabelString, label_text); n++;
  41.    pbutton = XmCreatePushButton(bboard, "pbutton", args, n);
  42.    XtManageChild(pbutton);
  43.    XmStringFree(label_text);
  44.  
  45. /*
  46.  * Realize the toplevel widget, which displays all children
  47.  */ 
  48.    XtRealizeWidget(toplevel);
  49.  
  50. /*
  51.  * Go into a loop and wait for input
  52.  */
  53.    XtAppMainLoop(app_context);
  54. }
  55.