home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / include / Xm / LabelGP.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-30  |  10.1 KB  |  303 lines

  1. /* 
  2.  * (c) Copyright 1989, 1990, 1991, 1992 OPEN SOFTWARE FOUNDATION, INC. 
  3.  * ALL RIGHTS RESERVED 
  4. */ 
  5. /* 
  6.  * Motif Release 1.2.1
  7. */ 
  8. /*   $RCSfile: LabelGP.h,v $ $Revision: 10.1 $ $Date: 1994/02/03 15:42:29 $ */
  9. /*
  10. *  (c) Copyright 1989, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */
  11. /*
  12. *  (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992 HEWLETT-PACKARD COMPANY */
  13. #ifndef _XmLabelGP_h
  14. #define _XmLabelGP_h
  15.  
  16. #include <Xm/LabelG.h>
  17. #include <Xm/GadgetP.h>
  18. #include <Xm/ExtObjectP.h>
  19.  
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23.  
  24. /*************************************************************/
  25. /* The Label Gadget Cache Object's class and instance records*/
  26. /*************************************************************/
  27.  
  28.  
  29. typedef struct _XmLabelGCacheObjClassPart
  30. {
  31.     int foo;
  32. } XmLabelGCacheObjClassPart;
  33.  
  34.  
  35. typedef struct _XmLabelGCacheObjClassRec     /* label cache class record */
  36. {
  37.     ObjectClassPart            object_class;
  38.     XmExtClassPart                     ext_class;
  39.     XmLabelGCacheObjClassPart         label_class_cache;
  40. } XmLabelGCacheObjClassRec;
  41.  
  42. externalref XmLabelGCacheObjClassRec xmLabelGCacheObjClassRec;
  43.  
  44.  
  45. /*  The Label Gadget Cache instance record  */
  46.  
  47. typedef struct _XmLabelGCacheObjPart
  48. {
  49.         unsigned char    label_type;
  50.         unsigned char    alignment;
  51.         unsigned char    string_direction;
  52.     
  53.     Dimension    margin_height;   /* margin around widget */
  54.     Dimension    margin_width;
  55.  
  56.     Dimension    margin_left;    /* additional margins on */
  57.     Dimension    margin_right;   /* each side of widget */
  58.     Dimension    margin_top;     /* text (or pixmap) is placed */
  59.     Dimension    margin_bottom;  /* inside the margins */
  60.  
  61.     Boolean recompute_size;
  62.  
  63.     Boolean        skipCallback; /* set by RowColumn when entryCallback
  64.                     is provided. */
  65.     unsigned char   menu_type;
  66. } XmLabelGCacheObjPart;
  67.  
  68. typedef struct _XmLabelGCacheObjRec
  69. {
  70.     ObjectPart               object;
  71.     XmExtPart                 ext;
  72.     XmLabelGCacheObjPart     label_cache;
  73. } XmLabelGCacheObjRec;
  74.  
  75. /*  The Label Widget Class and instance records  */
  76. /*************************************************/
  77.  
  78. typedef struct _XmLabelGadgetClassPart     /* label class record */
  79. {
  80.         XtWidgetProc        setOverrideCallback;
  81.     XmMenuProc        menuProcs;
  82.         XtPointer            extension; /* Pointer to extension record */
  83. } XmLabelGadgetClassPart;
  84.  
  85. typedef struct _XmLabelGadgetClassRec
  86. {
  87.     RectObjClassPart       rect_class;
  88.     XmGadgetClassPart      gadget_class;
  89.     XmLabelGadgetClassPart label_class;
  90. } XmLabelGadgetClassRec;
  91.  
  92. externalref XmLabelGadgetClassRec xmLabelGadgetClassRec;
  93.  
  94. typedef struct _XmLabelGadgetPart
  95. {
  96.     _XmString    _label;  /* String sent to this widget */
  97.         _XmString       _acc_text;
  98.         KeySym            mnemonic;
  99.     XmStringCharSet mnemonicCharset;
  100.         char         *accelerator;
  101.         XmFontList    font;
  102.  
  103.         Pixmap        pixmap; 
  104.         Pixmap        pixmap_insen; 
  105.  
  106.         /* PRIVATE members -- values computed by LabelWidgetClass methods */
  107.  
  108.         GC        normal_GC;   /* GC for text */    
  109.     GC        insensitive_GC;
  110.         XRectangle    TextRect;    /* The bounding box of the text, or clip
  111.                                         rectangle of the window; whichever is
  112.                                         smaller */
  113.         XRectangle    acc_TextRect; /* The bounding box of the text, or clip
  114.                                         rectangle of the window; whichever is
  115.                                         smaller */
  116.  
  117.     XmLabelGCacheObjPart *cache;
  118.  
  119. } XmLabelGadgetPart;
  120.  
  121.  
  122. typedef struct _XmLabelGadgetRec
  123. {
  124.    ObjectPart        object;
  125.    RectObjPart       rectangle;
  126.    XmGadgetPart      gadget;
  127.    XmLabelGadgetPart label;
  128. } XmLabelGadgetRec;
  129.  
  130. /* Inherited  Functions exported by label */
  131.  
  132. #define XmInheritSetOverrideCallback ((XtWidgetProc) _XtInherit)
  133. #define XmInheritResize  ((XtWidgetProc) _XtInherit)
  134.  
  135. /* Padding between label text and accelerator text */
  136.  
  137. #define LABELG_ACC_PAD        15
  138.  
  139. /* MACROS */
  140. /********
  141.  * Macros for cached instance fields
  142.  */
  143. #define LabG_LabelType(w)        (((XmLabelGadget)(w)) -> \
  144.                        label.cache-> label_type)
  145. #define LabG_Alignment(w)        (((XmLabelGadget)(w)) -> \
  146.                        label.cache-> alignment)
  147. #define LabG_StringDirection(w)        (((XmLabelGadget)(w)) -> \
  148.                        label.cache-> string_direction)
  149. #define LabG_MarginHeight(w)        (((XmLabelGadget)(w)) -> \
  150.                                            label.cache-> margin_height)
  151. #define LabG_MarginWidth(w)        (((XmLabelGadget)(w)) -> \
  152.                                            label.cache-> margin_width)
  153. #define LabG_MarginLeft(w)        (((XmLabelGadget)(w)) -> \
  154.                                            label.cache-> margin_left)
  155. #define LabG_MarginRight(w)        (((XmLabelGadget)(w)) -> \
  156.                                            label.cache-> margin_right)
  157. #define LabG_MarginTop(w)        (((XmLabelGadget)(w)) -> \
  158.                                            label.cache-> margin_top)
  159. #define LabG_MarginBottom(w)        (((XmLabelGadget)(w)) -> \
  160.                                            label.cache-> margin_bottom)
  161. #define LabG_RecomputeSize(w)        (((XmLabelGadget)(w)) -> \
  162.                                            label.cache-> recompute_size)
  163. #define LabG_SkipCallback(w)        (((XmLabelGadget)(w)) -> \
  164.                                            label.cache-> skipCallback)
  165. #define LabG_MenuType(w)        (((XmLabelGadget)(w)) -> \
  166.                                            label.cache-> menu_type)
  167. /********
  168.  * Macros for UNcached instance fields
  169.  */
  170. #define LabG__label(w)            (((XmLabelGadget)(w)) -> \
  171.                        label._label)
  172. #define LabG__acceleratorText(w)    (((XmLabelGadget)(w)) -> \
  173.                                            label._acc_text)
  174. #define LabG_Font(w)            (((XmLabelGadget)(w)) -> \
  175.                        label.font)
  176. #define LabG_Mnemonic(w)        (((XmLabelGadget)(w)) -> \
  177.                        label.mnemonic)
  178. #define LabG_MnemonicCharset(w)         (((XmLabelGadget)(w)) -> \
  179.                                            label.mnemonicCharset)
  180. #define LabG_Accelerator(w)        (((XmLabelGadget)(w)) -> \
  181.                                            label.accelerator)
  182. #define LabG_Pixmap(w)            (((XmLabelGadget)(w)) -> \
  183.                                            label.pixmap)
  184. #define LabG_PixmapInsensitive(w)    (((XmLabelGadget)(w)) -> \
  185.                                            label.pixmap_insen)
  186. #define LabG_NormalGC(w)        (((XmLabelGadget)(w)) -> \
  187.                                            label.normal_GC)
  188. #define LabG_InsensitiveGC(w)        (((XmLabelGadget)(w)) -> \
  189.                                            label.insensitive_GC)
  190. #define LabG_TextRect(w)        (((XmLabelGadget)(w)) -> \
  191.                                            label.TextRect)
  192. #define LabG_AccTextRect(w)        (((XmLabelGadget)(w)) -> \
  193.                                            label.acc_TextRect)
  194.  
  195.  
  196. /********
  197.  * Convenience Macros 
  198.  */
  199. #define LabG_TextRect_x(w)        (LabG_TextRect(w).x)
  200.                                            
  201. #define LabG_TextRect_y(w)        (LabG_TextRect(w).y)
  202.                                            
  203. #define LabG_TextRect_width(w)        (LabG_TextRect(w).width)
  204.                                            
  205. #define LabG_TextRect_height(w)        (LabG_TextRect(w).height)
  206.                                            
  207. #define LabG_IsText(w)            (LabG_LabelType(w) == XmSTRING)
  208.  
  209. #define LabG_IsPixmap(w)        (LabG_LabelType(w) == XmPIXMAP)
  210.  
  211. #define LabG_Cache(w)            (((XmLabelGadget)(w))-> \
  212.                        label.cache)
  213. #define LabG_Shadow(w)                   (((XmLabelGadget)(w))->gadget.shadow_thickness)
  214. #define LabG_Highlight(w)                (((XmLabelGadget)(w))->gadget.highlight_thickness)
  215. #define LabG_Baseline(w)                 (_XmStringBaseline ( \
  216.                                          ((XmLabelGadget)(w))->label.font,\
  217.                                          ((XmLabelGadget)(w))->label._label))
  218. #define LabG_ClassCachePart(w) \
  219.     (((XmLabelGadgetClass)xmLabelGadgetClass)->gadget_class.cache_part)
  220.  
  221.  
  222. /********    Private Function Declarations    ********/
  223. #ifdef _NO_PROTO
  224.  
  225. extern int _XmLabelCacheCompare() ;
  226. extern void _XmCalcLabelGDimensions() ;
  227. extern void _XmReCacheLabG() ;
  228. extern void _XmAssignLabG_MarginHeight() ;
  229. extern void _XmAssignLabG_MarginWidth() ;
  230. extern void _XmAssignLabG_MarginLeft() ;
  231. extern void _XmAssignLabG_MarginRight() ;
  232. extern void _XmAssignLabG_MarginTop() ;
  233. extern void _XmAssignLabG_MarginBottom() ;
  234. extern void _XmProcessDrag() ;
  235.  
  236. #else
  237.  
  238. extern int _XmLabelCacheCompare( 
  239.                         XtPointer A,
  240.                         XtPointer B) ;
  241. extern void _XmCalcLabelGDimensions( 
  242.                         Widget wid) ;
  243. extern void _XmReCacheLabG( 
  244.                         Widget wid) ;
  245. extern void _XmAssignLabG_MarginHeight( 
  246.                         XmLabelGadget lw,
  247. #if NeedWidePrototypes
  248.                         int value) ;
  249. #else
  250.                         Dimension value) ;
  251. #endif /* NeedWidePrototypes */
  252. extern void _XmAssignLabG_MarginWidth( 
  253.                         XmLabelGadget lw,
  254. #if NeedWidePrototypes
  255.                         int value) ;
  256. #else
  257.                         Dimension value) ;
  258. #endif /* NeedWidePrototypes */
  259. extern void _XmAssignLabG_MarginLeft( 
  260.                         XmLabelGadget lw,
  261. #if NeedWidePrototypes
  262.                         int value) ;
  263. #else
  264.                         Dimension value) ;
  265. #endif /* NeedWidePrototypes */
  266. extern void _XmAssignLabG_MarginRight( 
  267.                         XmLabelGadget lw,
  268. #if NeedWidePrototypes
  269.                         int value) ;
  270. #else
  271.                         Dimension value) ;
  272. #endif /* NeedWidePrototypes */
  273. extern void _XmAssignLabG_MarginTop( 
  274.                         XmLabelGadget lw,
  275. #if NeedWidePrototypes
  276.                         int value) ;
  277. #else
  278.                         Dimension value) ;
  279. #endif /* NeedWidePrototypes */
  280. extern void _XmAssignLabG_MarginBottom( 
  281.                         XmLabelGadget lw,
  282. #if NeedWidePrototypes
  283.                         int value) ;
  284. #else
  285.                         Dimension value) ;
  286. #endif /* NeedWidePrototypes */
  287. extern void _XmProcessDrag( 
  288.                         Widget w,
  289.                         XEvent *event,
  290.                         String *params,
  291.                         Cardinal *num_params) ;
  292.  
  293. #endif /* _NO_PROTO */
  294. /********    End Private Function Declarations    ********/
  295.  
  296.  
  297. #ifdef __cplusplus
  298. }  /* Close scope of 'extern "C"' declaration which encloses file. */
  299. #endif
  300.  
  301. #endif /* _XmLabelGP_h */
  302. /* DON'T ADD ANYTHING AFTER THIS #endif */
  303.