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