home *** CD-ROM | disk | FTP | other *** search
/ IRIS Development Option 6.2 / IRIS_Development_Option_6.2_814-0478-001.iso / dist / motif_dev.idb / usr / include / Sgm / IconGP.h.z / IconGP.h
C/C++ Source or Header  |  1996-03-14  |  14KB  |  363 lines

  1. /*******************************************************************************
  2. ///////   Copyright 1992, Silicon Graphics, Inc.  All Rights Reserved.   ///////
  3. //                                                                            //
  4. // This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;     //
  5. // the contents of this file may not be disclosed to third parties, copied    //
  6. // or duplicated in any form, in whole or in part, without the prior written  //
  7. // permission of Silicon Graphics, Inc.                                       //
  8. //                                                                            //
  9. // RESTRICTED RIGHTS LEGEND:                                                  //
  10. // Use,duplication or disclosure by the Government is subject to restrictions //
  11. // as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data     //
  12. // and Computer Software clause at DFARS 252.227-7013, and/or in similar or   //
  13. // successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -    //
  14. // rights reserved under the Copyright Laws of the United States.             //
  15. //                                                                            //
  16. *******************************************************************************/
  17. #ifndef _SgIconGP_h
  18. #define _SgIconGP_h
  19.  
  20. #include "IconG.h"
  21. #include <Xm/GadgetP.h>
  22. #include <Xm/ExtObjectP.h>
  23. #include <Xm/CascadeBGP.h>
  24.  
  25.  
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29.  
  30. /*************************************************************/
  31. /* The Icon Gadget Cache Object's class and instance records*/
  32. /*************************************************************/
  33.  
  34. typedef struct _SgIconGCacheObjClassPart
  35. {
  36.     int foo;
  37. #ifdef sgi
  38. /* Allow future extensions without breaking shared library compatibility */
  39.     caddr_t _SG_vendorExtension;
  40. #endif /* sgi */
  41. } SgIconGCacheObjClassPart;
  42.  
  43.  
  44. typedef struct _SgIconGCacheObjClassRec     /* icon cache class record */
  45. {
  46.     ObjectClassPart            object_class;
  47.     XmExtClassPart                     ext_class;
  48.     SgIconGCacheObjClassPart         icon_class_cache;
  49. } SgIconGCacheObjClassRec;
  50.  
  51. externalref SgIconGCacheObjClassRec sgIconGCacheObjClassRec;
  52.  
  53.  
  54. /*  The Icon Gadget Cache instance record  */
  55.  
  56. typedef struct _SgIconGCacheObjPart
  57. {
  58.         unsigned char    alignment;
  59.         unsigned char    string_direction;
  60.     
  61.     Dimension    margin_height;   /* margin around widget */
  62.     Dimension    margin_width;
  63.  
  64.     Dimension    margin_left;    /* additional margins on */
  65.     Dimension    margin_right;   /* each side of widget */
  66.     Dimension    margin_top;     /* text (or pixmap) is placed */
  67.     Dimension    margin_bottom;  /* inside the margins */
  68.     Dimension    margin_middle;  /* margin between icon and label */
  69.  
  70.         Pixel           foreground;
  71.     Pixel           background;
  72.     Pixel           top_shadow_color;
  73.     Pixel           bottom_shadow_color;
  74.     Pixel           highlight_color;
  75.  
  76.     Boolean         recompute_size;
  77.  
  78.     Boolean        skipCallback; /* set by RowColumn when entryCallback
  79.                     is provided. */
  80.     unsigned char   menu_type;
  81.     
  82.     Boolean        show_cascade;
  83.     Dimension       pixmap_width;
  84.     Dimension       pixmap_height;
  85.         int             icon_placement;
  86.  
  87. #ifdef sgi
  88. /* Allow future extensions without breaking shared library compatibility */
  89.     caddr_t _SG_vendorExtension;
  90. #endif /* sgi */
  91. } SgIconGCacheObjPart;
  92.  
  93. typedef struct _SgIconGCacheObjRec
  94. {
  95.     XmExtPart                 ext;
  96.     SgIconGCacheObjPart     icon_cache;
  97. } SgIconGCacheObjRec;
  98.  
  99. /*  The Icon Widget Class and instance records  */
  100. /*************************************************/
  101.  
  102. typedef struct _SgIconGadgetClassPart     /* icon class record */
  103. {
  104.         XtWidgetProc        setOverrideCallback;
  105.     XmMenuProc        menuProcs;
  106.         XtPointer        extension; /* Pointer to extension record */
  107. #ifdef sgi
  108. /* Allow future extensions without breaking shared library compatibility */
  109.     caddr_t _SG_vendorExtension;
  110. #endif /* sgi */
  111. } SgIconGadgetClassPart;
  112.  
  113. typedef struct _SgIconGadgetClassRec
  114. {
  115.     RectObjClassPart       rect_class;
  116.     XmGadgetClassPart      gadget_class;
  117.     SgIconGadgetClassPart  icon_class;
  118. } SgIconGadgetClassRec;
  119.  
  120. externalref SgIconGadgetClassRec sgIconGadgetClassRec;
  121.  
  122. typedef struct _SgIconGadgetPart
  123. {
  124.     _XmString    _label;  /* String sent to this widget */
  125.         XmFontList    font;
  126.     Pixmap        bitmap; 
  127.     Pixmap        bitmap_insen; 
  128.         Pixmap        pixmap; 
  129.         Pixmap        pixmap_insen; 
  130.     unsigned char   shadow_type;
  131.     XtCallbackList  double_click_callback;
  132.  
  133.         /* PRIVATE members -- values computed by IconWidgetClass methods */
  134.  
  135.         GC        normal_GC;   /* GC for text */    
  136.     GC        topshadow_GC;   
  137.         GC        bottomshadow_GC;
  138.     GC        insensitive_GC;
  139.     GC        inverse_GC; 
  140.         XRectangle    TextRect;    /* The bounding box of the text, or clip
  141.                                         rectangle of the window; whichever is
  142.                                         smaller */
  143.         XRectangle    pixmapRect; /* The bounding box of the pixmap, or clip
  144.                                         rectangle of the window; whichever is
  145.                                         smaller */
  146.  
  147.     Pixmap        cascade_pixmap;         /* pixmap for the cascade */
  148.         int           cascade_width;
  149.         int           cascade_height;
  150.  
  151.     SgIconGCacheObjPart *cache;
  152.  
  153. #ifdef sgi
  154. /* Allow future extensions without breaking shared library compatibility */
  155.     caddr_t _SG_vendorExtension;
  156. #endif /* sgi */
  157. } SgIconGadgetPart;
  158.  
  159.  
  160. typedef struct _SgIconGadgetRec
  161. {
  162.    ObjectPart        object;
  163.    RectObjPart       rectangle;
  164.    XmGadgetPart      gadget;
  165.    SgIconGadgetPart  icon;
  166. } SgIconGadgetRec;
  167.  
  168. /* Inherited  Functions exported by icon */
  169.  
  170. #define XmInheritSetOverrideCallback ((XtWidgetProc) _XtInherit)
  171. #define XmInheritResize  ((XtWidgetProc) _XtInherit)
  172.  
  173. /* MACROS */
  174. /********
  175.  * Macros for cached instance fields
  176.  */
  177. #define IconG_Alignment(w)        (((SgIconGadget)(w)) -> \
  178.                        icon.cache-> alignment)
  179. #define IconG_StringDirection(w)        (((SgIconGadget)(w)) -> \
  180.                        icon.cache-> string_direction)
  181. #define IconG_MarginHeight(w)        (((SgIconGadget)(w)) -> \
  182.                                            icon.cache-> margin_height)
  183. #define IconG_MarginWidth(w)        (((SgIconGadget)(w)) -> \
  184.                                            icon.cache-> margin_width)
  185. #define IconG_MarginLeft(w)        (((SgIconGadget)(w)) -> \
  186.                                            icon.cache-> margin_left)
  187. #define IconG_MarginRight(w)        (((SgIconGadget)(w)) -> \
  188.                                            icon.cache-> margin_right)
  189. #define IconG_MarginTop(w)        (((SgIconGadget)(w)) -> \
  190.                                            icon.cache-> margin_top)
  191. #define IconG_MarginBottom(w)        (((SgIconGadget)(w)) -> \
  192.                                            icon.cache-> margin_bottom)
  193. #define IconG_MarginMiddle(w)        (((SgIconGadget)(w)) -> \
  194.                                            icon.cache-> margin_middle)
  195. #define IconG_RecomputeSize(w)        (((SgIconGadget)(w)) -> \
  196.                                            icon.cache-> recompute_size)
  197. #define IconG_SkipCallback(w)        (((SgIconGadget)(w)) -> \
  198.                                            icon.cache-> skipCallback)
  199. #define IconG_MenuType(w)        (((SgIconGadget)(w)) -> \
  200.                      icon.cache-> menu_type)
  201.  
  202. #define IconG_Foreground(w)        (((SgIconGadget)(w)) ->icon.cache->foreground)
  203. #define IconG_Background(w)        (((SgIconGadget)(w)) ->icon.cache->background)
  204. #define IconG_PixmapWidth(w)        (((SgIconGadget)(w)) ->icon.cache->pixmap_width) 
  205. #define IconG_PixmapHeight(w)        (((SgIconGadget)(w)) ->icon.cache->pixmap_height) 
  206. #define IconG_IconPlacement(w)        (((SgIconGadget)(w)) ->icon.cache->icon_placement) 
  207. #define IconG_TopShadowColor(w)        (((SgIconGadget)(w)) ->icon.cache->top_shadow_color) 
  208. #define IconG_BottomShadowColor(w)      (((SgIconGadget)(w)) ->icon.cache->bottom_shadow_color) 
  209. #define IconG_ShowCascade(w)          (((SgIconGadget)(w)) ->icon.cache->show_cascade) 
  210.  
  211. /********
  212.  * Macros for UNcached instance fields
  213.  */
  214. #define IconG_ShadowType(w)        (((SgIconGadget)(w)) ->icon.shadow_type) 
  215. #define IconG_CascadePixmap(w)          (((SgIconGadget)(w)) ->icon.cascade_pixmap)
  216. #define IconG_CascadePixmap_width(w)     (((SgIconGadget)(w)) ->icon.cascade_width)
  217. #define IconG_CascadePixmap_height(w)    (((SgIconGadget)(w)) ->icon.cascade_height)
  218. #define IconG_TopShadowGC(w)        (((SgIconGadget)(w)) ->icon.topshadow_GC) 
  219. #define IconG_BottomShadowGC(w)        (((SgIconGadget)(w)) ->icon.bottomshadow_GC) 
  220. #define IconG_InverseGC(w)        (((SgIconGadget)(w)) ->icon.inverse_GC) 
  221.  
  222. #define IconG__label(w)            (((SgIconGadget)(w)) -> \
  223.                        icon._label)
  224. #define IconG__acceleratorText(w)    (((SgIconGadget)(w)) -> \
  225.                                            icon._acc_text)
  226. #define IconG_Font(w)            (((SgIconGadget)(w)) -> \
  227.                        icon.font)
  228. #define IconG_Mnemonic(w)        (((SgIconGadget)(w)) -> \
  229.                        icon.mnemonic)
  230. #define IconG_MnemonicCharset(w)         (((SgIconGadget)(w)) -> \
  231.                                            icon.mnemonicCharset)
  232. #define IconG_Accelerator(w)        (((SgIconGadget)(w)) -> \
  233.                                            icon.accelerator)
  234. #define IconG_Pixmap(w)            (((SgIconGadget)(w)) -> \
  235.                                            icon.pixmap)
  236. #define IconG_PixmapInsensitive(w)    (((SgIconGadget)(w)) -> \
  237.                                            icon.pixmap_insen)
  238. #define IconG_Bitmap(w)                (((SgIconGadget)(w)) -> icon.bitmap)
  239. #define IconG_BitmapInsensitive(w)    (((SgIconGadget)(w)) -> icon.bitmap_insen)
  240.  
  241. #define IconG_NormalGC(w)        (((SgIconGadget)(w)) -> \
  242.                                            icon.normal_GC)
  243. #define IconG_InsensitiveGC(w)        (((SgIconGadget)(w)) -> \
  244.                                            icon.insensitive_GC)
  245. #define IconG_TextRect(w)        (((SgIconGadget)(w)) -> \
  246.                                            icon.TextRect)
  247. #define IconG_PixmapRect(w)        (((SgIconGadget)(w)) -> \
  248.                                            icon.pixmapRect)
  249.  
  250.  
  251. /********
  252.  * Convenience Macros 
  253.  */
  254. #define IconG_TextRect_x(w)        (IconG_TextRect(w).x)
  255.                                            
  256. #define IconG_TextRect_y(w)        (IconG_TextRect(w).y)
  257.                                            
  258. #define IconG_TextRect_width(w)        (IconG_TextRect(w).width)
  259.                                            
  260. #define IconG_TextRect_height(w)    (IconG_TextRect(w).height)
  261.  
  262. #define IconG_PixmapRect_x(w)        (IconG_PixmapRect(w).x)
  263.                                            
  264. #define IconG_PixmapRect_y(w)        (IconG_PixmapRect(w).y)
  265.                                            
  266. #define IconG_PixmapRect_width(w)        (IconG_PixmapRect(w).width)
  267.                                            
  268. #define IconG_PixmapRect_height(w)        (IconG_PixmapRect(w).height)
  269.  
  270.                                            
  271. #define IconG_Cache(w)            (((SgIconGadget)(w))-> \
  272.                        icon.cache)
  273. #define IconG_Shadow(w)                   (((SgIconGadget)(w))->gadget.shadow_thickness)
  274. #define IconG_Highlight(w)                (((SgIconGadget)(w))->gadget.highlight_thickness)
  275. #define IconG_Baseline(w)                 (_XmStringBaseline ( \
  276.                                          ((SgIconGadget)(w))->icon.font,\
  277.                                          ((SgIconGadget)(w))->icon._icon))
  278. #define IconG_ClassCachePart(w) \
  279.     (((SgIconGadgetClass)sgIconGadgetClass)->gadget_class.cache_part)
  280.  
  281.  
  282. /********    Private Function Declarations    ********/
  283. #ifdef _NO_PROTO
  284.  
  285. extern int _SgIconCacheCompare() ;
  286. extern void _SgCalcIconGDimensions() ;
  287. extern void _SgReCacheIconG() ;
  288. extern void _SgAssignIconG_MarginHeight() ;
  289. extern void _SgAssignIconG_MarginWidth() ;
  290. extern void _SgAssignIconG_MarginLeft() ;
  291. extern void _SgAssignIconG_MarginRight() ;
  292. extern void _SgAssignIconG_MarginTop() ;
  293. extern void _SgAssignIconG_MarginBottom() ;
  294. extern void _SgProcessDrag() ;
  295.  
  296. #else
  297.  
  298. extern int _SgIconCacheCompare( 
  299.                         XtPointer A,
  300.                         XtPointer B) ;
  301. extern void _SgCalcIconGDimensions( 
  302.                         Widget wid) ;
  303. extern void _SgReCacheIconG( 
  304.                         Widget wid) ;
  305. extern void _SgAssignIconG_MarginHeight( 
  306.                         SgIconGadget lw,
  307. #if NeedWidePrototypes
  308.                         int value) ;
  309. #else
  310.                         Dimension value) ;
  311. #endif /* NeedWidePrototypes */
  312. extern void _SgAssignIconG_MarginWidth( 
  313.                         SgIconGadget lw,
  314. #if NeedWidePrototypes
  315.                         int value) ;
  316. #else
  317.                         Dimension value) ;
  318. #endif /* NeedWidePrototypes */
  319. extern void _SgAssignIconG_MarginLeft( 
  320.                         SgIconGadget lw,
  321. #if NeedWidePrototypes
  322.                         int value) ;
  323. #else
  324.                         Dimension value) ;
  325. #endif /* NeedWidePrototypes */
  326. extern void _SgAssignIconG_MarginRight( 
  327.                         SgIconGadget lw,
  328. #if NeedWidePrototypes
  329.                         int value) ;
  330. #else
  331.                         Dimension value) ;
  332. #endif /* NeedWidePrototypes */
  333. extern void _SgAssignIconG_MarginTop( 
  334.                         SgIconGadget lw,
  335. #if NeedWidePrototypes
  336.                         int value) ;
  337. #else
  338.                         Dimension value) ;
  339. #endif /* NeedWidePrototypes */
  340. extern void _SgAssignIconG_MarginBottom( 
  341.                         SgIconGadget lw,
  342. #if NeedWidePrototypes
  343.                         int value) ;
  344. #else
  345.                         Dimension value) ;
  346. #endif /* NeedWidePrototypes */
  347. extern void _SgProcessDrag( 
  348.                         Widget w,
  349.                         XEvent *event,
  350.                         String *params,
  351.                         Cardinal *num_params) ;
  352.  
  353. #endif /* _NO_PROTO */
  354. /********    End Private Function Declarations    ********/
  355.  
  356.  
  357. #ifdef __cplusplus
  358. }  /* Close scope of 'extern "C"' declaration which encloses file. */
  359. #endif
  360.  
  361. #endif /* _SgIconGP_h */
  362. /* DON'T ADD ANYTHING AFTER THIS #endif */
  363.