dtcalc: change from obsoleted MAXFLOAT to FLT_MAX from std C
[oweals/cde.git] / cde / lib / DtHelp / DisplayAreaP.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: DisplayAreaP.h /main/18 1996/08/13 11:35:51 cde-hp $ */
24 /************************************<+>*************************************
25  ****************************************************************************
26  **
27  **   File:        DisplayAreaP.h
28  **
29  **   Project:     Cde Help System
30  **
31  **   Description: Defines the Display Area structures and defines.
32  **
33  ****************************************************************************
34  ************************************<+>*************************************/
35 /*
36  * (c) Copyright 1996 Digital Equipment Corporation.
37  * (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992,
38                  1993, 1994, 1996 Hewlett-Packard Company.
39  * (c) Copyright 1993, 1994, 1996 International Business Machines Corp.
40  * (c) Copyright 1993, 1994, 1996 Sun Microsystems, Inc.
41  * (c) Copyright 1993, 1994, 1996 Novell, Inc. 
42  * (c) Copyright 1996 FUJITSU LIMITED.
43  * (c) Copyright 1996 Hitachi.
44  */
45
46 #ifndef _DtHelpDisplayAreaP_h
47 #define _DtHelpDisplayAreaP_h
48
49 #include <X11/X.h>
50 #include <Xm/XmP.h>
51 #include <Dt/CanvasP.h>
52 #include <DtI/GraphicsP.h>
53
54 /*
55  * Traversal flags
56  */
57 #define _DT_HELP_SHADOW_TRAVERSAL       (1 << 0)
58 #define _DT_HELP_NOT_INITIALIZED        (1 << 1)
59 #define _DT_HELP_TRAVERSAL_DRAWN        (1 << 2)
60 #define _DT_HELP_DRAW_TOC_IND           (1 << 3)
61 #define _DT_HELP_CLEAR_TOC_IND          (1 << 4)
62 #define _DT_HELP_TOC_ON                 (1 << 5)
63
64 /*
65  * enum states for selection
66  */
67 enum    _DtHelpSelectState
68     {
69         _DtHelpNothingDoing,
70         _DtHelpCopyOrLink,
71         _DtHelpSelectingText
72     };
73
74 /*
75  * Whether the display area has the focus or not
76  */
77 #define _DT_HELP_FOCUS_FLAG           0x04
78
79 typedef struct {
80         int              used;
81         int              num_pixels;
82         Pixmap           pix;
83         Pixmap           mask;
84         Dimension        width;
85         Dimension        height;
86         Pixel           *pixels;
87 } DtHelpGraphicStruct;
88
89 typedef struct {
90         _DtCvPointer     font_ptr;
91         int      spc_idx;
92 } DtHelpSpecialChars;
93
94 typedef struct  _dtHelpDAFontMetrics {
95         _DtCvUnit  ascent;         /* Maximum ascent               */
96         _DtCvUnit  descent;        /* Maximum descent              */
97         _DtCvUnit  average_width;  /* Average width of a character */
98         _DtCvUnit  super;          /* Offset from baseline for super scripts */
99         _DtCvUnit  sub;            /* Offset from baseline for sub scripts   */
100 } _DtHelpDAFontMetrics;
101
102 typedef struct {
103         short   inited;
104         _DtHelpDAFontMetrics fm;
105 } DtHelpDAFSMetrics;
106
107 typedef struct  _DtHelpDAfontInfo {
108         char            **exact_fonts;  /* the list of fonts specified by the
109                                            toss element rather than hints.   */
110         XrmDatabase     def_font_db;    /* The default font resource db      */
111         XrmDatabase     font_idx_db;    /* Which font index goes with which
112                                            set of font resources             */
113         XFontStruct     **font_structs; /* The font structures opened        */
114         XFontSet        *font_sets;     /* The font sets opened              */
115         DtHelpDAFSMetrics *fs_metrics;
116
117         XrmQuark        lang_charset;   /* the char set for current lang     */
118         int             *exact_idx;     /* The indexes for the exact fonts   */
119         int             max_structs;    /* the max number of font_structs    */
120         int             max_sets;       /* The max number of font_sets       */
121         int             struct_cnt;     /* the cur number of font_structs    */
122         int             set_cnt;        /* The cur number of font_sets       */
123         long            def_idx;        /* The default index                 */
124 } DtHelpDAFontInfo;
125
126 /* 
127  * SelectionScroll structure 
128  */
129 typedef struct {
130         int     horizontal_reason;
131         int     vertical_reason;
132 } SelectionScrollStruct;
133
134 /*
135  * DisplayArea structure
136  */
137 typedef struct _dtHelpDispAreaStruct {
138         Widget  dispWid;                /* The text and graphic area. */
139         Widget  vertScrollWid;          /* The vertical scroll bar    */
140         Widget  horzScrollWid;          /* The horizontal scroll bar  */
141         Boolean vertIsMapped;
142         Boolean horzIsMapped;
143         short   neededFlags;            /* _DtHelpAS_NEEDED flags        */
144         short   nl_to_space;            /* are newlines in multibyte     */
145                                         /* strings turned into spaces?   */
146
147         Dimension       formWidth;      /* Pixel width of the parent  area  */
148         Dimension       formHeight;     /* Pixel height of the parent area  */
149         Dimension       dispWidth;      /* Pixel width of the display area  */
150         Dimension       dispHeight;     /* Pixel height of the display area */
151         Dimension       dispUseHeight;  /* Pixel height of the display area
152                                            minus the decor margin.          */
153         Dimension       dispUseWidth;   /* Pixel width of the display area
154                                            minus the decor margin.          */
155         Dimension       marginWidth;    /* Pixel padding at the left and
156                                            right of the display area.       */
157         Dimension       marginHeight;   /* Pixel padding at the top and
158                                            bottom of the display area.      */
159
160         short   decorThickness;         /* the shadow thickness plus highlight
161                                            thickness of the display area    */
162
163         void    (*hyperCall)();         /* The hypertext callback */
164         void    (*resizeCall)();        /* The resize callback    */
165         int     (*exec_filter)();       /* The execution filter callback    */
166         XtPointer       clientData;     /* The client's data for the callback */
167
168         Pixel   traversalColor;         /* The client's traversal color */
169         Pixel   foregroundColor;        /* The client's foreground color     */
170         Pixel   backgroundColor;        /* The client's foreground color     */
171         Pixel   searchColor;            /* The client's search hilite color  */
172         GC      pixmapGC;
173         GC      normalGC;
174         GC      invertGC;
175         Pixmap  def_pix;                /* the default 'missing pixmap'      */
176         Dimension def_pix_width;        /* the width of the default pixmap   */
177         Dimension def_pix_height;       /* the height of the default pixmap  */
178         _DtGrContext *context;          /* image converter context */
179
180         Colormap  colormap;             /* The colormap to use          */
181         Visual   *visual;               /* The visual to use            */
182
183         DtHelpDAFontInfo font_info;     /* The font information         */
184
185         int     depth;                  /* The depth of the window      */
186
187         int     fontAscent;
188         int     lineHeight;
189         int     leading;
190         long    charWidth;              /* The average size of a character   */
191         int     moveThreshold;          /* The number of pixels that must
192                                            be moved before a copy-paste
193                                            action occurs.                    */
194         int     underLine;
195         int     lineThickness;          /* For traversal box and underline   */
196         int     firstVisible;           /* The absolute number of the first
197                                            line visible in the window.      */
198         int     nextNonVisible;         /* The absolute number of the first
199                                            line non visible, next to the last
200                                            visible window.  */
201         int     visibleCount;           /* The number of lines viewable     */
202         int     maxYpos;                /* Maximum Y positioning            */
203
204         int     virtualX;               /* The virtual x of the window      */
205         int     maxX;                   /* The max virtual x of a line      */
206
207         int     max_spc;                /* The maximum special characters   */
208         int     cur_spc;                /* The current unused structure     */
209         int     timerX;                 /* Used for button clicks/selections */
210         int     timerY;                 /* Used for button clicks/selections */
211         int     scr_timer_x;            /* Used for button clicks/selections */
212         int     scr_timer_y;            /* Used for button clicks/selections */
213         int     vert_init_scr;          /* The initial vert scrolling timeout*/
214         int     vert_rep_scr;           /* The repeat vert scrolling timeout */
215         int     horz_init_scr;          /* The initial horz scrolling timeout*/
216         int     horz_rep_scr;           /* The repeat horz scrolling timeout */
217         _DtCvUnit       toc_width;      /* The width  of the toc indicator   */
218         _DtCvUnit       toc_height;     /* The height of the toc indicator   */
219         _DtCvUnit       toc_y;          /* The y coordinate of the toc       */
220         _DtCvUnit       toc_base;       /* The baseline coordinate of the toc*/
221
222         Time     anchor_time;           /* Indicates the primary selection
223                                            time.                              */
224         Boolean  primary;               /* Indicates if this widget has the
225                                            primary selection                  */
226         Boolean  text_selected;         /* Indicates if the selection has
227                                            occurred                           */
228         enum _DtHelpSelectState select_state;
229                                         /* Indicates the state of the current
230                                            selection.                         */
231         short    toc_flag;              /* Indicates if the traversal indicator
232                                            is always on.                      */
233         _DtCvPointer toc_indicator;     /* The indicator used in the toc */
234
235         XtIntervalId scr_timer_id;
236         SelectionScrollStruct scr_timer_data;
237         DtHelpSpecialChars *spc_chars;  /* Structure containing the spc chars */
238         _DtCvHandle       canvas;
239         _DtCvTopicPtr     lst_topic;
240         wchar_t          *cant_begin_chars;     /* characters that cannot    */
241                                                 /* begin a line of text      */
242         wchar_t          *cant_end_chars;       /* characters that cannot    */
243                                                 /* end a line of text        */
244
245         short   dtinfo;                 /* Indicates if being used by dtinfo */
246         Pixmap  stipple;                /* stippled pixmap */
247
248         /* callback to be called whenever you manipulate the display */
249         /* area's vertical scrollbar directly using XtSetValues, */
250         /* because the application (dtinfo) has callbacks on the */
251         /* scrollbar, these do not get called when we adjust it with */
252         /* XtSetValues() */ 
253         void    (*vScrollNotify)(void *,unsigned int); 
254
255         /* dtinfo requires this for doing link previews */
256         void    (*armCallback)(void*); 
257
258         _DtCvValue honor_size;          /* Layout parameter for _DtCvSetTopic */
259         _DtCvRenderType render_type;    /* Render type performed on expose */
260         unsigned short media_resolution;        /* used for scaling images */
261
262 } DtHelpDispAreaStruct;
263
264 #endif /* _DtHelpDisplayAreaP_h */