Check for ncurses.
[bpt/emacs.git] / src / dispextern.h
1 /* Interface definitions for display code.
2 Copyright (C) 1985, 1993, 1994 Free Software Foundation, Inc.
3
4 This file is part of GNU Emacs.
5
6 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 #ifndef _DISPEXTERN_H_
22 #define _DISPEXTERN_H_
23
24 /* Nonzero means last display completed and cursor is really at
25 cursX, cursY. Zero means it was preempted. */
26 extern int display_completed;
27
28 #ifdef HAVE_X_WINDOWS
29 #include <X11/Xlib.h>
30 #endif
31
32 #ifdef MSDOS
33 #include "msdos.h"
34 #endif
35
36 #ifdef HAVE_NTGUI
37 #include "win32.h"
38 #endif
39
40 #ifdef HAVE_FACES
41 struct face
42 {
43 /* If this is non-zero, it is a GC we can use without modification
44 to represent this face. */
45 GC gc;
46
47 /* Pixel value for foreground color. */
48 EMACS_UINT foreground;
49
50 /* Pixel value for background color. */
51 EMACS_UINT background;
52
53 /* Font used for this face. */
54 XFontStruct *font;
55
56 /* Background stipple or bitmap used for this face. */
57 Pixmap stipple;
58
59 /* Pixmap_depth. */
60 unsigned int pixmap_w, pixmap_h;
61
62 /* Whether or not to underline text in this face. */
63 char underline;
64 };
65
66 /* Let's stop using this and get rid of it. */
67 typedef struct face *FACE;
68
69 #define NORMAL_FACE ((struct face *) 0)
70
71 #define FACE_HAS_GC(f) ((f)->gc)
72 #define FACE_GC(f) ((f)->gc)
73 #define FACE_FOREGROUND(f) ((f)->foreground)
74 #define FACE_BACKGROUND(f) ((f)->background)
75 #define FACE_FONT(f) ((f)->font)
76 #define FACE_STIPPLE(f) ((f)->stipple)
77 #define FACE_UNDERLINE_P(f) ((f)->underline)
78
79 #else /* not HAVE_FACES */
80
81 typedef int FACE;
82
83 #define NORMAL_FACE 0x0
84 #define HIGHLIGHT_FACE 0x1
85 #define UNDERLINE_FACE 0x2
86 #define HIGHLIGHT_UNDERLINE_FACE 0x3
87
88 #define FACE_HIGHLIGHT(f) ((f) & 0x1)
89 #define FACE_UNDERLINE(f) ((f) & 0x2)
90
91 #endif /* not HAVE_FACES */
92
93
94 /* This structure is used for the actual display of text on a frame.
95
96 There are two instantiations of it: the glyphs currently displayed,
97 and the glyphs we desire to display. The latter object is generated
98 from buffers being displayed. */
99
100 struct frame_glyphs
101 {
102 #ifdef MULTI_FRAME
103 struct frame *frame; /* Frame these glyphs belong to. */
104 #endif /* MULTI_FRAME */
105 int height;
106 int width;
107
108 /* Contents of the frame.
109 glyphs[V][H] is the glyph at position V, H.
110 Note that glyphs[V][-1],
111 glyphs[V][used[V]],
112 and glyphs[V][frame_width] are always '\0'. */
113 GLYPH **glyphs;
114 /* long vector from which the strings in `glyphs' are taken. */
115 GLYPH *total_contents;
116
117 /* When representing a desired frame,
118 enable[n] == 0 means that line n is same as current frame.
119 Between updates, all lines should be disabled.
120 When representing current frame contents,
121 enable[n] == 0 means that line n is blank. */
122 char *enable;
123
124 /* Everything on line n after column used[n] is considered blank. */
125 int *used;
126
127 /* highlight[n] != 0 iff line n is highlighted. */
128 char *highlight;
129
130 /* Buffer offset of this line's first char.
131 This is not really implemented, and cannot be,
132 and should be deleted. */
133 int *bufp;
134
135 #ifdef HAVE_WINDOW_SYSTEM
136 /* Pixel position of top left corner of line. */
137 short *top_left_x;
138 short *top_left_y;
139
140 /* Pixel width of line. */
141 short *pix_width;
142
143 /* Pixel height of line. */
144 short *pix_height;
145
146 /* Largest font ascent on this line. */
147 short *max_ascent;
148 #endif /* HAVE_WINDOW_SYSTEM */
149
150 /* Mapping of coordinate pairs to buffer positions.
151 This field holds a vector indexed by row number.
152 Its elements are vectors indexed by column number.
153 Each element of these vectors is a buffer position, 0, or -1.
154
155 For a column where the image of a text character starts,
156 the element value is the buffer position of that character.
157 When a window's screen line starts in mid character,
158 the element for the line's first column (at the window's left margin)
159 is that character's position.
160 For successive columns within a multicolumn character,
161 the element is -1.
162 For the column just beyond the last glyph on a line,
163 the element is the buffer position of the end of the line.
164 For following columns within the same window, the element is 0.
165 For rows past the end of the accessible buffer text,
166 the window's first column has ZV and other columns have 0.
167
168 Mode lines and vertical separator lines have 0.
169
170 The column of a window's left margin
171 always has a positive value (a buffer position), not 0 or -1,
172 for each line in that window's interior. */
173
174 int **charstarts;
175
176 /* This holds all the space in the subvectors of the charstarts field. */
177 int *total_charstarts;
178 };
179
180 extern void get_display_line ();
181 extern Lisp_Object sit_for ();
182
183 #endif /* not _DISPEXTERN_H_ */