Merge remote-tracking branch 'origin/master' into for-steve
[sxemacs] / info / lispref / gutter.texi
1 @c -*-texinfo-*-
2 @c This is part of the SXEmacs Lisp Reference Manual.
3 @c Copyright (C) 1994, 1995 Ben Wing.
4 @c Copyright (C) 1999 Andy Piper.
5 @c Copyright (C) 1999 Stephen J. Turnbull.
6 @c Copyright (C) 2005 Sebastian Freundt <hroptatyr@sxemacs.org>
7 @c See the file lispref.texi for copying conditions.
8 @setfilename ../../info/gutter.info
9
10 @node Gutter, Scrollbars, Toolbar, top
11 @chapter Gutter
12 @cindex gutter
13
14   A gutter is a rectangle displayed along one edge of a frame.  It
15 can contain arbitrary text or graphics.
16
17 @menu
18 * Gutter Intro::                An introduction.
19 * Creating Gutter::             How to create a gutter.
20 * Gutter Descriptor Format::    Accessing and modifying a gutter's
21                                   properties.
22 * Specifying a Gutter::         Setting a gutter's contents.
23 * Other Gutter Variables::      Controlling the size of gutters.
24 * Common Gutter Widgets::       Things to put in gutters.
25 @end menu
26
27
28 @node Gutter Intro, Creating Gutter, Gutter, Gutter
29 @section Gutter Intro
30
31   A @dfn{gutter} is a rectangle displayed along one edge of a frame.  It
32 can contain arbitrary text or graphics.  It could be considered a
33 generalization of a toolbar, although toolbars are not currently
34 implemented using gutters.
35
36   In SXEmacs, a gutter can be displayed along any of the four edges
37 of the frame, and two or more different edges can be displaying
38 gutters simultaneously.  The contents, thickness, and visibility of
39 the gutters can be controlled separately, and the values can
40 be per-buffer, per-frame, etc., using specifiers (@pxref{Specifiers}).
41
42   Normally, there is one gutter displayed in a frame.  Usually, this is
43 the default gutter, containing buffer tabs, but modes cab override this
44 and substitute their own gutter.  This default gutter is usually
45 positioned along the top of the frame, but this can be changed using
46 @code{set-default-gutter-position}.
47
48   Note that, for each of the gutter properties (contents, thickness,
49 and visibility), there is a separate specifier for each of the four
50 gutter positions (top, bottom, left, and right), and an additional
51 specifier for the ``default'' gutter, i.e. the gutter whose
52 position is controlled by @code{set-default-gutter-position}.  The
53 way this works is that @code{set-default-gutter-position} arranges
54 things so that the appropriate position-specific specifiers for the
55 default position inherit from the corresponding default specifiers.
56 That way, if the position-specific specifier does not give a value
57 (which it usually doesn't), then the value from the default
58 specifier applies.  If you want to control the default gutter, you
59 just change the default specifiers, and everything works.  A package
60 such as VM that wants to put its own gutter in a different location
61 from the default just sets the position-specific specifiers, and if
62 the user sets the default gutter to the same position, it will just
63 not be visible.
64
65
66 @node Creating Gutter, Gutter Descriptor Format, Gutter Intro, Gutter
67 @section Creating Gutter
68
69 @defun make-gutter-specifier spec-list
70
71 Return a new @code{gutter} specifier object with the given specification
72 list.  @var{spec-list} can be a list of specifications (each of which is
73 a cons of a locale and a list of instantiators), a single instantiator,
74 or a list of instantiators.  @xref{Specifiers}, for more information
75 about specifiers.
76
77 Gutter specifiers are used to specify the format of a gutter.  The
78 values of the variables @code{default-gutter}, @code{top-gutter},
79 @code{left-gutter}, @code{right-gutter}, and @code{bottom-gutter} are
80 always gutter specifiers.
81
82 Valid gutter instantiators are called "gutter descriptors" and are
83 either strings or property-lists of strings.  See @code{default-gutter}
84 for a description of the exact format.
85 @end defun
86
87 @defun make-gutter-size-specifier spec-list
88
89 Return a new @code{gutter-size} specifier object with the given spec
90 list.  @var{spec-list} can be a list of specifications (each of which is
91 a cons of a locale and a list of instantiators), a single instantiator,
92 or a list of instantiators.  @xref{Specifiers}, for more information
93 about specifiers.
94
95 Gutter-size specifiers are used to specify the size of a gutter.  The
96 values of the variables @code{default-gutter-size},
97 @code{top-gutter-size}, @code{left-gutter-size},
98 @code{right-gutter-size}, and @code{bottom-gutter-size} are always
99 gutter-size specifiers.
100
101 Valid gutter-size instantiators are either integers or the special
102 symbol @code{autodetect}. If a gutter-size is set to @code{autodetect}
103 them the size of the gutter will be adjusted to just accommodate the
104 gutters contents. @code{autodetect} only works for top and bottom
105 gutters.
106 @end defun
107
108 @defun make-gutter-visible-specifier spec-list
109
110 Return a new @code{gutter-visible} specifier object with the given spec
111 list.  @var{spec-list} can be a list of specifications (each of which is
112 a cons of a locale and a list of instantiators), a single instantiator,
113 or a list of instantiators.  @xref{Specifiers}, for more information
114 about specifiers.
115
116 Gutter-visible specifiers are used to specify the visibility of a
117 gutter.  The values of the variables @code{default-gutter-visible-p},
118 @code{top-gutter-visible-p}, @code{left-gutter-visible-p},
119 @code{right-gutter-visible-p}, and @code{bottom-gutter-visible-p} are
120 always gutter-visible specifiers.
121
122 Valid gutter-visible instantiators are @code{t}, @code{nil} or a list of
123 symbols.  If a gutter-visible instantiator is set to a list of symbols,
124 and the corresponding gutter specification is a property-list strings,
125 then elements of the gutter specification will only be visible if the
126 corresponding symbol occurs in the gutter-visible instantiator.
127 @end defun
128
129
130 @node Gutter Descriptor Format, Specifying a Gutter, Creating Gutter, Gutter
131 @section Gutter Descriptor Format
132
133   The contents of a gutter are specified using a @dfn{gutter descriptor}.
134 The format of a gutter descriptor is a list of @dfn{gutter button
135 descriptors}.  Each gutter button descriptor is a vector in one of the
136 following formats:
137
138 @itemize @bullet
139 @item
140 @code{[@var{glyph-list} @var{function} @var{enabled-p} @var{help}]}
141 @item
142 @code{[:style @var{2d-or-3d}]}
143 @item
144 @code{[:style @var{2d-or-3d} :size @var{width-or-height}]}
145 @item
146 @code{[:size @var{width-or-height} :style @var{2d-or-3d}]}
147 @end itemize
148
149   Optionally, one of the gutter button descriptors may be @code{nil}
150 instead of a vector; this signifies the division between the gutter
151 buttons that are to be displayed flush-left, and the buttons to be
152 displayed flush-right.
153
154   The first vector format above specifies a normal gutter button;
155 the others specify blank areas in the gutter.
156
157   For the first vector format:
158
159 @itemize @bullet
160 @item
161 @var{glyph-list} should be a list of one to six glyphs (as created by
162 @code{make-glyph}) or a symbol whose value is such a list.  The first
163 glyph, which must be provided, is the glyph used to display the gutter
164 button when it is in the ``up'' (not pressed) state.  The optional
165 second glyph is for displaying the button when it is in the ``down''
166 (pressed) state.  The optional third glyph is for when the button is
167 disabled.  The last three glyphs are for displaying the button in the
168 ``up'', ``down'', and ``disabled'' states, respectively, but are used
169 when the user has called for captioned gutter buttons (using
170 @code{gutter-buttons-captioned-p}).  The function
171 @code{gutter-make-button-list} is useful in creating these glyph lists.
172
173 @item
174 Even if you do not provide separate down-state and disabled-state
175 glyphs, the user will still get visual feedback to indicate which
176 state the button is in.  Buttons in the up-state are displayed
177 with a shadowed border that gives a raised appearance to the
178 button.  Buttons in the down-state are displayed with shadows that
179 give a recessed appearance.  Buttons in the disabled state are
180 displayed with no shadows, giving a 2-d effect.
181
182 @item
183 If some of the gutter glyphs are not provided, they inherit as follows:
184
185 @example
186      UP:                up
187      DOWN:              down -> up
188      DISABLED:          disabled -> up
189      CAP-UP:            cap-up -> up
190      CAP-DOWN:          cap-down -> cap-up -> down -> up
191      CAP-DISABLED:      cap-disabled -> cap-up -> disabled -> up
192 @end example
193
194 @item
195 The second element @var{function} is a function to be called when the
196 gutter button is activated (i.e. when the mouse is released over the
197 gutter button, if the press occurred in the gutter).  It can be any
198 form accepted by @code{call-interactively}, since this is how it is
199 invoked.
200
201 @item
202 The third element @var{enabled-p} specifies whether the gutter button
203 is enabled (disabled buttons do nothing when they are activated, and are
204 displayed differently; see above).  It should be either a boolean or a
205 form that evaluates to a boolean.
206
207 @item
208 The fourth element @var{help}, if non-@code{nil}, should be a string.
209 This string is displayed in the echo area when the mouse passes over the
210 gutter button.
211 @end itemize
212
213   For the other vector formats (specifying blank areas of the gutter):
214
215 @itemize @bullet
216 @item
217 @var{2d-or-3d} should be one of the symbols @code{2d} or @code{3d},
218 indicating whether the area is displayed with shadows (giving it a
219 raised, 3-d appearance) or without shadows (giving it a flat
220 appearance).
221
222 @item
223 @var{width-or-height} specifies the length, in pixels, of the blank
224 area.  If omitted, it defaults to a device-specific value (8 pixels for
225 X devices).
226 @end itemize
227
228 @defun gutter-make-button-list up &optional down disabled cap-up cap-down cap-disabled
229 This function calls @code{make-glyph} on each arg and returns a list of
230 the results.  This is useful for setting the first argument of a gutter
231 button descriptor (typically, the result of this function is assigned
232 to a symbol, which is specified as the first argument of the gutter
233 button descriptor).
234 @end defun
235
236 @defun check-gutter-button-syntax button &optional noerror
237 Verify the syntax of entry @var{button} in a gutter description list.
238 If you want to verify the syntax of a gutter description list as a
239 whole, use @code{check-valid-instantiator} with a specifier type of
240 @code{gutter}.
241 @end defun
242
243
244 @node Specifying a Gutter, Other Gutter Variables, Gutter Descriptor Format, Gutter
245 @section Specifying a Gutter
246
247   In order to specify the contents of a gutter, set one of the specifier
248 variables @code{default-gutter}, @code{top-gutter},
249 @code{bottom-gutter}, @code{left-gutter}, or @code{right-gutter}.
250 These are specifiers, which means you set them with @code{set-specifier}
251 and query them with @code{specifier-specs} or @code{specifier-instance}.
252 You will get an error if you try to set them using @code{setq}.  The
253 valid instantiators for these specifiers are gutter descriptors, as
254 described above.  @xref{Specifiers}, for more information.
255
256   Most of the time, you will set @code{default-gutter}, which allows
257 the user to choose where the gutter should go.
258
259 @defvr Specifier default-gutter
260 The position of this gutter is specified in the function
261 @code{default-gutter-position}.  If the corresponding
262 position-specific gutter (e.g. @code{top-gutter} if
263 @code{default-gutter-position} is @code{top}) does not specify a
264 gutter in a particular domain, then the value of @code{default-gutter}
265 in that domain, of any, will be used instead.
266 @end defvr
267
268   Note that the gutter at any particular position will not be displayed
269 unless its thickness (width or height, depending on orientation) is
270 non-zero and its visibility status is true.  The thickness is controlled
271 by the specifiers @code{top-gutter-height},
272 @code{bottom-gutter-height}, @code{left-gutter-width}, and
273 @code{right-gutter-width}, and the visibility status is controlled by
274 the specifiers @code{top-gutter-visible-p},
275 @code{bottom-gutter-visible-p}, @code{left-gutter-visible-p}, and
276 @code{right-gutter-visible-p} (@pxref{Other Gutter Variables}).
277
278 @defun set-default-gutter-position position
279 This function sets the position that the @code{default-gutter} will be
280 displayed at.  Valid positions are the symbols @code{top},
281 @code{bottom}, @code{left} and @code{right}.  What this actually does is
282 set the fallback specifier for the position-specific specifier
283 corresponding to the given position to @code{default-gutter}, and set
284 the fallbacks for the other position-specific specifiers to @code{nil}.
285 It also does the same thing for the position-specific thickness and
286 visibility specifiers, which inherit from one of
287 @code{default-gutter-height} or @code{default-gutter-width}, and from
288 @code{default-gutter-visible-p}, respectively (@pxref{Other Gutter
289 Variables}).
290 @end defun
291
292 @defun default-gutter-position
293 This function returns the position that the @code{default-gutter} will
294 be displayed at.
295 @end defun
296
297   You can also explicitly set a gutter at a particular position.  When
298 redisplay determines what to display at a particular position in a
299 particular domain (i.e. window), it first consults the position-specific
300 gutter.  If that does not yield a gutter descriptor, the
301 @code{default-gutter} is consulted if @code{default-gutter-position}
302 indicates this position.
303
304 @defvr Specifier top-gutter
305 Specifier for the gutter at the top of the frame.
306 @end defvr
307
308 @defvr Specifier bottom-gutter
309 Specifier for the gutter at the bottom of the frame.
310 @end defvr
311
312 @defvr Specifier left-gutter
313 Specifier for the gutter at the left edge of the frame.
314 @end defvr
315
316 @defvr Specifier right-gutter
317 Specifier for the gutter at the right edge of the frame.
318 @end defvr
319
320 @defun gutter-specifier-p object
321 This function returns non-@code{nil} if @var{object} is a gutter specifier.
322 Gutter specifiers are the actual objects contained in the gutter
323 variables described above, and their valid instantiators are
324 gutter descriptors (@pxref{Gutter Descriptor Format}).
325 @end defun
326
327
328 @node Other Gutter Variables, Common Gutter Widgets, Specifying a Gutter, Gutter
329 @section Other Gutter Variables
330
331   The variables to control the gutter thickness, visibility status, and
332 captioned status are all specifiers.  @xref{Specifiers}.
333
334 @defvr Specifier default-gutter-height
335 This specifies the height of the default gutter, if it's oriented
336 horizontally.  The position of the default gutter is specified by the
337 function @code{set-default-gutter-position}.  If the corresponding
338 position-specific gutter thickness specifier
339 (e.g. @code{top-gutter-height} if @code{default-gutter-position} is
340 @code{top}) does not specify a thickness in a particular domain (a
341 window or a frame), then the value of @code{default-gutter-height} or
342 @code{default-gutter-width} (depending on the gutter orientation) in
343 that domain, if any, will be used instead.
344 @end defvr
345
346 @defvr Specifier default-gutter-width
347 This specifies the width of the default gutter, if it's oriented
348 vertically.  This behaves like @code{default-gutter-height}.
349 @end defvr
350
351   Note that @code{default-gutter-height} is only used when
352 @code{default-gutter-position} is @code{top} or @code{bottom}, and
353 @code{default-gutter-width} is only used when
354 @code{default-gutter-position} is @code{left} or @code{right}.
355
356 @defvr Specifier top-gutter-height
357 This specifies the height of the top gutter.
358 @end defvr
359
360 @defvr Specifier bottom-gutter-height
361 This specifies the height of the bottom gutter.
362 @end defvr
363
364 @defvr Specifier left-gutter-width
365 This specifies the width of the left gutter.
366 @end defvr
367
368 @defvr Specifier right-gutter-width
369 This specifies the width of the right gutter.
370 @end defvr
371
372   Note that all of the position-specific gutter thickness specifiers
373 have a fallback value of zero when they do not correspond to the
374 default gutter.  Therefore, you will have to set a non-zero thickness
375 value if you want a position-specific gutter to be displayed.
376
377 @defvr Specifier default-gutter-visible-p
378 This specifies whether the default gutter is visible.  The position of
379 the default gutter is specified by the function
380 @code{set-default-gutter-position}.  If the corresponding position-specific
381 gutter visibility specifier (e.g. @code{top-gutter-visible-p} if
382 @code{default-gutter-position} is @code{top}) does not specify a
383 visible-p value in a particular domain (a window or a frame), then the
384 value of @code{default-gutter-visible-p} in that domain, if any, will
385 be used instead.
386 @end defvr
387
388 @defvr Specifier top-gutter-visible-p
389 This specifies whether the top gutter is visible.
390 @end defvr
391
392 @defvr Specifier bottom-gutter-visible-p
393 This specifies whether the bottom gutter is visible.
394 @end defvr
395
396 @defvr Specifier left-gutter-visible-p
397 This specifies whether the left gutter is visible.
398 @end defvr
399
400 @defvr Specifier right-gutter-visible-p
401 This specifies whether the right gutter is visible.
402 @end defvr
403
404 @code{default-gutter-visible-p} and all of the position-specific
405 gutter visibility specifiers have a fallback value of true.
406
407   Internally, gutter thickness and visibility specifiers are instantiated
408 in both window and frame domains, for different purposes.  The value in
409 the domain of a frame's selected window specifies the actual gutter
410 thickness or visibility that you will see in that frame.  The value in
411 the domain of a frame itself specifies the gutter thickness or
412 visibility that is used in frame geometry calculations.
413
414   Thus, for example, if you set the frame width to 80 characters and the
415 left gutter width for that frame to 68 pixels, then the frame will be
416 sized to fit 80 characters plus a 68-pixel left gutter.  If you then
417 set the left gutter width to 0 for a particular buffer (or if that
418 buffer does not specify a left gutter or has a @code{nil} value specified for
419 @code{left-gutter-visible-p}), you will find that, when that buffer is
420 displayed in the selected window, the window will have a width of 86 or
421 87 characters -- the frame is sized for a 68-pixel left gutter but the
422 selected window specifies that the left gutter is not visible, so it is
423 expanded to take up the slack.
424
425 @defvr Specifier gutter-buttons-captioned-p
426 Whether gutter buttons are captioned.  This affects which glyphs from a
427 gutter button descriptor are chosen.  @xref{Gutter Descriptor Format}.
428 @end defvr
429
430   You can also reset the gutter to what it was when SXEmacs started up.
431
432 @defvr Constant initial-gutter-spec
433 The gutter descriptor used to initialize @code{default-gutter} at
434 startup.
435 @end defvr
436
437
438 @node Common Gutter Widgets, , Other Gutter Variables, Gutter
439 @section Common Gutter Widgets
440
441   A gutter can contain arbitrary text.  So, for example, in an Info
442 buffer you could put the title of the current node in the top gutter,
443 and it would not scroll out of view in a long node.  (This is an
444 artificial example, since usually the node name is sufficiently
445 descriptive, and Info puts that in the mode line.)
446
447   A more common use for the gutter is to hold some kind of active
448 widget.  The buffer-tab facility, available in all SXEmacs frames,
449 creates an array of file-folder-like tabs, which the user can click with
450 the mouse to switch buffers.  W3 uses a progress-bar widget in the
451 bottom gutter to give a visual indication of the progress of
452 time-consuming operations like downloading.
453
454 @menu
455 * Buffer Tabs::         Tabbed divider index metaphor for switching buffers.
456 * Progress Bars::       Visual indication of operation progress.
457 @end menu
458
459
460 @node Buffer Tabs, Progress Bars, ,Common Gutter Widgets
461 @subsection Buffer Tabs
462
463   Not documented yet.
464
465
466 @node Progress Bars,  , Buffer Tabs, Common Gutter Widgets
467 @subsection Progress Bars
468
469   Not documented yet.