home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / lib / Xaw / Vendor.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-30  |  4.8 KB  |  152 lines

  1. /* $XConsortium: Vendor.c,v 1.21 91/07/30 15:29:56 rws Exp $ */
  2.  
  3. /***********************************************************
  4. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
  5. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  6.  
  7.                         All Rights Reserved
  8.  
  9. Permission to use, copy, modify, and distribute this software and its 
  10. documentation for any purpose and without fee is hereby granted, 
  11. provided that the above copyright notice appear in all copies and that
  12. both that copyright notice and this permission notice appear in 
  13. supporting documentation, and that the names of Digital or MIT not be
  14. used in advertising or publicity pertaining to distribution of the
  15. software without specific, written prior permission.  
  16.  
  17. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  18. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  19. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  20. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  22. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  23. SOFTWARE.
  24.  
  25. ******************************************************************/
  26.  
  27. /*
  28.  * This is a copy of Xt/Vendor.c with an additional ClassInitialize
  29.  * procedure to register Xmu resource type converters.
  30.  *
  31.  */
  32.  
  33. /* Make sure all wm properties can make it out of the resource manager */
  34.  
  35. #include <stdio.h>
  36.  
  37. #include <X11/IntrinsicP.h>
  38. #include <X11/StringDefs.h>
  39. #include <X11/Shell.h>
  40. #include <X11/ShellP.h>
  41. #include <X11/Vendor.h>
  42. #include <X11/VendorP.h>
  43. #include <X11/Xmu/Converters.h>
  44. #include <X11/Xmu/Editres.h>
  45.  
  46. static XtResource resources[] = {
  47.   {XtNinput, XtCInput, XtRBool, sizeof(Bool),
  48.         XtOffsetOf(VendorShellRec, wm.wm_hints.input),
  49.         XtRImmediate, (XtPointer)True}
  50. };
  51.  
  52. /***************************************************************************
  53.  *
  54.  * Vendor shell class record
  55.  *
  56.  ***************************************************************************/
  57.  
  58. static void XawVendorShellClassInitialize();
  59. static void XawVendorShellInitialize();
  60. static void ChangeManaged();
  61.  
  62. #define SuperClass (&wmShellClassRec)
  63. externaldef(vendorshellclassrec) VendorShellClassRec vendorShellClassRec = {
  64.   {
  65.     /* superclass      */    (WidgetClass)SuperClass,
  66.     /* class_name      */    "VendorShell",
  67.     /* size          */    sizeof(VendorShellRec),
  68.     /* class_initialize      */    XawVendorShellClassInitialize,
  69.     /* class_part_initialize*/    NULL,
  70.     /* Class init'ed ?      */    FALSE,
  71.     /* initialize      */    XawVendorShellInitialize,
  72.     /* initialize_hook      */    NULL,        
  73.     /* realize          */    XtInheritRealize,
  74.     /* actions          */    NULL,
  75.     /* num_actions      */    0,
  76.     /* resources      */    resources,
  77.     /* resource_count      */    XtNumber(resources),
  78.     /* xrm_class      */    NULLQUARK,
  79.     /* compress_motion      */    FALSE,
  80.     /* compress_exposure  */    TRUE,
  81.     /* compress_enterleave*/    FALSE,
  82.     /* visible_interest      */    FALSE,
  83.     /* destroy          */    NULL,
  84.     /* resize          */    XtInheritResize,
  85.     /* expose          */    NULL,
  86.     /* set_values      */    NULL,
  87.     /* set_values_hook      */    NULL,            
  88.     /* set_values_almost  */    XtInheritSetValuesAlmost,  
  89.     /* get_values_hook      */    NULL,
  90.     /* accept_focus      */    NULL,
  91.     /* intrinsics version */    XtVersion,
  92.     /* callback offsets      */    NULL,
  93.     /* tm_table          */    NULL,
  94.     /* query_geometry      */    NULL,
  95.     /* display_accelerator*/    NULL,
  96.     /* extension      */    NULL
  97.   },{
  98.     /* geometry_manager      */    XtInheritGeometryManager,
  99.     /* change_managed      */    ChangeManaged,
  100.     /* insert_child      */    XtInheritInsertChild,
  101.     /* delete_child      */    XtInheritDeleteChild,
  102.     /* extension      */    NULL
  103.   },{
  104.     /* extension      */    NULL
  105.   },{
  106.     /* extension      */    NULL
  107.   },{
  108.     /* extension      */    NULL
  109.   }
  110. };
  111.  
  112. externaldef(vendorshellwidgetclass) WidgetClass vendorShellWidgetClass =
  113.     (WidgetClass) (&vendorShellClassRec);
  114.  
  115. static void XawVendorShellClassInitialize()
  116. {
  117.     static XtConvertArgRec screenConvertArg[] = {
  118.         {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.screen),
  119.          sizeof(Screen *)}
  120.     };
  121.  
  122.     XtAddConverter(XtRString, XtRCursor, XmuCvtStringToCursor,      
  123.            screenConvertArg, XtNumber(screenConvertArg));
  124.  
  125.     XtAddConverter(XtRString, XtRBitmap, XmuCvtStringToBitmap,
  126.            screenConvertArg, XtNumber(screenConvertArg));
  127. }
  128.  
  129. /* ARGSUSED */
  130. static void XawVendorShellInitialize(req, new)
  131.     Widget req, new;
  132. {
  133.     XtAddEventHandler(new, (EventMask) 0, TRUE, _XEditResCheckMessages, NULL);
  134. }
  135.  
  136. static void ChangeManaged(wid)
  137.     Widget wid;
  138. {
  139.     ShellWidget w = (ShellWidget) wid;
  140.     Widget* childP;
  141.     int i;
  142.  
  143.     (*SuperClass->composite_class.change_managed)(wid);
  144.     for (i = w->composite.num_children, childP = w->composite.children;
  145.          i; i--, childP++) {
  146.         if (XtIsManaged(*childP)) {
  147.         XtSetKeyboardFocus(wid, *childP);
  148.         break;
  149.         }
  150.     }
  151. }
  152.