home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / m / motifpg2.zip / ch02 / xhello.c < prev    next >
C/C++ Source or Header  |  1992-07-08  |  2KB  |  57 lines

  1. /*
  2.  * Copyright 1989, 1992 O'Reilly and Associates, Inc.
  3.  * See ../Copyright for complete rights and liability information.
  4.  */
  5.  
  6. /*
  7.  * xhello.c - simple program to put up a banner on the display
  8.  */
  9.  
  10. /*
  11.  * Header files required for all Toolkit programs
  12.  */
  13. #include <X11/Intrinsic.h>     /* Intrinsics definitions */
  14. #include <Xm/Xm.h>    /* Standard Motif definitions */
  15.  
  16. /*
  17.  * Public header file for widgets actually used in this file.
  18.  */
  19. #include <Xm/Label.h>     /* Motif Label Widget */
  20.  
  21. main(argc, argv)
  22. int argc;
  23. char **argv;
  24. {
  25.     XtAppContext app_context;
  26.     Widget topLevel, hello;
  27.  
  28.     /*
  29.      * Register the default language procedure
  30.      */
  31.     XtSetLanguageProc(NULL, (XtLanguageProc)NULL, NULL);
  32.  
  33.     topLevel = XtVaAppInitialize(
  34.             &app_context,       /* Application context */
  35.             "XHello",         /* Application class */
  36.             NULL, 0,            /* command line option list */
  37.             &argc, argv,        /* command line args */
  38.             NULL,               /* for missing app-defaults file */
  39.             NULL);              /* terminate varargs list */
  40.  
  41.     hello = XtVaCreateManagedWidget(
  42.             "hello",            /* arbitrary widget name */
  43.             xmLabelWidgetClass,    /* widget class from Label.h */
  44.             topLevel,            /* parent widget */
  45.             NULL);              /* terminate varargs list */
  46.  
  47.     /*
  48.      *  Create windows for widgets and map them.
  49.      */
  50.     XtRealizeWidget(topLevel);
  51.  
  52.     /*
  53.      *  Loop for events.
  54.      */
  55.     XtAppMainLoop(app_context);
  56. }
  57.