*** empty log message ***
[gnus] / lisp / widget.el
1 ;;; widget.el --- a library of user interface components.
2 ;;
3 ;; Copyright (C) 1996 Free Software Foundation, Inc.
4 ;;
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
6 ;; Keywords: help, extensions, faces, hypermedia
7 ;; Version: 0.9
8 ;; X-URL: http://www.dina.kvl.dk/~abraham/custom/
9
10 ;;; Commentary:
11 ;;
12 ;; If you want to use this code, please visit the URL above.
13 ;;
14 ;; This file only contain the code needed to define new widget types.
15 ;; Everything else is autoloaded from `widget-edit.el'.
16
17 ;;; Code:
18
19 (eval-when-compile (require 'cl))
20
21 (let ((keywords 
22        '(:create :convert-widget :format :value-create :tag :doc :from :to
23                  :args :value :value-from :value-to :action :value-set
24                  :value-delete :match :parent :delete :menu-tag-get
25                  :value-get :choice :void :menu-tag :on :off :on-type 
26                  :off-type :notify :entry-format :button :children
27                  :buttons :insert-before :delete-at :format-handler
28                  :widget :value-pos :value-to-internal :indent :size
29                  :value-to-external :validate :error :directory :must-match
30                  :type-error :value-inline :inline :match-inline
31                  :greedy :button-face-get :button-face :value-face :keymap
32                  :entry-from :entry-to :help-echo)))
33   (while keywords
34     (or (boundp (car keywords))
35         (set (car keywords) (car keywords)))
36     (setq keywords (cdr keywords))))
37
38 ;; These autoloads should be deleted when the file is added to Emacs.
39 (autoload 'widget-create "widget-edit")
40 (autoload 'widget-insert "widget-edit")
41
42 ;;;###autoload
43 (defun define-widget (name class doc &rest args)
44   "Define a new widget type named NAME from CLASS.
45
46 NAME and CLASS should both be symbols, CLASS should be one of the
47 existing widget types, or nil to create the widget from scratch.
48
49 After the new widget has been defined, the following two calls will
50 create identical widgets:
51
52 * (widget-create NAME)
53
54 * (apply 'widget-create CLASS ARGS)
55
56 The third argument DOC is a documentation string for the widget."
57   (put name 'widget-type (cons class args))
58   (put name 'widget-documentation doc))
59
60 ;;; The End.
61
62 (provide 'widget)
63
64 ;; widget.el ends here