Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:15:26

0001 /* 
0002  * Motif
0003  *
0004  * Copyright (c) 1987-2012, The Open Group. All rights reserved.
0005  *
0006  * These libraries and programs are free software; you can
0007  * redistribute them and/or modify them under the terms of the GNU
0008  * Lesser General Public License as published by the Free Software
0009  * Foundation; either version 2 of the License, or (at your option)
0010  * any later version.
0011  *
0012  * These libraries and programs are distributed in the hope that
0013  * they will be useful, but WITHOUT ANY WARRANTY; without even the
0014  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
0015  * PURPOSE. See the GNU Lesser General Public License for more
0016  * details.
0017  *
0018  * You should have received a copy of the GNU Lesser General Public
0019  * License along with these librararies and programs; if not, write
0020  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
0021  * Floor, Boston, MA 02110-1301 USA
0022 */ 
0023 #ifndef _XmLabelGP_h
0024 #define _XmLabelGP_h
0025 
0026 #include <Xm/LabelG.h>
0027 #include <Xm/GadgetP.h>
0028 #include <Xm/ExtObjectP.h>
0029 #include <Xm/XmP.h>
0030 
0031 #ifdef __cplusplus
0032 extern "C" {
0033 #endif
0034 
0035 /*************************************************************/
0036 /* The Label Gadget Cache Object's class and instance records*/
0037 /*************************************************************/
0038 
0039 /* Enumerations for fill_bg_box. */
0040 enum { _XmPLAIN_BG_BOX, _XmFILL_BG_BOX, _XmALWAYS_FILL_BG_BOX };
0041 
0042 typedef struct _XmLabelGCacheObjClassPart
0043 {
0044   int foo;
0045 } XmLabelGCacheObjClassPart;
0046 
0047 
0048 typedef struct _XmLabelGCacheObjClassRec     /* label cache class record */
0049 {
0050   ObjectClassPart       object_class;
0051   XmExtClassPart                ext_class;
0052   XmLabelGCacheObjClassPart label_class_cache;
0053 } XmLabelGCacheObjClassRec;
0054 
0055 externalref XmLabelGCacheObjClassRec xmLabelGCacheObjClassRec;
0056 
0057 
0058 /*  The Label Gadget Cache instance record  */
0059 
0060 typedef struct _XmLabelGCacheObjPart
0061 {
0062   unsigned char label_type;
0063   unsigned char alignment;
0064   unsigned char string_direction;
0065   
0066   Dimension margin_height;   /* margin around widget */
0067   Dimension margin_width;
0068   
0069   Dimension margin_left;    /* additional margins on */
0070   Dimension margin_right;   /* each side of widget */
0071   Dimension margin_top;     /* text (or pixmap) is placed */
0072   Dimension margin_bottom;  /* inside the margins */
0073   
0074   Boolean   recompute_size;
0075   
0076   Boolean   skipCallback;   /* set by RowColumn with entryCallback */
0077   unsigned char menu_type;
0078 
0079   /*
0080    * Following are color resources and instance variables for Gadgets.
0081    * Because of problems involving the history of the gadget cache these
0082    * variables appear here rather than in XmGadget.
0083    *
0084    * XmArrowButtonGadget and XmSeparatorGadget have effectively the same
0085    * set of color resources implemented for each.
0086    * 
0087    * XmLabelGadget does not use all of these variables (e.g top_shadow_color).
0088    * It initializes them and maintains them but does not use all of them
0089    * to render the label gadget.  They are here for use by subclasses.
0090    *
0091    *  Sterling Barrett
0092    *  sterling@ics.com
0093    */
0094   
0095   GC        background_GC;
0096   GC        top_shadow_GC;
0097   GC        bottom_shadow_GC;
0098   GC        highlight_GC;
0099   
0100   Pixel     foreground;
0101   Pixel     background;
0102   
0103   Pixel     top_shadow_color;
0104   Pixmap    top_shadow_pixmap;
0105   
0106   Pixel     bottom_shadow_color;
0107   Pixmap    bottom_shadow_pixmap;
0108   
0109   Pixel     highlight_color;
0110   Pixmap    highlight_pixmap;
0111 } XmLabelGCacheObjPart;
0112 
0113 typedef struct _XmLabelGCacheObjRec
0114 {
0115   ObjectPart            object;
0116   XmExtPart     ext;
0117   XmLabelGCacheObjPart  label_cache;
0118 } XmLabelGCacheObjRec;
0119 
0120 /*  The Label Widget Class and instance records  */
0121 /*************************************************/
0122 
0123 typedef struct _XmLabelGadgetClassPart     /* label class record */
0124 {
0125   XtWidgetProc      setOverrideCallback;
0126   XmMenuProc        menuProcs;
0127   XtPointer     extension;
0128 } XmLabelGadgetClassPart;
0129 
0130 typedef struct _XmLabelGadgetClassRec
0131 {
0132   RectObjClassPart       rect_class;
0133   XmGadgetClassPart      gadget_class;
0134   XmLabelGadgetClassPart label_class;
0135 } XmLabelGadgetClassRec;
0136 
0137 externalref XmLabelGadgetClassRec xmLabelGadgetClassRec;
0138 
0139 typedef struct _XmLabelGadgetPart
0140 {
0141   _XmString   _label;  /* String sent to this widget */
0142   _XmString       _acc_text;
0143   KeySym          mnemonic;
0144   XmStringCharSet mnemonicCharset;
0145   char        *accelerator;
0146   XmFontList      font;
0147   
0148   Pixmap      pixmap; 
0149   Pixmap      pixmap_insen; 
0150   
0151   /* PRIVATE members -- values computed by LabelWidgetClass methods */
0152   
0153   GC          normal_GC;   /* GC for text */    
0154   GC          insensitive_GC;
0155   XRectangle      TextRect;     /* The bounding box of the text or clip */
0156   XRectangle      acc_TextRect; /* rectangle of the window; whichever is
0157                  smaller */
0158   
0159   XmLabelGCacheObjPart *cache;
0160   
0161   Dimension   acc_left_delta;  /* Amount we increased the margins */
0162   Dimension   acc_right_delta; /* to accomodate accelerator text */
0163 
0164   Dimension * baselines;    /* Cached baseline information. */
0165 
0166   XtEnum          fill_bg_box;     /* Computed by LabelGadget or */
0167                    /* pinned by subclasses. */
0168   Boolean     check_set_render_table;
0169 
0170   XmPixmapPlacement pixmap_placement; /* Where to place the icon label. */
0171   Dimension pixmap_text_padding; /* padding between the icon and the text. */
0172 
0173   XRectangle      PixmapRect;   /* The bounding box of the pixmap in TextRect */
0174   XRectangle      StringRect;   /* The bounding box of the string in TextRect */
0175 #ifdef FIX_1381
0176   GC          shadow_GC;
0177 #endif
0178 
0179 } XmLabelGadgetPart;
0180 
0181 
0182 typedef struct _XmLabelGadgetRec
0183 {
0184   ObjectPart        object;
0185   RectObjPart       rectangle;
0186   XmGadgetPart      gadget;
0187   XmLabelGadgetPart label;
0188 } XmLabelGadgetRec;
0189 
0190 typedef struct _LRectangle
0191 {
0192   int x, y;
0193   int width, height;
0194 } LRectangle;
0195 
0196 /* Inherited  Functions exported by label */
0197 
0198 #define XmInheritSetOverrideCallback    ((XtWidgetProc) _XtInherit)
0199 #define XmInheritResize         ((XtWidgetProc) _XtInherit)
0200 
0201 #define INVALID_PIXEL   ((Pixel) -1)
0202 #define INVALID_PIXMAP  ((Pixmap) -1)
0203 /* Padding between label text and accelerator text */
0204 
0205 #define LABELG_ACC_PAD  15
0206 
0207 /* MACROS */
0208 /********
0209  * Macros for cached instance fields
0210  */
0211 #define LabG_LabelType(w)       (((XmLabelGadget)(w)) -> \
0212                        label.cache-> label_type)
0213 #define LabG_Alignment(w)       (((XmLabelGadget)(w)) -> \
0214                        label.cache-> alignment)
0215 #define LabG_StringDirection(w)     (((XmLabelGadget)(w)) -> \
0216                        label.cache-> string_direction)
0217 #define LabG_MarginHeight(w)        (((XmLabelGadget)(w)) -> \
0218                                            label.cache-> margin_height)
0219 #define LabG_MarginWidth(w)     (((XmLabelGadget)(w)) -> \
0220                                            label.cache-> margin_width)
0221 #define LabG_MarginLeft(w)      (((XmLabelGadget)(w)) -> \
0222                                            label.cache-> margin_left)
0223 #define LabG_MarginRight(w)     (((XmLabelGadget)(w)) -> \
0224                                            label.cache-> margin_right)
0225 #define LabG_MarginTop(w)       (((XmLabelGadget)(w)) -> \
0226                                            label.cache-> margin_top)
0227 #define LabG_MarginBottom(w)        (((XmLabelGadget)(w)) -> \
0228                                            label.cache-> margin_bottom)
0229 #define LabG_RecomputeSize(w)       (((XmLabelGadget)(w)) -> \
0230                                            label.cache-> recompute_size)
0231 #define LabG_SkipCallback(w)        (((XmLabelGadget)(w)) -> \
0232                                            label.cache-> skipCallback)
0233 #define LabG_MenuType(w)        (((XmLabelGadget)(w)) -> \
0234                                            label.cache-> menu_type)
0235 #define LabG_BackgroundGC(w)        (((XmLabelGadget)(w)) -> \
0236                                            label.cache-> background_GC)
0237 #define LabG_TopShadowGC(w)     (((XmLabelGadget)(w)) -> \
0238                                            label.cache-> top_shadow_GC)
0239 #define LabG_BottomShadowGC(w)      (((XmLabelGadget)(w)) -> \
0240                                            label.cache-> bottom_shadow_GC)
0241 #define LabG_HighlightGC(w)     (((XmLabelGadget)(w)) -> \
0242                                            label.cache-> highlight_GC)
0243 #define LabG_Foreground(w)      (((XmLabelGadget)(w)) -> \
0244                                            label.cache-> foreground)
0245 #define LabG_Background(w)      (((XmLabelGadget)(w)) -> \
0246                                            label.cache-> background)
0247 #define LabG_TopShadowColor(w)      (((XmLabelGadget)(w)) -> \
0248                                            label.cache-> top_shadow_color)
0249 #define LabG_TopShadowPixmap(w)     (((XmLabelGadget)(w)) -> \
0250                                            label.cache-> top_shadow_pixmap)
0251 #define LabG_BottomShadowColor(w)   (((XmLabelGadget)(w)) -> \
0252                                            label.cache-> bottom_shadow_color)
0253 #define LabG_BottomShadowPixmap(w)  (((XmLabelGadget)(w)) -> \
0254                                            label.cache-> bottom_shadow_pixmap)
0255 #define LabG_HighlightColor(w)          (((XmLabelGadget)(w)) -> \
0256                                            label.cache-> highlight_color)
0257 #define LabG_HighlightPixmap(w)         (((XmLabelGadget)(w)) -> \
0258                                            label.cache-> highlight_pixmap)
0259 /********
0260  * Macros for UNcached instance fields
0261  */
0262 #define LabG__label(w)          (((XmLabelGadget)(w)) -> \
0263                        label._label)
0264 #define LabG__acceleratorText(w)    (((XmLabelGadget)(w)) -> \
0265                                            label._acc_text)
0266 #define LabG_Font(w)            (((XmLabelGadget)(w)) -> \
0267                        label.font)
0268 #define LabG_Mnemonic(w)        (((XmLabelGadget)(w)) -> \
0269                        label.mnemonic)
0270 #define LabG_MnemonicCharset(w)         (((XmLabelGadget)(w)) -> \
0271                                            label.mnemonicCharset)
0272 #define LabG_Accelerator(w)     (((XmLabelGadget)(w)) -> \
0273                                            label.accelerator)
0274 #define LabG_Pixmap(w)          (((XmLabelGadget)(w)) -> \
0275                                            label.pixmap)
0276 #define LabG_PixmapInsensitive(w)   (((XmLabelGadget)(w)) -> \
0277                                            label.pixmap_insen)
0278 #define LabG_NormalGC(w)        (((XmLabelGadget)(w)) -> \
0279                                            label.normal_GC)
0280 #define LabG_InsensitiveGC(w)       (((XmLabelGadget)(w)) -> \
0281                                            label.insensitive_GC)
0282 #ifdef FIX_1381
0283 #define LabG_ShadowGC(w)        (((XmLabelGadget)(w)) -> \
0284                                            label.shadow_GC)
0285 #endif
0286 #define LabG_TextRect(w)        (((XmLabelGadget)(w)) -> \
0287                                            label.TextRect)
0288 #define LabG_AccTextRect(w)     (((XmLabelGadget)(w)) -> \
0289                                            label.acc_TextRect)
0290 #define LabG_PixmapRect(w)      (((XmLabelGadget)(w)) -> \
0291                                            label.PixmapRect)
0292 #define LabG_StringRect(w)      (((XmLabelGadget)(w)) -> \
0293                                            label.StringRect)
0294 #define LabG_PixmapPlacement(w)     (((XmLabelGadget)(w)) -> \
0295                                            label.pixmap_placement)
0296 #define LabG_PixmapTextPadding(w)   (((XmLabelGadget)(w)) -> \
0297                                            label.pixmap_text_padding)
0298 
0299 
0300 /********
0301  * Convenience Macros 
0302  */
0303 #define LabG_TextRect_x(w)      (LabG_TextRect(w).x)
0304                                            
0305 #define LabG_TextRect_y(w)      (LabG_TextRect(w).y)
0306                                            
0307 #define LabG_TextRect_width(w)      (LabG_TextRect(w).width)
0308                                            
0309 #define LabG_TextRect_height(w)     (LabG_TextRect(w).height)
0310 
0311 #define LabG_IsText(w)          (LabG_LabelType(w) == XmSTRING)
0312 
0313 #define LabG_IsPixmap(w)        (LabG_LabelType(w) == XmPIXMAP)
0314 
0315 #define LabG_IsPixmapAndText(w)     (LabG_LabelType(w) == \
0316                     XmPIXMAP_AND_STRING)
0317 
0318 #define LabG_Cache(w)           (((XmLabelGadget)(w))-> \
0319                        label.cache)
0320 #define LabG_Shadow(w)    (((XmLabelGadget)(w))->gadget.shadow_thickness)
0321 #define LabG_Highlight(w) (((XmLabelGadget)(w))->gadget.highlight_thickness)
0322 #define LabG_Baseline(w)  (_XmStringBaseline ((LabG_Font(w)), (LabG__Label(w))))
0323 #define LabG_ClassCachePart(w)  \
0324     (((XmLabelGadgetClass)xmLabelGadgetClass)->gadget_class.cache_part)
0325 
0326 #define LabG_IsMenupane(w)  ((LabG_MenuType(w) == XmMENU_POPUP) ||  \
0327                  (LabG_MenuType(w) == XmMENU_PULLDOWN))
0328 
0329 #define _XmAssignLabG_MarginHeight_r(cache, val) \
0330         cache->margin_height = val
0331 #define _XmAssignLabG_MarginWidth_r(cache, val) \
0332         cache->margin_width = val
0333 #define _XmAssignLabG_MarginLeft_r(cache, val) \
0334         cache->margin_left = val
0335 #define _XmAssignLabG_MarginRight_r(cache, val) \
0336         cache->margin_right = val
0337 #define _XmAssignLabG_MarginTop_r(cache, val) \
0338         cache->margin_top = val
0339 #define _XmAssignLabG_MarginBottom_r(cache, val) \
0340         cache->margin_bottom = val
0341 
0342 extern void _XmQualifyLabelLocalCache(XmLabelGCacheObjPart *, XmLabelGadget);
0343 extern void _XmReCacheLabG_r(XmLabelGCacheObjPart *, XmLabelGadget);
0344 
0345 #ifdef __cplusplus
0346 }  /* Close scope of 'extern "C"' declaration which encloses file. */
0347 #endif
0348 
0349 #endif /* _XmLabelGP_h */
0350 /* DON'T ADD ANYTHING AFTER THIS #endif */