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