home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / demos / xgas / XGas.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-04-17  |  3.4 KB  |  109 lines

  1. /* $XConsortium: XGas.c,v 1.1 91/04/18 09:48:25 dave Exp $ */
  2.  
  3. /* Copyright    Massachusetts Institute of Technology    1987, 1988
  4.  *
  5.  * Permission to use, copy, modify, distribute, and sell this software and its
  6.  * documentation for any purpose is hereby granted without fee, provided that
  7.  * the above copyright notice appear in all copies and that both that
  8.  * copyright notice and this permission notice appear in supporting
  9.  * documentation, and that the name of M.I.T. not be used in advertising or
  10.  * publicity pertaining to distribution of the software without specific,
  11.  * written prior permission.  M.I.T. makes no representations about the
  12.  * suitability of this software for any purpose.  It is provided "as is"
  13.  * without express or implied warranty.
  14.  *
  15.  * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  16.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
  17.  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  18.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  19.  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  20.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  *
  22.  */
  23.  
  24. #include <X11/IntrinsicP.h>
  25. #include <X11/StringDefs.h>
  26. #include "XGasP.h"
  27.  
  28. static XtResource resources[] = {
  29. #define offset(field) XtOffset(GasWidget, gas.field)
  30.     /* {name, class, type, size, offset, default_type, default_addr}, */
  31. /*    { XtNgasResource, XtCGasResource, XtRGasResource, sizeof(char*),*/
  32. /*      offset(resource), XtRString, "default" },*/
  33.     { XtNresize, XtCCallback, XtRCallback, sizeof(char*),
  34.       offset(resource), XtRPointer, NULL },
  35. #undef offset
  36. };
  37.  
  38. static void GasAction(/* Widget, XEvent*, String*, Cardinal* */);
  39. static void Resize();
  40.  
  41. static XtActionsRec actions[] =
  42. {
  43.   /* {name, procedure}, */
  44.     {"gas",    GasAction},
  45. };
  46.  
  47. static char translations[] =
  48. "<Key>:        gas()    \n\
  49. ";
  50.  
  51. GasClassRec gasClassRec = {
  52.   { /* core fields */
  53.     /* superclass        */    (WidgetClass) &widgetClassRec,
  54.     /* class_name        */    "Gas",
  55.     /* widget_size        */    sizeof(GasRec),
  56.     /* class_initialize        */    NULL,
  57.     /* class_part_initialize    */    NULL,
  58.     /* class_inited        */    FALSE,
  59.     /* initialize        */    NULL,
  60.     /* initialize_hook        */    NULL,
  61.     /* realize            */    XtInheritRealize,
  62.     /* actions            */    actions,
  63.     /* num_actions        */    XtNumber(actions),
  64.     /* resources        */    resources,
  65.     /* num_resources        */    XtNumber(resources),
  66.     /* xrm_class        */    NULLQUARK,
  67.     /* compress_motion        */    TRUE,
  68.     /* compress_exposure    */    TRUE,
  69.     /* compress_enterleave    */    TRUE,
  70.     /* visible_interest        */    FALSE,
  71.     /* destroy            */    NULL,
  72.     /* resize            */    Resize,
  73.     /* expose            */    NULL,
  74.     /* set_values        */    NULL,
  75.     /* set_values_hook        */    NULL,
  76.     /* set_values_almost    */    XtInheritSetValuesAlmost,
  77.     /* get_values_hook        */    NULL,
  78.     /* accept_focus        */    NULL,
  79.     /* version            */    XtVersion,
  80.     /* callback_private        */    NULL,
  81.     /* tm_table            */    translations,
  82.     /* query_geometry        */    XtInheritQueryGeometry,
  83.     /* display_accelerator    */    XtInheritDisplayAccelerator,
  84.     /* extension        */    NULL
  85.   },
  86.   { /* gas fields */
  87.     /* empty            */    0
  88.   }
  89. };
  90.  
  91. WidgetClass gasWidgetClass = (WidgetClass)&gasClassRec;
  92.  
  93. static void
  94. GasAction(w, event, params, num_params)            /* ARGSUSED */
  95.      Widget w;
  96.      XEvent *event;
  97.      String *params;        /* unused */
  98.      Cardinal *num_params;    /* unused */
  99. {
  100.   XtCallCallbacks(w, XtNcallback, (caddr_t)event);
  101. }
  102.  
  103. static void
  104. Resize(w)
  105. Widget w;
  106. {
  107.   XtCallCallbacks(w, XtNresize, NULL);
  108. }
  109.