import xemacs-21.2.37
[chise/xemacs-chise.git.1] / man / widget.texi
1 \input texinfo.tex
2
3 @c %**start of header
4 @setfilename ../info/widget.info
5 @settitle The Emacs Widget Library
6 @iftex
7 @afourpaper
8 @headings double
9 @end iftex
10 @c %**end of header
11
12 @ifinfo
13 @dircategory XEmacs Editor
14 @direntry
15 * Widgets: (widget).            The Emacs Widget Library.
16 @end direntry
17 @end ifinfo
18
19 @node Top, Introduction, (dir), (dir)
20 @comment  node-name,  next,  previous,  up
21 @top The Emacs Widget Library
22
23 @menu
24 * Introduction::                
25 * User Interface::              
26 * Programming Example::         
27 * Setting Up the Buffer::       
28 * Basic Types::                 
29 * Sexp Types::                  
30 * Widget Properties::           
31 * Defining New Widgets::        
32 * Widget Browser::              
33 * Widget Minor Mode::           
34 * Utilities::                   
35 * Widget Wishlist::             
36 @end menu
37
38 @node  Introduction, User Interface, Top, Top
39 @comment  node-name,  next,  previous,  up
40 @section Introduction
41
42 Most graphical user interface toolkits, such as Motif and XView, provide
43 a number of standard user interface controls (sometimes known as
44 `widgets' or `gadgets').  Emacs doesn't really support anything like
45 this, except for an incredible powerful text ``widget''.  On the other
46 hand, Emacs does provide the necessary primitives to implement many
47 other widgets within a text buffer.  The @code{widget} package
48 simplifies this task.
49
50 The basic widgets are:
51
52 @table @code
53 @item link
54 Areas of text with an associated action.  Intended for hypertext links
55 embedded in text.
56 @item push-button 
57 Like link, but intended for stand-alone buttons.
58 @item editable-field
59 An editable text field.  It can be either variable or fixed length.
60 @item menu-choice
61 Allows the user to choose one of multiple options from a menu, each
62 option is itself a widget.  Only the selected option will be visible in
63 the buffer.
64 @item radio-button-choice
65 Allows the user to choose one of multiple options by activating radio
66 buttons.  The options are implemented as widgets.  All options will be
67 visible in the buffer.
68 @item item
69 A simple constant widget intended to be used in the @code{menu-choice} and
70 @code{radio-button-choice} widgets. 
71 @item choice-item
72 An button item only intended for use in choices.  When invoked, the user
73 will be asked to select another option from the choice widget.
74 @item toggle
75 A simple @samp{on}/@samp{off} switch.
76 @item checkbox
77 A checkbox (@samp{[ ]}/@samp{[X]}). 
78 @item editable-list
79 Create an editable list.  The user can insert or delete items in the
80 list.  Each list item is itself a widget.
81 @end table
82
83 Now of what possible use can support for widgets be in a text editor?
84 I'm glad you asked.  The answer is that widgets are useful for
85 implementing forms.  A @dfn{form} in emacs is a buffer where the user is
86 supposed to fill out a number of fields, each of which has a specific
87 meaning.  The user is not supposed to change or delete any of the text
88 between the fields.  Examples of forms in Emacs are the @file{forms}
89 package (of course), the customize buffers, the mail and news compose
90 modes, and the @sc{html} form support in the @file{w3} browser.  
91
92 The advantages for a programmer of using the @code{widget} package to
93 implement forms are:
94
95 @enumerate
96 @item
97 More complex fields than just editable text are supported. 
98 @item
99 You can give the user immediate feedback if he enters invalid data in a
100 text field, and sometimes prevent entering invalid data.
101 @item 
102 You can have fixed sized fields, thus allowing multiple field to be
103 lined up in columns.
104 @item
105 It is simple to query or set the value of a field. 
106 @item 
107 Editing happens in buffer, not in the mini-buffer.
108 @item 
109 Packages using the library get a uniform look, making them easier for
110 the user to learn.
111 @item 
112 As support for embedded graphics improve, the widget library will
113 extended to support it.  This means that your code using the widget
114 library will also use the new graphic features by automatic.
115 @end enumerate
116
117 In order to minimize the code that is loaded by users who does not
118 create any widgets, the code has been split in two files:
119
120 @table @file
121 @item widget.el
122 This will declare the user variables, define the function
123 @code{widget-define}, and autoload the function @code{widget-create}. 
124 @item wid-edit.el
125 Everything else is here, there is no reason to load it explicitly, as
126 it will be autoloaded when needed.
127 @end table
128
129 @node User Interface, Programming Example, Introduction, Top
130 @comment  node-name,  next,  previous,  up
131 @section User Interface
132
133 A form consist of read only text for documentation and some fields,
134 where each the fields contain two parts, as tag and a value.  The tags
135 are used to identify the fields, so the documentation can refer to the
136 foo field, meaning the field tagged with @samp{Foo}. Here is an example
137 form:
138
139 @example
140 Here is some documentation.
141
142 Name: @i{My Name}     @strong{Choose}: This option
143 Address:  @i{Some Place
144 In some City
145 Some country.}
146
147 See also @b{_other work_} for more information.
148
149 Numbers: count to three below
150 @b{[INS]} @b{[DEL]} @i{One}
151 @b{[INS]} @b{[DEL]} @i{Eh, two?}
152 @b{[INS]} @b{[DEL]} @i{Five!}
153 @b{[INS]} 
154
155 Select multiple:
156
157 @b{[X]} This
158 @b{[ ]} That
159 @b{[X]} Thus
160
161 Select one:
162
163 @b{(*)} One
164 @b{( )} Another One.
165 @b{( )} A Final One.
166
167 @b{[Apply Form]} @b{[Reset Form]}
168 @end example
169
170 The top level widgets in is example are tagged @samp{Name},
171 @samp{Choose}, @samp{Address}, @samp{_other work_}, @samp{Numbers},
172 @samp{Select multiple}, @samp{Select one}, @samp{[Apply Form]}, and
173 @samp{[Reset Form]}.  There are basically two thing the user can do within
174 a form, namely editing the editable text fields and activating the
175 buttons.
176
177 @subsection Editable Text Fields
178
179 In the example, the value for the @samp{Name} is most likely displayed
180 in an editable text field, and so are values for each of the members of
181 the @samp{Numbers} list.  All the normal Emacs editing operations are
182 available for editing these fields.  The only restriction is that each
183 change you make must be contained within a single editable text field.
184 For example, capitalizing all text from the middle of one field to the
185 middle of another field is prohibited.
186
187 Editing text fields are created by the @code{editable-field} widget.
188
189 The editing text fields are highlighted with the
190 @code{widget-field-face} face, making them easy to find.
191
192 @deffn Face widget-field-face
193 Face used for other editing fields.
194 @end deffn
195
196 @subsection Buttons
197
198 Some portions of the buffer have an associated @dfn{action}, which can
199 be @dfn{invoked} by a standard key or mouse command.  These portions
200 are called @dfn{buttons}.  The default commands for activating a button
201 are:
202
203 @table @kbd
204 @item @key{RET}
205 @deffn Command widget-button-press @var{pos} &optional @var{event}
206 Invoke the button at @var{pos}, defaulting to point.
207 If point is not located on a button, invoke the binding in
208 @code{widget-global-map} (by default the global map).
209 @end deffn
210
211 @item mouse-2
212 @deffn Command widget-button-click @var{event}
213 Invoke the button at the location of the mouse pointer.  If the mouse
214 pointer is located in an editable text field, invoke the binding in
215 @code{widget-global-map} (by default the global map).
216 @end deffn
217 @end table
218
219 There are several different kind of buttons, all of which are present in
220 the example:
221
222 @table @emph
223 @item The Option Field Tags.
224 When you invoke one of these buttons, you will be asked to choose
225 between a number of different options.  This is how you edit an option
226 field.  Option fields are created by the @code{menu-choice} widget.  In
227 the example, @samp{@b{Choose}} is an option field tag.
228 @item The @samp{@b{[INS]}} and @samp{@b{[DEL]}} buttons.
229 Activating these will insert or delete elements from a editable list.
230 The list is created by the @code{editable-list} widget. 
231 @item Embedded Buttons.
232 The @samp{@b{_other work_}} is an example of an embedded
233 button. Embedded buttons are not associated with a fields, but can serve
234 any purpose, such as implementing hypertext references.  They are
235 usually created by the @code{link} widget.
236 @item The @samp{@b{[ ]}} and @samp{@b{[X]}} buttons.
237 Activating one of these will convert it to the other.  This is useful
238 for implementing multiple-choice fields.  You can create it wit
239 @item The @samp{@b{( )}} and @samp{@b{(*)}} buttons.
240 Only one radio button in a @code{radio-button-choice} widget can be
241 selected at any time.  When you invoke one of the unselected radio
242 buttons, it will be selected and the previous selected radio button will
243 become unselected.
244 @item The @samp{@b{[Apply Form]}} @samp{@b{[Reset Form]}} buttons.
245 These are explicit buttons made with the @code{push-button} widget.  The main
246 difference from the @code{link} widget is that the buttons are will be
247 displayed as GUI buttons when possible.
248 enough. 
249 @end table
250
251 To make them easier to locate, buttons are emphasized in the buffer.  
252
253 @deffn Face widget-button-face
254 Face used for buttons.
255 @end deffn
256
257 @defopt widget-mouse-face
258 Face used for buttons when the mouse pointer is above it.
259 @end defopt
260
261 @subsection Navigation
262
263 You can use all the normal Emacs commands to move around in a form
264 buffer, plus you will have these additional commands:
265
266 @table @kbd
267 @item @key{TAB}
268 @deffn Command widget-forward &optional count
269 Move point @var{count} buttons or editing fields forward.
270 @end deffn
271 @item @key{M-TAB}
272 @deffn Command widget-backward &optional count
273 Move point @var{count} buttons or editing fields backward.
274 @end deffn
275 @end table
276
277 @node Programming Example, Setting Up the Buffer, User Interface, Top
278 @comment  node-name,  next,  previous,  up
279 @section Programming Example
280
281 Here is the code to implement the user interface example (see @ref{User
282 Interface}).
283
284 @lisp
285 (require 'widget)
286
287 (eval-when-compile
288   (require 'wid-edit))
289
290 (defvar widget-example-repeat)
291
292 (defun widget-example ()
293   "Create the widgets from the Widget manual."
294   (interactive)
295   (kill-buffer (get-buffer-create "*Widget Example*"))
296   (switch-to-buffer (get-buffer-create "*Widget Example*"))
297   (kill-all-local-variables)
298   (make-local-variable 'widget-example-repeat)
299   (widget-insert "Here is some documentation.\n\nName: ")
300   (widget-create 'editable-field
301                  :size 13
302                  "My Name")
303   (widget-create 'menu-choice
304                  :tag "Choose"
305                  :value "This"
306                  :help-echo "Choose me, please!"
307                  :notify (lambda (widget &rest ignore)
308                            (message "%s is a good choice!"
309                                     (widget-value widget)))
310                  '(item :tag "This option" :value "This")
311                  '(choice-item "That option")
312                  '(editable-field :menu-tag "No option" "Thus option"))
313   (widget-insert "Address: ")
314   (widget-create 'editable-field
315                  "Some Place\nIn some City\nSome country.")
316   (widget-insert "\nSee also ")
317   (widget-create 'link
318                  :notify (lambda (&rest ignore)
319                            (widget-value-set widget-example-repeat 
320                                              '("En" "To" "Tre"))
321                            (widget-setup))
322                  "other work")
323   (widget-insert " for more information.\n\nNumbers: count to three below\n")
324   (setq widget-example-repeat
325         (widget-create 'editable-list
326                        :entry-format "%i %d %v"
327                        :notify (lambda (widget &rest ignore)
328                                  (let ((old (widget-get widget
329                                                         ':example-length))
330                                        (new (length (widget-value widget))))
331                                    (unless (eq old new)
332                                      (widget-put widget ':example-length new)
333                                      (message "You can count to %d." new))))
334                        :value '("One" "Eh, two?" "Five!")
335                        '(editable-field :value "three")))
336   (widget-insert "\n\nSelect multiple:\n\n")
337   (widget-create 'checkbox t)
338   (widget-insert " This\n")
339   (widget-create 'checkbox nil)
340   (widget-insert " That\n")
341   (widget-create 'checkbox
342                  :notify (lambda (&rest ignore) (message "Tickle"))
343                  t)
344   (widget-insert " Thus\n\nSelect one:\n\n")
345   (widget-create 'radio-button-choice
346                  :value "One"
347                  :notify (lambda (widget &rest ignore)
348                            (message "You selected %s"
349                                     (widget-value widget)))
350                  '(item "One") '(item "Another One.") '(item "A Final One."))
351   (widget-insert "\n")
352   (widget-create 'push-button
353                  :notify (lambda (&rest ignore) 
354                            (if (= (length (widget-value widget-example-repeat))
355                                   3)
356                                (message "Congratulation!")
357                              (error "Three was the count!")))
358                  "Apply Form")
359   (widget-insert " ")
360   (widget-create 'push-button
361                  :notify (lambda (&rest ignore)
362                            (widget-example))
363                  "Reset Form")
364   (widget-insert "\n")
365   (use-local-map widget-keymap)
366   (widget-setup))
367 @end lisp
368
369 @node Setting Up the Buffer, Basic Types, Programming Example, Top
370 @comment  node-name,  next,  previous,  up
371 @section Setting Up the Buffer
372
373 Widgets are created with @code{widget-create}, which returns a
374 @dfn{widget} object.  This object can be queried and manipulated by
375 other widget functions, until it is deleted with @code{widget-delete}.
376 After the widgets have been created, @code{widget-setup} must be called
377 to enable them.
378
379 @defun widget-create type [ keyword argument ]@dots{}
380 Create and return a widget of type @var{type}.
381 The syntax for the @var{type} argument is described in @ref{Basic Types}.
382
383 The keyword arguments can be used to overwrite the keyword arguments
384 that are part of @var{type}.
385 @end defun
386
387 @defun widget-delete widget
388 Delete @var{widget} and remove it from the buffer.
389 @end defun
390
391 @defun widget-setup 
392 Setup a buffer to support widgets. 
393
394 This should be called after creating all the widgets and before allowing
395 the user to edit them.
396 @refill
397 @end defun
398
399 If you want to insert text outside the widgets in the form, the
400 recommended way to do that is with @code{widget-insert}.
401
402 @defun widget-insert 
403 Insert the arguments, either strings or characters, at point.
404 The inserted text will be read only.
405 @end defun
406
407 There is a standard widget keymap which you might find useful.
408
409 @defvr Const widget-keymap
410 A keymap with the global keymap as its parent.@*
411 @key{TAB} and @kbd{C-@key{TAB}} are bound to @code{widget-forward} and
412 @code{widget-backward}, respectively.  @kbd{@key{RET}} and @kbd{mouse-2}
413 are bound to @code{widget-button-press} and
414 @code{widget-button-}.@refill
415 @end defvr
416
417 @defvar widget-global-map
418 Keymap used by @code{widget-button-press} and @code{widget-button-click}
419 when not on a button.  By default this is @code{global-map}.
420 @end defvar
421
422 @node Basic Types, Sexp Types, Setting Up the Buffer, Top
423 @comment  node-name,  next,  previous,  up
424 @section Basic Types
425
426 The syntax of a type specification is given below:
427
428 @example
429 NAME ::= (NAME [KEYWORD ARGUMENT]... ARGS)
430      |   NAME
431 @end example
432
433 where @var{name} is a widget name, @var{keyword} is the name of a
434 property, @var{argument} is the value of the property, and @var{args}
435 are interpreted in a widget specific way.
436
437 There following keyword arguments that apply to all widgets:
438
439 @table @code
440 @item :value
441 The initial value for widgets of this type.
442
443 @item :format
444 This string will be inserted in the buffer when you create a widget.
445 The following @samp{%} escapes are available:
446
447 @table @samp
448 @item %[
449 @itemx %]
450 The text inside will be marked as a button.
451
452 By default, the text will be shown in @code{widget-button-face}, and
453 surrounded by brackets. 
454
455 @defopt widget-button-prefix
456 String to prefix buttons.
457 @end defopt
458
459 @defopt widget-button-suffix
460 String to suffix buttons.
461 @end defopt
462
463 @item %@{
464 @itemx %@}
465 The text inside will be displayed in the face specified by
466 @code{:sample-face}.
467
468 @item %v
469 This will be replaced with the buffer representation of the widget's
470 value.  What this is depends on the widget type.
471
472 @item %d
473 Insert the string specified by @code{:doc} here.
474
475 @item %h
476 Like @samp{%d}, with the following modifications: If the documentation
477 string is more than one line, it will add a button which will toggle
478 between showing only the first line, and showing the full text.
479 Furthermore, if there is no @code{:doc} property in the widget, it will
480 instead examine the @code{:documentation-property} property.  If it is a
481 lambda expression, it will be called with the widget's value as an
482 argument, and the result will be used as the documentation text.
483
484 @item %t
485 Insert the string specified by @code{:tag} here, or the @code{princ}
486 representation of the value if there is no tag.
487
488 @item %%
489 Insert a literal @samp{%}. 
490 @end table
491
492 @item :button-face
493 Face used to highlight text inside %[ %] in the format.
494
495 @item :button-prefix
496 @itemx :button-suffix
497
498 Text around %[ %] in the format.
499
500 These can be
501 @table @emph
502 @item nil
503 No text is inserted.
504
505 @item a string
506 The string is inserted literally.
507
508 @item a symbol
509 The value of the symbol is expanded according to this table.
510 @end table
511
512 @item :doc
513 The string inserted by the @samp{%d} or @samp{%h} escape in the format
514 string.  
515
516 @item :tag
517 The string inserted by the @samp{%t} escape in the format
518 string.  
519
520 @item :tag-glyph
521 Name of image to use instead of the string specified by `:tag' on
522 Emacsen that supports it.
523
524 @item :help-echo
525 Message displayed whenever you move to the widget with either
526 @code{widget-forward} or @code{widget-backward}.
527
528 @item :indent
529 An integer indicating the absolute number of spaces to indent children
530 of this widget.
531
532 @item :offset
533 An integer indicating how many extra spaces to add to the widget's
534 grandchildren compared to this widget.
535
536 @item :extra-offset
537 An integer indicating how many extra spaces to add to the widget's
538 children compared to this widget.
539
540 @item :notify
541 A function called each time the widget or a nested widget is changed.
542 The function is called with two or three arguments.  The first argument
543 is the widget itself, the second argument is the widget that was
544 changed, and the third argument is the event leading to the change, if
545 any. 
546
547 @item :menu-tag
548 Tag used in the menu when the widget is used as an option in a
549 @code{menu-choice} widget.
550
551 @item :menu-tag-get
552 Function used for finding the tag when the widget is used as an option
553 in a @code{menu-choice} widget.  By default, the tag used will be either the
554 @code{:menu-tag} or @code{:tag} property if present, or the @code{princ}
555 representation of the @code{:value} property if not.
556
557 @item :match
558 Should be a function called with two arguments, the widget and a value,
559 and returning non-nil if the widget can represent the specified value.
560
561 @item :validate
562 A function which takes a widget as an argument, and returns nil if the
563 widget's current value is valid for the widget.  Otherwise it should
564 return the widget containing the invalid data, and set that widget's
565 @code{:error} property to a string explaining the error.
566
567 The following predefined function can be used:
568
569 @defun widget-children-validate widget
570 All the @code{:children} of @var{widget} must be valid.
571 @end defun
572
573 @item :tab-order
574 Specify the order in which widgets are traversed with
575 @code{widget-forward} or @code{widget-backward}.  This is only partially
576 implemented.
577
578 @enumerate a
579 @item
580 Widgets with tabbing order @code{-1} are ignored.
581
582 @item 
583 (Unimplemented) When on a widget with tabbing order @var{n}, go to the
584 next widget in the buffer with tabbing order @var{n+1} or @code{nil},
585 whichever comes first.
586
587 @item
588 When on a widget with no tabbing order specified, go to the next widget
589 in the buffer with a positive tabbing order, or @code{nil}
590 @end enumerate
591
592 @item :parent
593 The parent of a nested widget (e.g. a @code{menu-choice} item or an
594 element of a @code{editable-list} widget).
595
596 @item :sibling-args
597 This keyword is only used for members of a @code{radio-button-choice} or
598 @code{checklist}.  The value should be a list of extra keyword
599 arguments, which will be used when creating the @code{radio-button} or
600 @code{checkbox} associated with this item.
601
602 @end table
603
604 @deffn {User Option} widget-glyph-directory
605 Directory where glyphs are found.  
606 Widget will look here for a file with the same name as specified for the
607 image, with either a @samp{.xpm} (if supported) or @samp{.xbm} extension.
608 @end deffn
609
610 @deffn{User Option} widget-glyph-enable
611 If non-nil, allow glyphs to appear on displays where they are supported.
612 @end deffn
613
614
615 @menu
616 * link::                        
617 * url-link::                    
618 * info-link::                   
619 * push-button::                 
620 * editable-field::              
621 * text::                        
622 * menu-choice::                 
623 * radio-button-choice::         
624 * item::                        
625 * choice-item::                 
626 * toggle::                      
627 * checkbox::                    
628 * checklist::                   
629 * editable-list::               
630 * group::                       
631 @end menu
632
633 @node link, url-link, Basic Types, Basic Types
634 @comment  node-name,  next,  previous,  up
635 @subsection The @code{link} Widget
636
637 Syntax:
638
639 @example
640 TYPE ::= (link [KEYWORD ARGUMENT]...  [ VALUE ])
641 @end example
642
643 The @var{value}, if present, is used to initialize the @code{:value}
644 property.  The value should be a string, which will be inserted in the
645 buffer. 
646
647 By default the link will be shown in brackets.
648
649 @defopt widget-link-prefix
650 String to prefix links.
651 @end defopt
652
653 @defopt widget-link-suffix
654 String to suffix links.
655 @end defopt
656
657 @node url-link, info-link, link, Basic Types
658 @comment  node-name,  next,  previous,  up
659 @subsection The @code{url-link} Widget
660
661 Syntax:
662
663 @example
664 TYPE ::= (url-link [KEYWORD ARGUMENT]...  URL)
665 @end example
666
667 When this link is invoked, the @sc{www} browser specified by
668 @code{browse-url-browser-function} will be called with @var{url}. 
669
670 @node info-link, push-button, url-link, Basic Types
671 @comment  node-name,  next,  previous,  up
672 @subsection The @code{info-link} Widget
673
674 Syntax:
675
676 @example
677 TYPE ::= (info-link [KEYWORD ARGUMENT]...  ADDRESS)
678 @end example
679
680 When this link is invoked, the built-in info browser is started on
681 @var{address}. 
682
683 @node  push-button, editable-field, info-link, Basic Types
684 @comment  node-name,  next,  previous,  up
685 @subsection The @code{push-button} Widget
686
687 Syntax:
688
689 @example
690 TYPE ::= (push-button [KEYWORD ARGUMENT]...  [ VALUE ])
691 @end example
692
693 The @var{value}, if present, is used to initialize the @code{:value}
694 property. The value should be a string, which will be inserted in the
695 buffer. 
696
697 By default the tag will be shown in brackets.
698
699 @defopt widget-push-button-prefix
700 String to prefix push buttons.
701 @end defopt
702
703 @defopt widget-push-button-suffix
704 String to suffix push buttons.
705 @end defopt
706
707 @node editable-field, text, push-button, Basic Types
708 @comment  node-name,  next,  previous,  up
709 @subsection The @code{editable-field} Widget
710
711 Syntax:
712
713 @example
714 TYPE ::= (editable-field [KEYWORD ARGUMENT]... [ VALUE ])
715 @end example
716
717 The @var{value}, if present, is used to initialize the @code{:value}
718 property.  The value should be a string, which will be inserted in
719 field.  This widget will match all string values.
720
721 The following extra properties are recognized.
722
723 @table @code
724 @item :size
725 The minimum width of the editable field.@*
726 By default the field will reach to the end of the line.  If the
727 content is too large, the displayed representation will expand to
728 contain it.  The content is not truncated to size.
729
730 @item :value-face
731 Face used for highlighting the editable field.  Default is
732 @code{widget-field-face}. 
733
734 @item :secret
735 Character used to display the value.  You can set this to e.g. @code{?*}
736 if the field contains a password or other secret information.  By
737 default, the value is not secret.
738
739 @item :valid-regexp
740 By default the @code{:validate} function will match the content of the
741 field with the value of this attribute.  The default value is @code{""}
742 which matches everything.
743
744 @item :keymap
745 Keymap used in the editable field.  The default value is
746 @code{widget-field-keymap}, which allows you to use all the normal
747 editing commands, even if the buffer's major mode suppress some of them.
748 Pressing return invokes the function specified by @code{:action}. 
749 @end table
750
751 @node text, menu-choice, editable-field, Basic Types
752 @comment  node-name,  next,  previous,  up
753 @subsection The @code{text} Widget
754
755 This is just like @code{editable-field}, but intended for multiline text
756 fields.  The default @code{:keymap} is @code{widget-text-keymap}, which
757 does not rebind the return key.
758
759 @node menu-choice, radio-button-choice, text, Basic Types
760 @comment  node-name,  next,  previous,  up
761 @subsection The @code{menu-choice} Widget
762
763 Syntax:
764
765 @example
766 TYPE ::= (menu-choice [KEYWORD ARGUMENT]... TYPE ... )
767 @end example
768
769 The @var{type} argument represents each possible choice.  The widget's
770 value will be that of the chosen @var{type} argument.  This widget will
771 match any value matching at least one of the specified @var{type}
772 arguments.
773
774 @table @code
775 @item :void 
776 Widget type used as a fallback when the value does not match any of the
777 specified @var{type} arguments.
778
779 @item :case-fold
780 Set this to nil if you don't want to ignore case when prompting for a
781 choice through the minibuffer.
782
783 @item :children
784 A list whose car is the widget representing the currently chosen type in
785 the buffer. 
786
787 @item :choice
788 The current chosen type
789
790 @item :args 
791 The list of types. 
792 @end table
793
794 @node radio-button-choice, item, menu-choice, Basic Types
795 @comment  node-name,  next,  previous,  up
796 @subsection The @code{radio-button-choice} Widget
797
798 Syntax:
799
800 @example
801 TYPE ::= (radio-button-choice [KEYWORD ARGUMENT]...  TYPE ... )
802 @end example
803
804 The @var{type} argument represents each possible choice.  The widget's
805 value will be that of the chosen @var{type} argument.  This widget will
806 match any value matching at least one of the specified @var{type}
807 arguments.
808
809 The following extra properties are recognized.
810
811 @table @code
812 @item :entry-format
813 This string will be inserted for each entry in the list.
814 The following @samp{%} escapes are available:
815 @table @samp
816 @item %v
817 Replaced with the buffer representation of the @var{type} widget.
818 @item %b
819 Replace with the radio button.
820 @item %%
821 Insert a literal @samp{%}. 
822 @end table
823
824 @item button-args
825 A list of keywords to pass to the radio buttons.  Useful for setting
826 e.g. the @samp{:help-echo} for each button.
827
828 @item :buttons
829 The widgets representing the radio buttons.
830
831 @item :children
832 The widgets representing each type.
833
834 @item :choice
835 The current chosen type
836
837 @item :args 
838 The list of types. 
839 @end table
840
841 You can add extra radio button items to a @code{radio-button-choice}
842 widget after it has been created with the function
843 @code{widget-radio-add-item}. 
844
845 @defun widget-radio-add-item widget type
846 Add to @code{radio-button-choice} widget @var{widget} a new radio button item of type
847 @var{type}. 
848 @end defun
849
850 Please note that such items added after the @code{radio-button-choice}
851 widget has been created will @strong{not} be properly destructed when
852 you call @code{widget-delete}.
853
854 @node item, choice-item, radio-button-choice, Basic Types
855 @comment  node-name,  next,  previous,  up
856 @subsection The @code{item} Widget
857
858 Syntax:
859
860 @example
861 ITEM ::= (item [KEYWORD ARGUMENT]... VALUE)
862 @end example
863
864 The @var{value}, if present, is used to initialize the @code{:value}
865 property.  The value should be a string, which will be inserted in the
866 buffer.  This widget will only match the specified value.
867
868 @node choice-item, toggle, item, Basic Types
869 @comment  node-name,  next,  previous,  up
870 @subsection The @code{choice-item} Widget
871
872 Syntax:
873
874 @example
875 ITEM ::= (choice-item [KEYWORD ARGUMENT]... VALUE)
876 @end example
877
878 The @var{value}, if present, is used to initialize the @code{:value}
879 property.  The value should be a string, which will be inserted in the
880 buffer as a button.  Activating the button of a @code{choice-item} is
881 equivalent to activating the parent widget.  This widget will only match
882 the specified value. 
883
884 @node toggle, checkbox, choice-item, Basic Types
885 @comment  node-name,  next,  previous,  up
886 @subsection The @code{toggle} Widget
887
888 Syntax:
889
890 @example
891 TYPE ::= (toggle [KEYWORD ARGUMENT]...)
892 @end example
893
894 The widget has two possible states, `on' and `off', which correspond to
895 a @code{t} or @code{nil} value respectively.
896
897 The following extra properties are recognized.
898
899 @table @code
900 @item :on
901 String representing the `on' state.  By default the string @samp{on}.
902 @item :off 
903 String representing the `off' state.  By default the string @samp{off}.
904 @item :on-glyph
905 Name of a glyph to be used instead of the `:on' text string, on emacsen
906 that supports it.
907 @item :off-glyph
908 Name of a glyph to be used instead of the `:off' text string, on emacsen
909 that supports it.
910 @end table
911
912 @node checkbox, checklist, toggle, Basic Types
913 @comment  node-name,  next,  previous,  up
914 @subsection The @code{checkbox} Widget
915
916 The widget has two possible states, `selected' and `unselected', which
917 corresponds to a @code{t} or @code{nil} value.
918
919 Syntax:
920
921 @example
922 TYPE ::= (checkbox [KEYWORD ARGUMENT]...)
923 @end example
924
925 @node checklist, editable-list, checkbox, Basic Types
926 @comment  node-name,  next,  previous,  up
927 @subsection The @code{checklist} Widget
928
929 Syntax:
930
931 @example
932 TYPE ::= (checklist [KEYWORD ARGUMENT]...  TYPE ... )
933 @end example
934
935 The @var{type} arguments represents each checklist item.  The widget's
936 value will be a list containing the values of all ticked @var{type}
937 arguments.  The checklist widget will match a list whose elements all
938 match at least one of the specified @var{type} arguments.
939
940 The following extra properties are recognized.
941
942 @table @code
943 @item :entry-format
944 This string will be inserted for each entry in the list.
945 The following @samp{%} escapes are available:
946 @table @samp
947 @item %v
948 Replaced with the buffer representation of the @var{type} widget.
949 @item %b
950 Replace with the checkbox.
951 @item %%
952 Insert a literal @samp{%}. 
953 @end table
954
955 @item :greedy
956 Usually a checklist will only match if the items are in the exact
957 sequence given in the specification.  By setting @code{:greedy} to
958 non-nil, it will allow the items to appear in any sequence.  However, if
959 you extract the values they will be in the sequence given in the
960 checklist.  I.e. the original sequence is forgotten.
961
962 @item button-args
963 A list of keywords to pass to the checkboxes.  Useful for setting
964 e.g. the @samp{:help-echo} for each checkbox.
965
966 @item :buttons
967 The widgets representing the checkboxes.
968
969 @item :children
970 The widgets representing each type.
971
972 @item :args 
973 The list of types. 
974 @end table
975
976 @node editable-list, group, checklist, Basic Types
977 @comment  node-name,  next,  previous,  up
978 @subsection The @code{editable-list} Widget
979
980 Syntax:
981
982 @example
983 TYPE ::= (editable-list [KEYWORD ARGUMENT]... TYPE)
984 @end example
985
986 The value is a list, where each member represents one widget of type
987 @var{type}. 
988
989 The following extra properties are recognized.
990
991 @table @code
992 @item :entry-format
993 This string will be inserted for each entry in the list.
994 The following @samp{%} escapes are available:
995 @table @samp
996 @item %v
997 This will be replaced with the buffer representation of the @var{type}
998 widget.
999 @item %i
1000 Insert the @b{[INS]} button.
1001 @item %d
1002 Insert the @b{[DEL]} button.
1003 @item %%
1004 Insert a literal @samp{%}. 
1005 @end table
1006
1007 @item :insert-button-args
1008 A list of keyword arguments to pass to the insert buttons.
1009
1010 @item :delete-button-args
1011 A list of keyword arguments to pass to the delete buttons.
1012
1013 @item :append-button-args
1014 A list of keyword arguments to pass to the trailing insert button.
1015
1016
1017 @item :buttons
1018 The widgets representing the insert and delete buttons.
1019
1020 @item :children
1021 The widgets representing the elements of the list.
1022
1023 @item :args
1024 List whose car is the type of the list elements.
1025
1026 @end table
1027
1028 @node group,  , editable-list, Basic Types
1029 @comment  node-name,  next,  previous,  up
1030 @subsection The @code{group} Widget
1031
1032 This widget simply group other widget together.
1033
1034 Syntax:
1035
1036 @example
1037 TYPE ::= (group [KEYWORD ARGUMENT]... TYPE...)
1038 @end example
1039
1040 The value is a list, with one member for each @var{type}.  
1041
1042 @node Sexp Types, Widget Properties, Basic Types, Top
1043 @comment
1044 @section Sexp Types
1045
1046 A number of widgets for editing s-expressions (lisp types) are also
1047 available.  These basically fall in the following categories.
1048
1049 @menu
1050 * constants::                   
1051 * generic::                     
1052 * atoms::                       
1053 * composite::                   
1054 @end menu
1055
1056 @node constants, generic, Sexp Types, Sexp Types
1057 @comment  node-name,  next,  previous,  up
1058 @subsection The Constant Widgets.
1059
1060 The @code{const} widget can contain any lisp expression, but the user is
1061 prohibited from editing edit it, which is mainly useful as a component
1062 of one of the composite widgets.
1063
1064 The syntax for the @code{const} widget is
1065
1066 @example
1067 TYPE ::= (const [KEYWORD ARGUMENT]...  [ VALUE ])
1068 @end example
1069
1070 The @var{value}, if present, is used to initialize the @code{:value}
1071 property and can be any s-expression.
1072
1073 @deffn Widget const
1074 This will display any valid s-expression in an immutable part of the
1075 buffer. 
1076 @end deffn
1077
1078 There are two variations of the @code{const} widget, namely
1079 @code{variable-item} and @code{function-item}.  These should contain a
1080 symbol with a variable or function binding.  The major difference from
1081 the @code{const} widget is that they will allow the user to see the
1082 variable or function documentation for the symbol.
1083
1084 @deffn Widget variable-item
1085 An immutable symbol that is bound as a variable.
1086 @end deffn
1087
1088 @deffn Widget function-item
1089 An immutable symbol that is bound as a function.
1090 @end deffn
1091
1092 @node generic, atoms, constants, Sexp Types
1093 @comment  node-name,  next,  previous,  up
1094 @subsection Generic Sexp Widget.
1095
1096 The @code{sexp} widget can contain any lisp expression, and allows the
1097 user to edit it inline in the buffer.
1098
1099 The syntax for the @code{sexp} widget is
1100
1101 @example
1102 TYPE ::= (sexp [KEYWORD ARGUMENT]...  [ VALUE ])
1103 @end example
1104
1105 @deffn Widget sexp
1106 This will allow you to edit any valid s-expression in an editable buffer
1107 field. 
1108
1109 The @code{sexp} widget takes the same keyword arguments as the
1110 @code{editable-field} widget.
1111 @end deffn
1112
1113 @node atoms, composite, generic, Sexp Types
1114 @comment  node-name,  next,  previous,  up
1115 @subsection Atomic Sexp Widgets.
1116
1117 The atoms are s-expressions that does not consist of other
1118 s-expressions.  A string is an atom, while a list is a composite type.
1119 You can edit the value of an atom with the following widgets.  
1120
1121 The syntax for all the atoms are
1122
1123 @example
1124 TYPE ::= (NAME [KEYWORD ARGUMENT]...  [ VALUE ])
1125 @end example
1126
1127 The @var{value}, if present, is used to initialize the @code{:value}
1128 property and must be an expression of the same type as the widget.
1129 I.e. the string widget can only be initialized with a string.
1130
1131 All the atom widgets take the same keyword arguments as the
1132 @code{editable-field} widget.
1133
1134 @deffn Widget string
1135 Allows you to edit a string in an editable field.
1136 @end deffn
1137
1138 @deffn Widget regexp
1139 Allows you to edit a regular expression in an editable field.
1140 @end deffn
1141
1142 @deffn Widget character
1143 Allows you to enter a character in an editable field.
1144 @end deffn
1145
1146 @deffn Widget file
1147 Allows you to edit a file name in an editable field.  If you invoke
1148 the tag button, you can edit the file name in the mini-buffer with
1149 completion. 
1150
1151 Keywords:
1152 @table @code
1153 @item :must-match
1154 If this is set to non-nil, only existing file names will be allowed in
1155 the minibuffer.
1156 @end table
1157 @end deffn
1158
1159 @deffn Widget directory
1160 Allows you to edit a directory name in an editable field.
1161 Similar to the @code{file} widget.
1162 @end deffn
1163
1164 @deffn Widget symbol
1165 Allows you to edit a lisp symbol in an editable field.
1166 @end deffn
1167
1168 @deffn Widget function
1169 Allows you to edit a lambda expression, or a function name with completion.
1170 @end deffn
1171
1172 @deffn Widget variable
1173 Allows you to edit a variable name, with completion.
1174 @end deffn
1175
1176 @deffn Widget integer
1177 Allows you to edit an integer in an editable field.
1178 @end deffn
1179
1180 @deffn Widget number
1181 Allows you to edit a number in an editable field.
1182 @end deffn
1183
1184 @deffn Widget boolean
1185 Allows you to edit a boolean.  In lisp this means a variable which is
1186 either nil meaning false, or non-nil meaning true.
1187 @end deffn
1188
1189
1190 @node composite,  , atoms, Sexp Types
1191 @comment  node-name,  next,  previous,  up
1192 @subsection Composite Sexp Widgets.
1193
1194 The syntax for the composite are
1195
1196 @example
1197 TYPE ::= (NAME [KEYWORD ARGUMENT]...  COMPONENT...)
1198 @end example
1199
1200 Where each @var{component} must be a widget type.  Each component widget
1201 will be displayed in the buffer, and be editable to the user.
1202
1203 @deffn Widget cons
1204 The value of a @code{cons} widget is a cons-cell where the car is the
1205 value of the first component and the cdr is the value of the second
1206 component.  There must be exactly two components. 
1207 @end deffn
1208
1209 @deffn Widget list
1210 The value of a @code{list} widget is a list containing the value of
1211 each of its component.
1212 @end deffn
1213
1214 @deffn Widget vector
1215 The value of a @code{vector} widget is a vector containing the value of
1216 each of its component.
1217 @end deffn
1218
1219 The above suffice for specifying fixed size lists and vectors.  To get
1220 variable length lists and vectors, you can use a @code{choice},
1221 @code{set} or @code{repeat} widgets together with the @code{:inline}
1222 keywords.  If any component of a composite widget has the @code{:inline}
1223 keyword set, its value must be a list which will then be spliced into
1224 the composite.  For example, to specify a list whose first element must
1225 be a file name, and whose remaining arguments should either by the
1226 symbol @code{t} or two files, you can use the following widget
1227 specification:
1228
1229 @example
1230 (list file
1231       (choice (const t)
1232               (list :inline t
1233                     :value ("foo" "bar")
1234                     string string)))
1235 @end example
1236
1237 The value of a widget of this type will either have the form 
1238 @samp{(file t)} or @code{(file string string)}.
1239
1240 This concept of inline is probably hard to understand.  It was certainly
1241 hard to implement so instead of confusing you more by trying to explain
1242 it here, I'll just suggest you meditate over it for a while.
1243
1244 @deffn Widget choice
1245 Allows you to edit a sexp which may have one of a fixed set of types.
1246 It is currently implemented with the @code{choice-menu} basic widget,
1247 and has a similar syntax.
1248 @end deffn
1249
1250 @deffn Widget set
1251 Allows you to specify a type which must be a list whose elements all
1252 belong to given set.  The elements of the list is not significant.  This
1253 is implemented on top of the @code{checklist} basic widget, and has a
1254 similar syntax. 
1255 @end deffn
1256
1257 @deffn Widget repeat
1258 Allows you to specify a variable length list whose members are all of
1259 the same type.  Implemented on top of the `editable-list' basic widget,
1260 and has a similar syntax.
1261 @end deffn
1262
1263 @node Widget Properties, Defining New Widgets, Sexp Types, Top
1264 @comment  node-name,  next,  previous,  up
1265 @section Properties
1266
1267 You can examine or set the value of a widget by using the widget object
1268 that was returned by @code{widget-create}.
1269
1270 @defun widget-value widget
1271 Return the current value contained in @var{widget}.
1272 It is an error to call this function on an uninitialized widget.
1273 @end defun
1274
1275 @defun widget-value-set widget value
1276 Set the value contained in @var{widget} to @var{value}.
1277 It is an error to call this function with an invalid @var{value}.
1278 @end defun
1279
1280 @strong{Important:} You @emph{must} call @code{widget-setup} after
1281 modifying the value of a widget before the user is allowed to edit the
1282 widget again.  It is enough to call @code{widget-setup} once if you
1283 modify multiple widgets.  This is currently only necessary if the widget
1284 contains an editing field, but may be necessary for other widgets in the
1285 future. 
1286
1287 If your application needs to associate some information with the widget
1288 objects, for example a reference to the item being edited, it can be
1289 done with @code{widget-put} and @code{widget-get}.  The property names
1290 must begin with a @samp{:}.
1291
1292 @defun widget-put widget property value
1293 In @var{widget} set @var{property} to @var{value}.
1294 @var{property} should be a symbol, while @var{value} can be anything.
1295 @end defun
1296
1297 @defun widget-get widget property
1298 In @var{widget} return the value for @var{property}.
1299 @var{property} should be a symbol, the value is what was last set by
1300 @code{widget-put} for @var{property}.
1301 @end defun
1302
1303 @defun widget-member widget property
1304 Non-nil if @var{widget} has a value (even nil) for property @var{property}.
1305 @end defun
1306
1307 Occasionally it can be useful to know which kind of widget you have,
1308 i.e. the name of the widget type you gave when the widget was created. 
1309
1310 @defun widget-type widget
1311 Return the name of @var{widget}, a symbol.
1312 @end defun
1313
1314 Widgets can be in two states: active, which means they are modifiable by
1315 the user, or inactive, which means they cannot be modified by the user.
1316 You can query or set the state with the following code:
1317
1318 @lisp
1319 ;; Examine if @var{widget} is active or not.
1320 (if (widget-apply @var{widget} :active)
1321     (message "Widget is active.")
1322   (message "Widget is inactive.")
1323
1324 ;; Make @var{widget} inactive.
1325 (widget-apply @var{widget} :deactivate)
1326
1327 ;; Make @var{widget} active.
1328 (widget-apply @var{widget} :activate)
1329 @end lisp
1330
1331 A widget is inactive if itself or any of its ancestors (found by
1332 following the @code{:parent} link) have been deactivated.  To make sure
1333 a widget is really active, you must therefore activate both itself and
1334 all its ancestors.
1335
1336 @lisp
1337 (while widget 
1338   (widget-apply widget :activate)
1339   (setq widget (widget-get widget :parent)))
1340 @end lisp
1341
1342 You can check if a widget has been made inactive by examining the value
1343 of the @code{:inactive} keyword.  If this is non-nil, the widget itself
1344 has been deactivated.  This is different from using the @code{:active}
1345 keyword, in that the latter tells you if the widget @strong{or} any of
1346 its ancestors have been deactivated.  Do not attempt to set the
1347 @code{:inactive} keyword directly.  Use the @code{:activate}
1348 @code{:deactivate} keywords instead.
1349
1350
1351 @node Defining New Widgets, Widget Browser, Widget Properties, Top
1352 @comment  node-name,  next,  previous,  up
1353 @section Defining New Widgets
1354
1355 You can define specialized widgets with @code{define-widget}.  It allows
1356 you to create a shorthand for more complex widgets.  This includes
1357 specifying component widgets and new default values for the keyword
1358 arguments.
1359
1360 @defun widget-define name class doc &rest args
1361 Define a new widget type named @var{name} from @code{class}.
1362
1363 @var{name} and class should both be symbols, @code{class} should be one
1364 of the existing widget types. 
1365
1366 The third argument @var{DOC} is a documentation string for the widget.
1367
1368 After the new widget has been defined the following two calls will
1369 create identical widgets:
1370
1371 @itemize @bullet
1372 @item
1373 @lisp
1374 (widget-create @var{name})
1375 @end lisp
1376
1377 @item
1378 @lisp
1379 (apply widget-create @var{class} @var{args})
1380 @end lisp
1381 @end itemize
1382
1383 @end defun
1384
1385 Using @code{widget-define} just stores the definition of the widget type
1386 in the @code{widget-type} property of @var{name}, which is what
1387 @code{widget-create} uses.
1388
1389 If you just want to specify defaults for keywords with no complex
1390 conversions, you can use @code{identity} as your conversion function.
1391
1392 The following additional keyword arguments are useful when defining new
1393 widgets: 
1394 @table @code
1395 @item :convert-widget
1396 Function to convert a widget type before creating a widget of that
1397 type.  It takes a widget type as an argument, and returns the converted
1398 widget type.  When a widget is created, this function is called for the
1399 widget type and all the widget's parent types, most derived first. 
1400
1401 The following predefined functions can be used here:
1402
1403 @defun widget-types-convert-widget widget
1404 Convert @code{:args} as widget types in @var{widget}.
1405 @end defun
1406
1407 @defun widget-value-convert-widget widget
1408 Initialize @code{:value} from @code{:args} in @var{widget}.
1409 @end defun
1410
1411 @item :value-to-internal
1412 Function to convert the value to the internal format.  The function
1413 takes two arguments, a widget and an external value.  It returns the
1414 internal value.  The function is called on the present @code{:value}
1415 when the widget is created, and on any value set later with
1416 @code{widget-value-set}.
1417
1418 @item :value-to-external
1419 Function to convert the value to the external format.  The function
1420 takes two arguments, a widget and an internal value, and returns the
1421 internal value.  The function is called on the present @code{:value}
1422 when the widget is created, and on any value set later with
1423 @code{widget-value-set}.
1424
1425 @item :create
1426 Function to create a widget from scratch.  The function takes one
1427 argument, a widget type, and creates a widget of that type, inserts it
1428 in the buffer, and returns a widget object.
1429
1430 @item :delete
1431 Function to delete a widget.  The function takes one argument, a widget,
1432 and should remove all traces of the widget from the buffer.
1433
1434 @item :value-create
1435 Function to expand the @samp{%v} escape in the format string.  It will
1436 be called with the widget as its argument and should insert a
1437 representation of the widget's value in the buffer.
1438
1439 @item :value-delete
1440 Should remove the representation of the widget's value from the buffer.
1441 It will be called with the widget as its argument.  It doesn't have to
1442 remove the text, but it should release markers and delete nested widgets
1443 if such have been used.
1444
1445 The following predefined function can be used here:
1446
1447 @defun widget-children-value-delete widget
1448 Delete all @code{:children} and @code{:buttons} in @var{widget}.
1449 @end defun
1450
1451 @item :value-get 
1452 Function to extract the value of a widget, as it is displayed in the
1453 buffer. 
1454
1455 The following predefined function can be used here:
1456
1457 @defun widget-value-value-get widget
1458 Return the @code{:value} property of @var{widget}.
1459 @end defun
1460
1461 @item :format-handler
1462 Function to handle unknown @samp{%} escapes in the format string.  It
1463 will be called with the widget and the escape character as arguments.
1464 You can set this to allow your widget to handle non-standard escapes.
1465
1466 You should end up calling @code{widget-default-format-handler} to handle
1467 unknown escape sequences.  It will handle the @samp{%h} and any future
1468 escape sequences as well as give an error for unknown escapes.
1469
1470 @item :action
1471 Function to handle user initiated events.  By default, @code{:notify}
1472 the parent. 
1473
1474 The following predefined function can be used here:
1475
1476 @defun widget-parent-action widget &optional event
1477 Tell @code{:parent} of @var{widget} to handle the @code{:action}.@*
1478 Optional @var{event} is the event that triggered the action.
1479 @end defun
1480
1481 @item :prompt-value
1482 Function to prompt for a value in the minibuffer.  The function should
1483 take four arguments, @var{widget}, @var{prompt}, @var{value}, and
1484 @var{unbound} and should return a value for widget entered by the user.
1485 @var{prompt} is the prompt to use.  @var{value} is the default value to
1486 use, unless @var{unbound} is non-nil.  In this case there is no default
1487 value.  The function should read the value using the method most natural
1488 for this widget and does not have to check whether it matches.
1489 @end table
1490
1491 If you want to define a new widget from scratch, use the @code{default}
1492 widget as its base.
1493
1494 @deffn Widget default 
1495 Widget used as a base for other widgets. 
1496
1497 It provides most of the functionality that is referred to as ``by
1498 default'' in this text. 
1499 @end deffn
1500
1501 @node Widget Browser, Widget Minor Mode, Defining New Widgets, Top
1502 @comment  node-name,  next,  previous,  up
1503 @section Widget Browser
1504
1505 There is a separate package to browse widgets.  This is intended to help
1506 programmers who want to examine the content of a widget.  The browser
1507 shows the value of each keyword, but uses links for certain keywords
1508 such as `:parent', which avoids printing cyclic structures.
1509
1510 @deffn Command widget-browse WIDGET
1511 Create a widget browser for WIDGET.
1512 When called interactively, prompt for WIDGET.
1513 @end deffn
1514
1515 @deffn Command widget-browse-other-window WIDGET
1516 Create a widget browser for WIDGET and show it in another window.
1517 When called interactively, prompt for WIDGET.
1518 @end deffn
1519
1520 @deffn Command widget-browse-at POS
1521 Create a widget browser for the widget at POS.
1522 When called interactively, use the position of point.
1523 @end deffn
1524
1525 @node  Widget Minor Mode, Utilities, Widget Browser, Top
1526 @comment  node-name,  next,  previous,  up
1527 @section Widget Minor Mode
1528
1529 There is a minor mode for manipulating widgets in major modes that
1530 doesn't provide any support for widgets themselves.  This is mostly
1531 intended to be useful for programmers doing experiments. 
1532
1533 @deffn Command widget-minor-mode
1534 Toggle minor mode for traversing widgets.
1535 With arg, turn widget mode on if and only if arg is positive.
1536 @end deffn
1537
1538 @defvar widget-minor-mode-keymap
1539 Keymap used in @code{widget-minor-mode}.
1540 @end defvar
1541
1542 @node  Utilities, Widget Wishlist, Widget Minor Mode, Top
1543 @comment  node-name,  next,  previous,  up
1544 @section Utilities.
1545
1546 @defun widget-prompt-value widget prompt [ value unbound ]
1547 Prompt for a value matching @var{widget}, using @var{prompt}.@*
1548 The current value is assumed to be @var{value}, unless @var{unbound} is
1549 non-nil.@refill
1550 @end defun
1551
1552 @defun widget-get-sibling widget
1553 Get the item @var{widget} is assumed to toggle.@*
1554 This is only meaningful for radio buttons or checkboxes in a list.
1555 @end defun
1556
1557 @node  Widget Wishlist,  , Utilities, Top
1558 @comment  node-name,  next,  previous,  up
1559 @section Wishlist
1560
1561 @itemize @bullet
1562 @item 
1563 It should be possible to add or remove items from a list with @kbd{C-k}
1564 and @kbd{C-o} (suggested by @sc{rms}).
1565
1566 @item 
1567 The @samp{[INS]} and @samp{[DEL]} buttons should be replaced by a single
1568 dash (@samp{-}).  The dash should be a button that, when invoked, ask
1569 whether you want to add or delete an item (@sc{rms} wanted to git rid of
1570 the ugly buttons, the dash is my idea).
1571
1572 @item
1573 The @code{menu-choice} tag should be prettier, something like the abbreviated
1574 menus in Open Look.
1575
1576 @item
1577 Finish @code{:tab-order}.
1578
1579 @item
1580 Make indentation work with glyphs and proportional fonts.
1581
1582 @item
1583 Add commands to show overview of object and class hierarchies to the
1584 browser. 
1585
1586 @item 
1587 Find a way to disable mouse highlight for inactive widgets.
1588
1589 @item
1590 Find a way to make glyphs look inactive.
1591
1592 @item
1593 Add @code{property-list} widget.
1594
1595 @item
1596 Add @code{association-list} widget.
1597
1598 @item
1599 Add @code{key-binding} widget.
1600
1601 @item
1602 Add @code{widget} widget for editing widget specifications.
1603
1604 @item
1605 Find clean way to implement variable length list.
1606 See @code{TeX-printer-list} for an explanation.
1607
1608 @item 
1609 @kbd{C-h} in @code{widget-prompt-value} should give type specific help.
1610
1611 @item 
1612 A mailto widget.
1613
1614 @item 
1615 @kbd{C-e e} in a fixed size field should go to the end of the text in
1616 the field, not the end of the field itself. 
1617
1618 @item
1619 Use and overlay instead of markers to delimit the widget.  Create
1620 accessors for the end points.
1621
1622 @item
1623 Clicking on documentation links should call @code{describe-function} or
1624 @code{widget-browse-other-window} and friends directly, instead of going
1625 through @code{apropos}.  If more than one function is valid for the
1626 symbol, it should pop up a menu.
1627
1628 @end itemize
1629
1630 @contents
1631 @bye