dtcalc: change from obsoleted MAXFLOAT to FLT_MAX from std C
[oweals/cde.git] / cde / lib / DtWidget / IconP.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
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)
10  * any later version.
11  *
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
16  * details.
17  *
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
22  */
23 /* $XConsortium: IconP.h /main/7 1996/03/29 11:33:23 drk $ */
24 /**---------------------------------------------------------------------
25 ***     
26 ***     file:           IconP.h
27 ***
28 ***     project:        MotifPlus Widgets
29 ***
30 ***     description:    Private include file for DtIcon gadget class.
31 ***     
32 ***     
33 ***                     (c) Copyright 1990 by Hewlett-Packard Company.
34 ***
35 ***
36 ***-------------------------------------------------------------------*/
37
38
39 #ifndef _DtIconP_h
40 #define _DtIconP_h
41
42 #include <Xm/ExtObjectP.h>
43 #include <Xm/XmP.h>
44 #include <Xm/GadgetP.h>
45 #include <Dt/Icon.h>
46
47
48 /*-------------------------------------------------------------
49 **      Cache Class Structure
50 */
51
52 /*      Cache Class Part
53 */
54 typedef struct _DtIconCacheObjClassPart
55 {
56     int foo;
57 } DtIconCacheObjClassPart;
58
59 /*      Cache Full Class Record
60 */
61 typedef struct _DtIconCacheObjClassRec     /* label cache class record */
62 {
63     ObjectClassPart                     object_class;
64     XmExtClassPart                      ext_class;
65     DtIconCacheObjClassPart            icon_class_cache;
66 } DtIconCacheObjClassRec;
67
68 /*      Cache Actual Class
69 */
70 externalref DtIconCacheObjClassRec dtIconCacheObjClassRec;
71
72 \f
73 /*-------------------------------------------------------------
74 **      Cache Instance Structure
75 */
76
77 /*      Cache Instance Part
78 */
79 typedef struct _DtIconCacheObjPart
80 {
81         Dimension       margin_width;
82         Dimension       margin_height;
83         Dimension       string_height;
84         Dimension       spacing;
85         Pixel           foreground;
86         Pixel           background;
87         Pixel           arm_color;
88         Boolean         fill_on_arm;
89         Boolean         recompute_size;
90         Boolean         draw_shadow;
91         unsigned char   pixmap_position;
92         unsigned char   string_position;
93         unsigned char   alignment;
94         unsigned char   behavior;
95         unsigned char   fill_mode;
96 } DtIconCacheObjPart;
97
98 typedef struct _DtIconCacheObjRec
99 {
100     ObjectPart               object;
101     XmExtPart                ext;
102     DtIconCacheObjPart      icon_cache;
103 } DtIconCacheObjRec;
104
105
106 typedef void (*GetPositionProc)(
107         DtIconGadget,
108         Position,
109         Position,
110         Dimension,
111         Dimension,
112         Position *,
113         Position *,
114         Position *,
115         Position *
116 );
117 typedef void (*GetSizeProc)(
118         DtIconGadget,
119         Dimension *,
120         Dimension *
121 );
122 typedef void (*DrawProc)(
123         DtIconGadget,
124         Drawable,
125         Position,
126         Position,
127         Dimension,
128         Dimension,
129         Dimension,
130         Dimension,
131         unsigned char,
132         unsigned char
133 );
134 typedef void (*CallCallbackProc)(
135         DtIconGadget,
136         XtCallbackList,
137         int,
138         XEvent *
139 );
140 typedef void (*UpdateGCsProc)(
141         DtIconGadget
142 );
143 /*-------------------------------------------------------------
144 **      Class Structure
145 */
146
147 /*      Class Part
148 */
149 typedef struct _DtIconClassPart
150 {
151         GetSizeProc             get_size;
152         GetPositionProc         get_positions;
153         DrawProc                draw;
154         CallCallbackProc        call_callback;
155         UpdateGCsProc           update_gcs;
156         Boolean                 optimize_redraw;
157         XmCacheClassPartPtr     cache_part;
158         caddr_t                 extension;
159 } DtIconClassPart;
160
161 /*      Full Class Record
162 */
163 typedef struct _DtIconClassRec
164 {
165         RectObjClassPart        rect_class;
166         XmGadgetClassPart       gadget_class;
167         DtIconClassPart icon_class;
168 } DtIconClassRec;
169
170 /*      Actual Class
171 */
172 externalref DtIconClassRec dtIconClassRec;
173
174 \f
175 /*-------------------------------------------------------------
176 **      Instance Structure
177 */
178
179 /*      Instance Part
180 */
181 typedef struct _DtIconPart
182 {
183         Boolean         set;
184         Boolean         armed;
185         Boolean         sync;
186         Boolean         underline;
187         unsigned char   shadow_type;
188         unsigned char   border_type;
189         XtCallbackList  callback;
190         XtIntervalId    click_timer_id;
191         XButtonEvent *  click_event;
192         String          image_name;
193         Pixmap          pixmap;
194         Pixmap          mask;
195         Pixel           pixmap_foreground;
196         Pixel           pixmap_background;
197         Dimension       max_pixmap_width;
198         Dimension       max_pixmap_height;
199         XmFontList      font_list;
200         XmString        string;
201         Dimension       string_width;
202         Dimension       pixmap_width;
203         Dimension       pixmap_height;
204         GC              clip_gc;
205         GC              normal_gc;
206         GC              background_gc;
207         GC              armed_gc;
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;
214 } DtIconPart;
215
216 /*      Full Instance Record
217 */
218 typedef struct _DtIconRec
219 {
220         ObjectPart      object;
221         RectObjPart     rectangle;
222         XmGadgetPart    gadget;
223         DtIconPart      icon;
224 } DtIconRec;
225
226
227 /*-------------------------------------------------------------
228 **      Class and Instance Macros
229 */
230
231 /*      DtIcon Class Macros
232 */      
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)
238
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)
244 #define C_Draw(wc)              \
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)
252
253 /*      DtIcon Macros
254 */
255
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) \
259         (g,w,h)
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) \
268         (g,cb,r,e)
269 #define G_UpdateGCs(g) \
270   (((DtIconClassRec *)g -> object.widget_class) -> icon_class.update_gcs) \
271         (g)
272
273 /*      Cached Instance Field Macros
274 */
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)
307
308 /*      Non-Cached Instance Field Macros
309 */
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)
341
342 #define Icon_Cache(w)                   (((DtIconGadget)(w))-> \
343                                            icon.cache)
344
345 #define Icon_ClassCachePart(w) \
346         (((DtIconGadgetClass)dtIconGadgetClass)->gadget_class.cache_part)
347
348
349 #endif /* _DtIconP_h */
350 /* DON'T ADD ANYTHING AFTER THIS #endif */