1 /* $XConsortium: IconGP.h /main/9 1995/10/25 20:06:59 cde-sun $ */ 2 /* 3 * Motif 4 * 5 * Copyright (c) 1987-2012, The Open Group. All rights reserved. 6 * 7 * These libraries and programs are free software; you can 8 * redistribute them and/or modify them under the terms of the GNU 9 * Lesser General Public License as published by the Free Software 10 * Foundation; either version 2 of the License, or (at your option) 11 * any later version. 12 * 13 * These libraries and programs are distributed in the hope that 14 * they will be useful, but WITHOUT ANY WARRANTY; without even the 15 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 16 * PURPOSE. See the GNU Lesser General Public License for more 17 * details. 18 * 19 * You should have received a copy of the GNU Lesser General Public 20 * License along with these librararies and programs; if not, write 21 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth 22 * Floor, Boston, MA 02110-1301 USA 23 */ 24 /* 25 * HISTORY 26 */ 27 #ifndef _XmIconGP_h 28 #define _XmIconGP_h 29 30 #include <Xm/XmP.h> 31 #include <Xm/ManagerP.h> 32 #include <Xm/GadgetP.h> 33 #include <Xm/IconG.h> 34 #include <Xm/ExtObjectP.h> 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 typedef Widget (*XmGetContainerParentProc)(Widget) ; 41 42 #define XmInheritGetContainerParentProc ((XmGetContainerParentProc) _XtInherit) 43 44 45 /* IconGadget class record */ 46 typedef struct _XmIconGadgetClassPart 47 { 48 XmGetContainerParentProc get_container_parent; 49 XtPointer extension ; 50 } XmIconGadgetClassPart; 51 52 53 /* Full class record declaration */ 54 typedef struct _XmIconGadgetClassRec 55 { 56 RectObjClassPart rect_class; 57 XmGadgetClassPart gadget_class; 58 XmIconGadgetClassPart icong_class; 59 } XmIconGadgetClassRec; 60 61 extern XmIconGadgetClassRec xmIconGadgetClassRec; 62 63 /*****************************************************************/ 64 /* The Icon Gadget Cache Object's class and instance records*/ 65 /*****************************************************************/ 66 67 typedef struct _XmIconGCacheObjClassPart 68 { 69 XtPointer extension; 70 } XmIconGCacheObjClassPart; 71 72 73 typedef struct _XmIconGCacheObjClassRec /* Icon cache class record */ 74 { 75 ObjectClassPart object_class; 76 XmExtClassPart ext_class; 77 XmIconGCacheObjClassPart icon_class_cache; 78 } XmIconGCacheObjClassRec; 79 80 externalref XmIconGCacheObjClassRec xmIconGCacheObjClassRec; 81 82 /* The Icon Gadget Cache instance record */ 83 84 typedef struct _XmIconGCacheObjPart 85 { 86 XmRenderTable render_table; /* XmNrenderTable */ 87 GC selected_GC; 88 GC inverse_GC; 89 90 Pixel background; 91 Pixel foreground; 92 Pixel top_shadow_color; 93 Pixel bottom_shadow_color; 94 Pixel highlight_color; 95 96 Pixmap background_pixmap; 97 Pixmap top_shadow_pixmap; 98 Pixmap bottom_shadow_pixmap; 99 Pixmap highlight_pixmap; 100 101 GC normal_GC; 102 GC background_GC; 103 GC insensitive_GC; 104 GC top_shadow_GC; 105 GC bottom_shadow_GC; 106 GC highlight_GC; 107 108 unsigned char alignment; 109 Dimension spacing; 110 Dimension margin_width; 111 Dimension margin_height; 112 #ifdef FIX_1381 113 GC shadow_GC; 114 #endif 115 } XmIconGCacheObjPart; 116 117 typedef struct _XmIconGCacheObjRec 118 { 119 ObjectPart object; 120 XmExtPart ext; 121 XmIconGCacheObjPart icon_cache; 122 } XmIconGCacheObjRec; 123 124 typedef struct _XmIconGCacheObjRec * XmIconGCacheObject; 125 126 /* IconGadget instance record */ 127 typedef struct _XmIconGadgetPart 128 { 129 XmString label_string; /* XmNlabelString */ 130 Pixmap large_icon_mask; /* XmNlargeIconMask */ 131 Pixmap large_icon_pixmap; /* XmNlargeIconPixmap */ 132 Pixmap small_icon_mask; /* XmNsmallIconMask */ 133 Pixmap small_icon_pixmap; /* XmNsmallIconPixmap */ 134 unsigned char viewtype; /* XmNviewType */ 135 unsigned char visual_emphasis; /* XmNvisualEmphasis */ 136 XmString * detail; /* XmNdetail */ 137 Cardinal detail_count; /* XmNdetailCount */ 138 /* Private variables */ 139 Dimension label_rect_width ; 140 Dimension label_rect_height ; 141 Dimension large_icon_rect_width; 142 Dimension large_icon_rect_height; 143 Dimension small_icon_rect_width; 144 Dimension small_icon_rect_height; 145 String large_pixmap_name ; 146 String small_pixmap_name ; 147 148 XmIconGCacheObjPart *cache; 149 Boolean check_set_render_table; 150 } XmIconGadgetPart; 151 152 /* Full instance record declaration */ 153 typedef struct _XmIconGadgetRec 154 { 155 ObjectPart object; 156 RectObjPart rectangle; 157 XmGadgetPart gadget; 158 XmIconGadgetPart icong; 159 } XmIconGadgetRec; 160 161 162 /* Useful macros */ 163 #define IG_LabelString(w) (((XmIconGadget)(w))->icong.label_string) 164 #define IG_LargeIconMask(w) (((XmIconGadget)(w))->icong.large_icon_mask) 165 #define IG_LargeIconPixmap(w) (((XmIconGadget)(w))->icong.large_icon_pixmap) 166 #define IG_SmallIconMask(w) (((XmIconGadget)(w))->icong.small_icon_mask) 167 #define IG_SmallIconPixmap(w) (((XmIconGadget)(w))->icong.small_icon_pixmap) 168 #define IG_ViewType(w) (((XmIconGadget)(w))->icong.viewtype) 169 #define IG_VisualEmphasis(w) (((XmIconGadget)(w))->icong.visual_emphasis) 170 #define IG_Detail(w) (((XmIconGadget)(w))->icong.detail) 171 #define IG_DetailCount(w) (((XmIconGadget)(w))->icong.detail_count) 172 #define IG_LabelRectWidth(w) (((XmIconGadget)(w))->icong.label_rect_width) 173 #define IG_LabelRectHeight(w) (((XmIconGadget)(w))->icong.label_rect_height) 174 #define IG_LargeIconRectWidth(w) \ 175 (((XmIconGadget)(w))->icong.large_icon_rect_width) 176 #define IG_LargeIconRectHeight(w) \ 177 (((XmIconGadget)(w))->icong.large_icon_rect_height) 178 #define IG_SmallIconRectWidth(w) \ 179 (((XmIconGadget)(w))->icong.small_icon_rect_width) 180 #define IG_SmallIconRectHeight(w) \ 181 (((XmIconGadget)(w))->icong.small_icon_rect_height) 182 #define IG_LargePixmapName(w) (((XmIconGadget)(w))->icong.large_pixmap_name) 183 #define IG_SmallPixmapName(w) (((XmIconGadget)(w))->icong.small_pixmap_name) 184 185 /* XmNrecomputeSize didn't make it as a resource, but since the 186 code is already written, I'll keep it and force its value here. 187 If it's ever wanted back, just replace that macro by: 188 #define IG_RecomputeSize(w) (((XmIconGadget)(w))->icong.recompute_size) */ 189 #define IG_RecomputeSize(w) (True) 190 191 #define IG_LayoutDirection(w) (((XmIconGadget)(w))->gadget.layout_direction) 192 #define IG_Highlighted(w) (((XmIconGadget)(w))->gadget.highlighted) 193 #define IG_HLThickness(w) (((XmIconGadget)(w))->gadget.highlight_thickness) 194 #define IG_ShadowThickness(w) (((XmIconGadget)(w))->gadget.shadow_thickness) 195 #define IG_Depth(w) (((XmManagerWidget) \ 196 (((XmGadget)(w))->object.parent))->core.depth) 197 198 /* cached resources for IconGadget */ 199 #define IG_RenderTable(w) (((XmIconGadget)(w))-> \ 200 icong.cache->render_table) 201 #define IG_SelectedGC(w) (((XmIconGadget)(w))-> \ 202 icong.cache->selected_GC) 203 #define IG_InverseGC(w) (((XmIconGadget)(w))-> \ 204 icong.cache->inverse_GC) 205 206 /** These are gadget resources really. hopefully in 2.1, 207 that will be replaced by stuff like: 208 #define IG_Background(w) Gad_Background(w) 209 #define IG_BackgroundGC(w) Gad_BackgroundGC(w) 210 etc, etc ***/ 211 #define IG_Background(w) (((XmIconGadget)(w))-> \ 212 icong.cache->background) 213 #define IG_Foreground(w) (((XmIconGadget)(w))-> \ 214 icong.cache->foreground) 215 #define IG_TopShadowColor(w) (((XmIconGadget)(w))-> \ 216 icong.cache->top_shadow_color) 217 #define IG_BottomShadowColor(w) (((XmIconGadget)(w))-> \ 218 icong.cache->bottom_shadow_color) 219 #define IG_HighlightColor(w) (((XmIconGadget)(w))-> \ 220 icong.cache->highlight_color) 221 222 #define IG_BackgroundPixmap(w) (((XmIconGadget)(w))-> \ 223 icong.cache->background_pixmap) 224 #define IG_TopShadowPixmap(w) (((XmIconGadget)(w))-> \ 225 icong.cache->top_shadow_pixmap) 226 #define IG_BottomShadowPixmap(w) (((XmIconGadget)(w))-> \ 227 icong.cache->bottom_shadow_pixmap) 228 #define IG_HighlightPixmap(w) (((XmIconGadget)(w))-> \ 229 icong.cache->highlight_pixmap) 230 231 #define IG_NormalGC(w) (((XmIconGadget)(w))-> \ 232 icong.cache->normal_GC) 233 #define IG_BackgroundGC(w) (((XmIconGadget)(w))-> \ 234 icong.cache->background_GC) 235 #define IG_InsensitiveGC(w) (((XmIconGadget)(w))-> \ 236 icong.cache->insensitive_GC) 237 #ifdef FIX_1381 238 #define IG_ShadowGC(w) (((XmIconGadget)(w))-> \ 239 icong.cache->shadow_GC) 240 #endif 241 #define IG_TopShadowGC(w) (((XmIconGadget)(w))-> \ 242 icong.cache->top_shadow_GC) 243 #define IG_BottomShadowGC(w) (((XmIconGadget)(w))-> \ 244 icong.cache->bottom_shadow_GC) 245 #define IG_HighlightGC(w) (((XmIconGadget)(w))-> \ 246 icong.cache->highlight_GC) 247 #define IG_Alignment(w) (((XmIconGadget)(w))-> \ 248 icong.cache->alignment) 249 #define IG_Spacing(w) (((XmIconGadget)(w))-> \ 250 icong.cache->spacing) 251 #define IG_MarginWidth(w) (((XmIconGadget)(w))-> \ 252 icong.cache->margin_width) 253 #define IG_MarginHeight(w) (((XmIconGadget)(w))-> \ 254 icong.cache->margin_height) 255 256 257 /* Convenience Macros */ 258 #define IG_Cache(w) (((XmIconGadget)(w))->icong.cache) 259 #define IG_ClassCachePart(w) (((XmIconGadgetClass)xmIconGadgetClass)->\ 260 gadget_class.cache_part) 261 262 #ifdef __cplusplus 263 } /* Close scope of 'extern "C"' declaration which encloses file. */ 264 #endif 265 266 #endif /* _XmIconGP_h */ 267 /* DON'T ADD ANYTHING AFTER THIS #endif */ 268