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

  1. /*
  2.  * Copyright 1989, 1992 O'Reilly and Associates, Inc.
  3.  * See ../Copyright for complete rights and liability information.
  4.  */
  5.  
  6. /*
  7.  * xtwodisp.c - an application with windows on two displays
  8.  */
  9.  
  10. /*
  11.  * Include files required for all Toolkit programs
  12.  */
  13. #include <Xm/Xm.h>    /* Intrinsics Definitions */
  14.  
  15. /*
  16.  * Public include file for widgets we actually use in this file.
  17.  */
  18. #include <Xm/Label.h>        /* Motif Label Widget */
  19.  
  20. main(argc, argv)
  21. int argc;
  22. char **argv;
  23. {
  24.     XtAppContext app_con;
  25.     Widget topLevel1, topLevel2, hello, goodbye;
  26.     Display *display1, *display2;
  27.     
  28.     XtSetLanguageProc(NULL, (XtLanguageProc)NULL, NULL);
  29.     
  30.     XtToolkitInitialize();
  31.     
  32.     app_con = XtCreateApplicationContext();
  33.     
  34.     display1 = XtOpenDisplay(app_con, "obsidian:0", argv[0], "XHello", 
  35.                  NULL, 0, &argc, argv);
  36.     
  37.     display2 = XtOpenDisplay(app_con, "harry:0", argv[0], "XGoodbye", 
  38.                  NULL, 0, &argc, argv);
  39.     
  40.     topLevel1 = XtAppCreateShell("name1", "XHello", 
  41.                  applicationShellWidgetClass, display1, 
  42.                  NULL, 0);
  43.     
  44.     topLevel2 = XtAppCreateShell("name2", "XGoodbye", 
  45.                  applicationShellWidgetClass, display2, 
  46.                  NULL, 0);
  47.   
  48.     hello = XtCreateManagedWidget(
  49.             "hello",        /* arbitrary widget name */
  50.         xmLabelWidgetClass,    /* widget class from Label.h */
  51.         topLevel1,        /* parent widget*/
  52.         NULL,            /* argument list */
  53.         0            /* arg list size */
  54.         );
  55.  
  56.     goodbye = XtCreateManagedWidget(
  57.         "goodbye",        /* arbitrary widget name */
  58.         xmLabelWidgetClass,    /* widget class from Label.h */
  59.         topLevel2,        /* parent widget*/
  60.         NULL,            /* argument list */
  61.         0            /* arg list size */
  62.         );
  63.     /*
  64.      *  Create windows for widgets and map them.
  65.      */
  66.     XtRealizeWidget(topLevel1);
  67.     XtRealizeWidget(topLevel2);
  68.     
  69.     /*
  70.      *  Loop for events.
  71.      */
  72.     XtAppMainLoop(app_con);
  73. }
  74.