home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / XfeWidgets / Xfe / CallProcs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  5.4 KB  |  176 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. /*-----------------------------------------*/
  19. /*                                                                        */
  20. /* Name:        <Xfe/CallProcs.c>                                        */
  21. /* Description:    Misc shared resource call procedures.                    */
  22. /* Author:        Ramiro Estrugo <ramiro@netscape.com>                    */
  23. /*                                                                        */
  24. /*----------------------------------------------------------------------*/
  25.  
  26.  
  27. #include <Xfe/XfeP.h>
  28. #include <Xfe/PrimitiveP.h>
  29. #include <Xfe/ManagerP.h>
  30.  
  31. #define HOR_CURSOR    "sb_h_double_arrow"
  32. #define VER_CURSOR    "sb_v_double_arrow"
  33.  
  34. /*----------------------------------------------------------------------*/
  35. /*                                                                        */
  36. /* Resource call procedures                                                */
  37. /*                                                                        */
  38. /*----------------------------------------------------------------------*/
  39. /* extern */ void
  40. _XfeCallProcCopyBackground(Widget w,int offset,XrmValue * value)
  41. {
  42.     static Pixel pixel;
  43.  
  44.     pixel = _XfeBackgroundPixel(w);
  45.    
  46.     value->addr = (XPointer) &pixel;
  47.     value->size = sizeof(pixel);
  48. }
  49. /*----------------------------------------------------------------------*/
  50. /* extern */ void
  51. _XfeCallProcCopyForeground(Widget w,int offset,XrmValue * value)
  52. {
  53.     static Pixel pixel;
  54.  
  55.     assert( XfeIsPrimitive(w) || XfeIsManager(w) );
  56.  
  57.     if (XfeIsPrimitive(w))
  58.     {
  59.         pixel = _XfeForeground(w);
  60.     }
  61.     else
  62.     {
  63.         pixel = _XfemForeground(w);
  64.     }
  65.    
  66.     value->addr = (XPointer) &pixel;
  67.     value->size = sizeof(pixel);
  68. }
  69. /*----------------------------------------------------------------------*/
  70. /* extern */ void
  71. _XfeCallProcCopyShadowThickness(Widget w,int offset,XrmValue * value)
  72. {
  73.     static Dimension shadow_thickness;
  74.  
  75.     assert( XfeIsPrimitive(w) || XfeIsManager(w) );
  76.  
  77.     if (XfeIsPrimitive(w))
  78.     {
  79.         shadow_thickness = _XfeShadowThickness(w);
  80.     }
  81.     else
  82.     {
  83.         shadow_thickness = _XfemShadowThickness(w);
  84.     }
  85.    
  86.     value->addr = (XPointer) &shadow_thickness;
  87.     value->size = sizeof(shadow_thickness);
  88. }
  89. /*----------------------------------------------------------------------*/
  90. /* extern */ void
  91. _XfeCallProcSelectPixel(Widget w,int offset,XrmValue * value)
  92. {
  93.     static Pixel pixel;
  94.  
  95.     pixel = XfeSelectPixel(w,_XfeBackgroundPixel(w));
  96.    
  97.     value->addr = (XPointer) &pixel;
  98.     value->size = sizeof(pixel);
  99. }
  100. /*----------------------------------------------------------------------*/
  101. /* extern */ void
  102. _XfeCallProcDefaultLabelFontList(Widget w,int offset,XrmValue * value)
  103. {
  104.     static XmFontList font_list;
  105.  
  106.     font_list = XmFontListCopy(_XmGetDefaultFontList(w,XmLABEL_FONTLIST));
  107.     
  108.     value->addr = (XPointer) &font_list;
  109.     value->size = sizeof(font_list);
  110. }
  111. /*----------------------------------------------------------------------*/
  112. /* extern */ void
  113. _XfeCallProcDefaultTextFontList(Widget w,int offset,XrmValue * value)
  114. {
  115.     static XmFontList font_list;
  116.  
  117.     font_list = XmFontListCopy(_XmGetDefaultFontList(w,XmTEXT_FONTLIST));
  118.     
  119.     value->addr = (XPointer) &font_list;
  120.     value->size = sizeof(font_list);
  121. }
  122. /*----------------------------------------------------------------------*/
  123. /* extern */ void
  124. _XfeCallProcOrientationCursor(Widget w,int offset,XrmValue * value)
  125. {
  126.     static Cursor        drag_cursor;
  127.     XrmValue            xrm_from;
  128.     XrmValue            xrm_to;
  129.     unsigned char        orientation = XmVERTICAL;
  130.     String                cursor_name;
  131.  
  132.     /*
  133.      * Determine the orientation.  Obviously, this will only work for 
  134.      * widgets that actually have a XmNorientation resource.
  135.      */
  136.     XtVaGetValues(w,XmNorientation,&orientation,NULL);
  137.  
  138.     cursor_name = (orientation == XmVERTICAL) ? VER_CURSOR : HOR_CURSOR;
  139.  
  140.     /* From */
  141.     xrm_from.addr    = (XPointer) cursor_name;
  142.     xrm_from.size    = strlen(cursor_name);
  143.     
  144.     /* To */
  145.     xrm_to.addr        = (XPointer) &drag_cursor;
  146.     xrm_to.size        = sizeof(drag_cursor);
  147.  
  148.     /* Try to do the convertion */
  149.     if (!XtConvertAndStore(w,XmRString,&xrm_from,XmRCursor,&xrm_to))
  150.     {
  151.         drag_cursor = None;
  152.     }
  153.     
  154.     value->addr = (XPointer) &drag_cursor;
  155.     value->size = sizeof(drag_cursor);
  156. }
  157. /*----------------------------------------------------------------------*/
  158.  
  159. /*----------------------------------------------------------------------*/
  160. /*                                                                        */
  161. /* Synthetic resource call procedures                                    */
  162. /*                                                                        */
  163. /*----------------------------------------------------------------------*/
  164.  
  165. /*----------------------------------------------------------------------*/
  166. /*                                                                        */
  167. /* Synthetic resource import procedures                                    */
  168. /*                                                                        */
  169. /*----------------------------------------------------------------------*/
  170. /* extern */ XmImportOperator
  171. _XfeSyntheticSetResourceForChild(Widget w,int offset,XtArgVal * value)
  172.     return XmSYNTHETIC_LOAD;
  173. }
  174. /*----------------------------------------------------------------------*/
  175.