2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: IconP.h /main/7 1996/03/29 11:33:23 drk $ */
24 /**---------------------------------------------------------------------
28 *** project: MotifPlus Widgets
30 *** description: Private include file for DtIcon gadget class.
33 *** (c) Copyright 1990 by Hewlett-Packard Company.
36 ***-------------------------------------------------------------------*/
42 #include <Xm/ExtObjectP.h>
44 #include <Xm/GadgetP.h>
48 /*-------------------------------------------------------------
49 ** Cache Class Structure
54 typedef struct _DtIconCacheObjClassPart
57 } DtIconCacheObjClassPart;
59 /* Cache Full Class Record
61 typedef struct _DtIconCacheObjClassRec /* label cache class record */
63 ObjectClassPart object_class;
64 XmExtClassPart ext_class;
65 DtIconCacheObjClassPart icon_class_cache;
66 } DtIconCacheObjClassRec;
70 externalref DtIconCacheObjClassRec dtIconCacheObjClassRec;
73 /*-------------------------------------------------------------
74 ** Cache Instance Structure
77 /* Cache Instance Part
79 typedef struct _DtIconCacheObjPart
81 Dimension margin_width;
82 Dimension margin_height;
83 Dimension string_height;
89 Boolean recompute_size;
91 unsigned char pixmap_position;
92 unsigned char string_position;
93 unsigned char alignment;
94 unsigned char behavior;
95 unsigned char fill_mode;
98 typedef struct _DtIconCacheObjRec
102 DtIconCacheObjPart icon_cache;
106 typedef void (*GetPositionProc)(
117 typedef void (*GetSizeProc)(
122 typedef void (*DrawProc)(
134 typedef void (*CallCallbackProc)(
140 typedef void (*UpdateGCsProc)(
143 /*-------------------------------------------------------------
149 typedef struct _DtIconClassPart
151 GetSizeProc get_size;
152 GetPositionProc get_positions;
154 CallCallbackProc call_callback;
155 UpdateGCsProc update_gcs;
156 Boolean optimize_redraw;
157 XmCacheClassPartPtr cache_part;
163 typedef struct _DtIconClassRec
165 RectObjClassPart rect_class;
166 XmGadgetClassPart gadget_class;
167 DtIconClassPart icon_class;
172 externalref DtIconClassRec dtIconClassRec;
175 /*-------------------------------------------------------------
176 ** Instance Structure
181 typedef struct _DtIconPart
187 unsigned char shadow_type;
188 unsigned char border_type;
189 XtCallbackList callback;
190 XtIntervalId click_timer_id;
191 XButtonEvent * click_event;
195 Pixel pixmap_foreground;
196 Pixel pixmap_background;
197 Dimension max_pixmap_width;
198 Dimension max_pixmap_height;
199 XmFontList font_list;
201 Dimension string_width;
202 Dimension pixmap_width;
203 Dimension pixmap_height;
208 GC armed_background_gc;
209 GC parent_background_gc;
210 Pixel saved_parent_background;
211 DtIconCacheObjPart *cache;
212 unsigned char operations;
213 XtCallbackList drop_callback;
216 /* Full Instance Record
218 typedef struct _DtIconRec
221 RectObjPart rectangle;
227 /*-------------------------------------------------------------
228 ** Class and Instance Macros
231 /* DtIcon Class Macros
233 #define DtInheritGetSize ((GetSizeProc) _XtInherit)
234 #define DtInheritGetPositions ((GetPositionProc) _XtInherit)
235 #define DtInheritDraw ((DrawProc) _XtInherit)
236 #define DtInheritCallCallback ((CallCallbackProc) _XtInherit)
237 #define DtInheritUpdateGCs ((UpdateGCsProc) _XtInherit)
239 /*** WARNING: These macros are not thread-safe! ***/
240 #define C_GetSize(wc) \
241 (((DtIconGadgetClass)(wc)) -> icon_class.get_size)
242 #define C_GetPositions(wc) \
243 (((DtIconGadgetClass)(wc)) -> icon_class.get_positions)
245 (((DtIconGadgetClass)(wc)) -> icon_class.draw)
246 #define C_CallCallback(wc) \
247 (((DtIconGadgetClass)(wc)) -> icon_class.call_callback)
248 #define C_OptimizeRedraw(wc) \
249 (((DtIconGadgetClass)(wc)) -> icon_class.optimize_redraw)
250 #define C_UpdateGCs(wc) \
251 (((DtIconGadgetClass)(wc)) -> icon_class.update_gcs)
256 /*** WARNING: These macros are not thread-safe! ***/
257 #define G_GetSize(g,w,h) \
258 (((DtIconClassRec *)g -> object.widget_class) -> icon_class.get_size) \
260 #define G_GetPositions(g,w,h,h_t,s_t,p_x,p_y,s_x,s_y) \
261 (((DtIconClassRec *)g -> object.widget_class) -> icon_class.get_positions) \
262 (g,w,h,h_t,s_t,p_x,p_y,s_x,s_y)
263 #define G_Draw(g,d,x,y,w,h,h_t,s_t,s_type,fill) \
264 (((DtIconClassRec *)g -> object.widget_class) -> icon_class.draw) \
265 (g,d,x,y,w,h,h_t,s_t,s_type,fill)
266 #define G_CallCallback(g,cb,r,e) \
267 (((DtIconClassRec *)g -> object.widget_class) -> icon_class.call_callback) \
269 #define G_UpdateGCs(g) \
270 (((DtIconClassRec *)g -> object.widget_class) -> icon_class.update_gcs) \
273 /* Cached Instance Field Macros
275 #define G_CachePixmapPosition(co) (((DtIconCacheObject)(co)) -> \
276 icon_cache.pixmap_position)
277 #define G_FillOnArm(g) (((DtIconGadget)(g)) -> \
278 icon.cache -> fill_on_arm)
279 #define G_RecomputeSize(g) (((DtIconGadget)(g)) -> \
280 icon.cache -> recompute_size)
281 #define G_DrawShadow(g) (((DtIconGadget)(g)) -> \
282 icon.cache -> draw_shadow)
283 #define G_PixmapPosition(g) (((DtIconGadget)(g)) -> \
284 icon.cache -> pixmap_position)
285 #define G_StringPosition(g) (((DtIconGadget)(g)) -> \
286 icon.cache -> string_position)
287 #define G_Alignment(g) (((DtIconGadget)(g)) -> \
288 icon.cache -> alignment)
289 #define G_Behavior(g) (((DtIconGadget)(g)) -> \
290 icon.cache -> behavior)
291 #define G_FillMode(g) (((DtIconGadget)(g)) -> \
292 icon.cache -> fill_mode)
293 #define G_MarginWidth(g) (((DtIconGadget)(g)) -> \
294 icon.cache -> margin_width)
295 #define G_MarginHeight(g) (((DtIconGadget)(g)) -> \
296 icon.cache -> margin_height)
297 #define G_StringHeight(g) (((DtIconGadget)(g)) -> \
298 icon.cache -> string_height)
299 #define G_Spacing(g) (((DtIconGadget)(g)) -> \
300 icon.cache -> spacing)
301 #define G_Foreground(g) (((DtIconGadget)(g)) -> \
302 icon.cache -> foreground)
303 #define G_Background(g) (((DtIconGadget)(g)) -> \
304 icon.cache -> background)
305 #define G_ArmColor(g) (((DtIconGadget)(g)) -> \
306 icon.cache -> arm_color)
308 /* Non-Cached Instance Field Macros
310 #define G_Armed(g) (g -> icon.armed)
311 #define G_Set(g) (g -> icon.set)
312 #define G_Sync(g) (g -> icon.sync)
313 #define G_Callback(g) (g -> icon.callback)
314 #define G_ClickTimerID(g) (g -> icon.click_timer_id)
315 #define G_ClickInterval(g) (g -> icon.click_interval)
316 #define G_ClickEvent(g) (g -> icon.click_event)
317 #define G_ShadowType(g) (g -> icon.shadow_type)
318 #define G_BorderType(g) (g -> icon.border_type)
319 #define G_Pixmap(g) (g -> icon.pixmap)
320 #define G_Mask(g) (g -> icon.mask)
321 #define G_PixmapForeground(g) (g -> icon.pixmap_foreground)
322 #define G_PixmapBackground(g) (g -> icon.pixmap_background)
323 #define G_MaxPixmapWidth(g) (g -> icon.max_pixmap_width)
324 #define G_MaxPixmapHeight(g) (g -> icon.max_pixmap_height)
325 #define G_String(g) (g -> icon.string)
326 #define G_FontList(g) (g -> icon.font_list)
327 #define G_ImageName(g) (g -> icon.image_name)
328 #define G_StringWidth(g) (g -> icon.string_width)
329 #define G_PixmapWidth(g) (g -> icon.pixmap_width)
330 #define G_PixmapHeight(g) (g -> icon.pixmap_height)
331 #define G_BackgroundGC(g) (g -> icon.background_gc)
332 #define G_ArmedGC(g) (g -> icon.armed_gc)
333 #define G_ArmedBackgroundGC(g) (g -> icon.armed_background_gc)
334 #define G_NormalGC(g) (g -> icon.normal_gc)
335 #define G_ClipGC(g) (g -> icon.clip_gc)
336 #define G_Underline(g) (g -> icon.underline)
337 #define G_ParentBackgroundGC(g) (g -> icon.parent_background_gc)
338 #define G_SavedParentBG(g) (g -> icon.saved_parent_background)
339 #define G_Operations(g) (g -> icon.operations)
340 #define G_DropCallback(g) (g -> icon.drop_callback)
342 #define Icon_Cache(w) (((DtIconGadget)(w))-> \
345 #define Icon_ClassCachePart(w) \
346 (((DtIconGadgetClass)dtIconGadgetClass)->gadget_class.cache_part)
349 #endif /* _DtIconP_h */
350 /* DON'T ADD ANYTHING AFTER THIS #endif */