* class.c (create_vtable_ptr): Put the vtable at the beginning of
[official-gcc.git] / texinfo / info / window.h
blobc0f3b035520a36ba33da6cc91a7b67953d1908f1
1 /* window.h -- Structure and flags used in manipulating Info windows.
2 $Id: window.h,v 1.1.1.2 1998/03/22 20:43:04 law Exp $
4 This file is part of GNU Info, a program for reading online documentation
5 stored in Info format.
7 Copyright (C) 1993, 97 Free Software Foundation, Inc.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 Written by Brian Fox (bfox@ai.mit.edu). */
25 #ifndef INFO_WINDOW_H
26 #define INFO_WINDOW_H
28 #include "nodes.h"
29 #include "infomap.h"
31 /* Smallest number of visible lines in a window. The actual height is
32 always one more than this number because each window has a modeline. */
33 #define WINDOW_MIN_HEIGHT 2
35 /* Smallest number of screen lines that can be used to fully present a
36 window. This number includes the modeline of the window. */
37 #define WINDOW_MIN_SIZE (WINDOW_MIN_HEIGHT + 1)
39 /* The exact same elements are used within the WINDOW_STATE structure and a
40 subsection of the WINDOW structure. We could define a structure which
41 contains this elements, and include that structure in each of WINDOW_STATE
42 and WINDOW. But that would lead references in the code such as
43 window->state->node which we would like to avoid. Instead, we #define the
44 elements here, and simply include the define in both data structures. Thus,
45 if you need to change window state information, here is where you would
46 do it. NB> The last element does NOT end with a semi-colon. */
47 #define WINDOW_STATE_DECL \
48 NODE *node; /* The node displayed in this window. */ \
49 int pagetop; /* LINE_STARTS[PAGETOP] is first line in WINDOW. */ \
50 long point /* Offset within NODE of the cursor position. */
52 /* Structure which defines a window. Windows are doubly linked, next
53 and prev. The list of windows is kept on WINDOWS. The structure member
54 window->height is the total height of the window. The position location
55 (0, window->height + window->first_row) is the first character of this
56 windows modeline. The number of lines that can be displayed in a window
57 is equal to window->height - 1. */
58 typedef struct window_struct
60 struct window_struct *next; /* Next window in this chain. */
61 struct window_struct *prev; /* Previous window in this chain. */
62 int width; /* Width of this window. */
63 int height; /* Height of this window. */
64 int first_row; /* Offset of the first line in the_screen. */
65 int goal_column; /* The column we would like the cursor to appear in. */
66 Keymap keymap; /* Keymap used to read commands in this window. */
67 WINDOW_STATE_DECL; /* Node, pagetop and point. */
68 char *modeline; /* Calculated text of the modeline for this window. */
69 char **line_starts; /* Array of printed line starts for this node. */
70 int line_count; /* Number of lines appearing in LINE_STARTS. */
71 int flags; /* See below for details. */
72 } WINDOW;
74 typedef struct {
75 WINDOW_STATE_DECL; /* What gets saved. */
76 } WINDOW_STATE;
78 #define W_UpdateWindow 0x01 /* WINDOW needs updating. */
79 #define W_WindowIsPerm 0x02 /* This WINDOW is a permanent object. */
80 #define W_WindowVisible 0x04 /* This WINDOW is currently visible. */
81 #define W_InhibitMode 0x08 /* This WINDOW has no modeline. */
82 #define W_NoWrap 0x10 /* Lines do not wrap in this window. */
83 #define W_InputWindow 0x20 /* Window accepts input. */
84 #define W_TempWindow 0x40 /* Window is less important. */
86 extern WINDOW *windows; /* List of visible Info windows. */
87 extern WINDOW *active_window; /* The currently active window. */
88 extern WINDOW *the_screen; /* The Info screen is just another window. */
89 extern WINDOW *the_echo_area; /* THE_ECHO_AREA is a window in THE_SCREEN. */
91 /* Global variable control redisplay of scrolled windows. If non-zero, it
92 is the desired number of lines to scroll the window in order to make
93 point visible. A user might set this to 1 for smooth scrolling. If
94 set to zero, the line containing point is centered within the window. */
95 extern int window_scroll_step;
97 /* Make the modeline member for WINDOW. */
98 extern void window_make_modeline ();
100 /* Initalize the window system by creating THE_SCREEN and THE_ECHO_AREA.
101 Create the first window ever, and make it permanent.
102 You pass WIDTH and HEIGHT; the dimensions of the total screen size. */
103 extern void window_initialize_windows ();
105 /* Make a new window showing NODE, and return that window structure.
106 The new window is made to be the active window. If NODE is passed
107 as NULL, then show the node showing in the active window. If the
108 window could not be made return a NULL pointer. The active window
109 is not changed.*/
110 extern WINDOW *window_make_window ();
112 /* Delete WINDOW from the list of known windows. If this window was the
113 active window, make the next window in the chain be the active window,
114 or the previous window in the chain if there is no next window. */
115 extern void window_delete_window ();
117 /* A function to call when the screen changes size, and some windows have
118 to get deleted. The function is called with the window to be deleted
119 as an argument, and it can't do anything about the window getting deleted;
120 it can only clean up dangling references to that window. */
121 extern VFunction *window_deletion_notifier;
123 /* Set WINDOW to display NODE. */
124 extern void window_set_node_of_window ();
126 /* Tell the window system that the size of the screen has changed. This
127 causes lots of interesting things to happen. The permanent windows
128 are resized, as well as every visible window. You pass WIDTH and HEIGHT;
129 the dimensions of the total screen size. */
130 extern void window_new_screen_size ();
132 /* Change the height of WINDOW by AMOUNT. This also automagically adjusts
133 the previous and next windows in the chain. If there is only one user
134 window, then no change takes place. */
135 extern void window_change_window_height ();
137 /* Adjust the pagetop of WINDOW such that the cursor point will be visible. */
138 extern void window_adjust_pagetop ();
140 /* Tile all of the windows currently displayed in the global variable
141 WINDOWS. If argument DO_INTERNALS is non-zero, tile windows displaying
142 internal nodes as well. */
143 #define DONT_TILE_INTERNALS 0
144 #define TILE_INTERNALS 1
145 extern void window_tile_windows ();
147 /* Toggle the state of line wrapping in WINDOW. This can do a bit of fancy
148 redisplay. */
149 extern void window_toggle_wrap ();
151 /* For every window in CHAIN, set the flags member to have FLAG set. */
152 extern void window_mark_chain ();
154 /* For every window in CHAIN, clear the flags member of FLAG. */
155 extern void window_unmark_chain ();
157 /* Make WINDOW start displaying at PERCENT percentage of its node. */
158 extern void window_goto_percentage ();
160 /* Build a new node which has FORMAT printed with ARG1 and ARG2 as the
161 contents. */
162 extern NODE *build_message_node ();
164 /* Useful functions can be called from outside of window.c. */
165 extern void initialize_message_buffer ();
167 /* Print FORMAT with ARG1,2 to the end of the current message buffer. */
168 extern void printf_to_message_buffer ();
170 /* Convert the contents of the message buffer to a node. */
171 extern NODE *message_buffer_to_node ();
173 /* Return the length of the most recently printed line in message buffer. */
174 extern int message_buffer_length_this_line ();
176 /* Pad STRING to COUNT characters by inserting blanks. */
177 extern int pad_to ();
179 /* Make a message appear in the echo area, built from FORMAT, ARG1 and ARG2.
180 The arguments are treated similar to printf () arguments, but not all of
181 printf () hair is present. The message appears immediately. If there was
182 already a message appearing in the echo area, it is removed. */
183 extern void window_message_in_echo_area ();
185 /* Place a temporary message in the echo area built from FORMAT, ARG1
186 and ARG2. The message appears immediately, but does not destroy
187 any existing message. A future call to unmessage_in_echo_area ()
188 restores the old contents. */
189 extern void message_in_echo_area ();
190 extern void unmessage_in_echo_area ();
192 /* Clear the echo area, removing any message that is already present.
193 The echo area is cleared immediately. */
194 extern void window_clear_echo_area ();
196 /* Quickly guess the approximate number of lines to that NODE would
197 take to display. This really only counts carriage returns. */
198 extern int window_physical_lines ();
200 /* Calculate a list of line starts for the node belonging to WINDOW. The line
201 starts are pointers to the actual text within WINDOW->NODE. */
202 extern void calculate_line_starts ();
204 /* Given WINDOW, recalculate the line starts for the node it displays. */
205 extern void recalculate_line_starts ();
207 /* Return the number of characters it takes to display CHARACTER on the
208 screen at HPOS. */
209 extern int character_width ();
211 /* Return the number of characters it takes to display STRING on the
212 screen at HPOS. */
213 extern int string_width ();
215 /* Return the index of the line containing point. */
216 extern int window_line_of_point ();
218 /* Get and return the goal column for this window. */
219 extern int window_get_goal_column ();
221 /* Get and return the printed column offset of the cursor in this window. */
222 extern int window_get_cursor_column ();
224 /* Get and Set the node, pagetop, and point of WINDOW. */
225 extern void window_get_state (), window_set_state ();
227 /* Count the number of characters in LINE that precede the printed column
228 offset of GOAL. */
229 extern int window_chars_to_goal ();
231 #endif /* not INFO_WINDOW_H */