home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xcu16.zip / clients / xcell / icell.c < prev    next >
C/C++ Source or Header  |  1991-10-03  |  4KB  |  125 lines

  1. /*
  2.  * Copyright 1991 Cornell University
  3.  *
  4.  * Permission to use, copy, modify, and distribute this software and its
  5.  * documentation for any purpose and without fee is hereby granted, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Cornell U. not be used in advertising
  9.  * or publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Cornell U. makes no representations about the
  11.  * suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * CORNELL UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  16.  * EVENT SHALL CORNELL UNIVERSITY BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  18.  * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  20.  * PERFORMANCE OF THIS SOFTWARE.
  21.  *
  22.  * Author:  Gene W. Dykes, Program of Computer Graphics
  23.  *          580 Theory Center, Cornell University, Ithaca, NY 14853
  24.  *          (607) 255-6713   gwd@graphics.cornell.edu
  25.  */
  26.  
  27.  
  28. #include <stdio.h>
  29. #include <X11/Intrinsic.h>
  30. #include <X11/Xaw/Cardinals.h>
  31. #include <X11/StringDefs.h>
  32. #include <X11/Shell.h>
  33. #include <X11/Xcu/Wlm.h>
  34. #include "Cell.h"
  35.  
  36. /* This allows your window to be resized */
  37. static Arg toplevel_args[] = { {XtNallowShellResize, (XtArgVal) True} } ;
  38.  
  39. /* This is how we'll pass the menu description to the wlm widget */
  40. static Arg wlm_args[] = { {XtNfile, (XtArgVal) NULL} } ;
  41.  
  42. static Widget    toplevel, wlm, cell_widget ;
  43. static Boolean running_flag = True ;
  44.  
  45. main (argc, argv)
  46.     int argc ;
  47.     char **argv ;
  48. {
  49. static XrmOptionDescRec options[] =
  50.     {
  51.      {"-colors", "*Cell.colors", XrmoptionSepArg,
  52.       "black,white,blue,green,red,yellow" }
  53.     } ;
  54. if (argc < 2)
  55.     {
  56.     fprintf (stderr, "\nUsage: %s wlm_layout_file\n\n", argv[0]) ;
  57.     exit (1) ;
  58.     }
  59.  
  60. /* Initialize toolkit, create the toplevel shell widget */
  61. toplevel = XtInitialize (NULL, "top", options, XtNumber(options), &argc, argv);
  62. XtSetValues (toplevel, toplevel_args, XtNumber(toplevel_args)) ;
  63.  
  64. /* Create the widget layout manager widget */
  65. XtSetArg (wlm_args[0], XtNfile, argv[1]) ;
  66. wlm = XtCreateManagedWidget("wlm", xcuWlmWidgetClass, toplevel, wlm_args, ONE);
  67.  
  68. /* Create associations between menu and program variables and routines */
  69.  
  70. XcuWlmGetBoolean (wlm, XcuWLM_EVENTS, "XcuBmgr", "Pause", "setCallback",
  71.               &running_flag) ;
  72.  
  73.  
  74. /* Realize the widget tree */
  75. XtRealizeWidget (toplevel) ;
  76.  
  77. /* Sample the wlm widget */
  78. XcuWlmSample (wlm) ;
  79.  
  80. cell_widget = XcuWlmInquireWidget (wlm, "XcuCell", "cell") ;
  81.  
  82. /* Repeatedly request events from the wlm */
  83. for (;;)
  84.     {
  85.     XcuWlmEvent (wlm) ;
  86.     if (running_flag)
  87.     {
  88.     XcuCellStep (cell_widget) ;
  89.     }
  90.     }
  91. }
  92.  
  93. /*
  94.  * You need one include file for each widget class used
  95.  */
  96.  
  97. #include <X11/Xcu/WlmP.h>
  98. #include <X11/Xcu/Label.h>
  99. #include <X11/Xcu/Bmgr.h>
  100. #include <X11/Xcu/Button.h>
  101. #include <X11/Xcu/Deck.h>
  102. #include <X11/Xcu/Tbl.h>
  103. #include <X11/Xcu/Command.h>
  104. #include <X11/Xcu/Entry.h>
  105.  
  106. void
  107. make_tag_class_list (ww)
  108.     XcuWlmWidget ww ;
  109. {
  110. /*
  111.  * You need one entry for each widget class used
  112.  */
  113. TAG_CLASS_ENTRY(ww, "XcuLabel",    xcuLabelWidgetClass) ;
  114. TAG_CLASS_ENTRY(ww, "XcuWlm",    xcuWlmWidgetClass) ;
  115. TAG_CLASS_ENTRY(ww, "XcuBmgr",    xcuBmgrWidgetClass) ;
  116. TAG_CLASS_ENTRY(ww, "XcuButton",xcuButtonWidgetClass) ;
  117. TAG_CLASS_ENTRY(ww, "XcuDeck",    xcuDeckWidgetClass) ;
  118. TAG_CLASS_ENTRY(ww, "XcuTbl",    xcuTblWidgetClass) ;
  119. TAG_CLASS_ENTRY(ww, "XcuCommand",xcuCommandWidgetClass) ;
  120. TAG_CLASS_ENTRY(ww, "XcuCell",    xcuCellWidgetClass) ;
  121. TAG_CLASS_ENTRY(ww, "XcuEntry",    xcuEntryWidgetClass) ;
  122. return ;
  123. }
  124.  
  125.