Commit | Line | Data |
---|---|---|
d543e20b PA |
1 | ;;; widget.el --- a library of user interface components. |
2 | ;; | |
3 | ;; Copyright (C) 1996, 1997 Free Software Foundation, Inc. | |
4 | ;; | |
5 | ;; Author: Per Abrahamsen <abraham@dina.kvl.dk> | |
6 | ;; Keywords: help, extensions, faces, hypermedia | |
bd042c03 | 7 | ;; Version: 1.84 |
d543e20b PA |
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 `wid-edit.el'. | |
16 | ||
17 | ;;; Code: | |
18 | ||
19 | (eval-when-compile (require 'cl)) | |
20 | ||
21 | (defmacro define-widget-keywords (&rest keys) | |
22 | (` | |
23 | (eval-and-compile | |
24 | (let ((keywords (quote (, keys)))) | |
25 | (while keywords | |
26 | (or (boundp (car keywords)) | |
27 | (set (car keywords) (car keywords))) | |
28 | (setq keywords (cdr keywords))))))) | |
29 | ||
bd042c03 PA |
30 | (define-widget-keywords :text-format :deactivate :active :inactive |
31 | :activate :sibling-args :delete-button-args | |
d543e20b PA |
32 | :insert-button-args :append-button-args :button-args |
33 | :tag-glyph :off-glyph :on-glyph :valid-regexp | |
34 | :secret :sample-face :sample-face-get :case-fold :widget-doc | |
35 | :create :convert-widget :format :value-create :offset :extra-offset | |
36 | :tag :doc :from :to :args :value :value-from :value-to :action | |
37 | :value-set :value-delete :match :parent :delete :menu-tag-get | |
38 | :value-get :choice :void :menu-tag :on :off :on-type :off-type | |
39 | :notify :entry-format :button :children :buttons :insert-before | |
40 | :delete-at :format-handler :widget :value-pos :value-to-internal | |
41 | :indent :size :value-to-external :validate :error :directory | |
42 | :must-match :type-error :value-inline :inline :match-inline :greedy | |
43 | :button-face-get :button-face :value-face :keymap :entry-from | |
44 | :entry-to :help-echo :documentation-property :hide-front-space | |
45 | :hide-rear-space :tab-order) | |
46 | ||
47 | ;; These autoloads should be deleted when the file is added to Emacs. | |
48 | (unless (fboundp 'load-gc) | |
49 | (autoload 'widget-apply "wid-edit") | |
50 | (autoload 'widget-create "wid-edit") | |
51 | (autoload 'widget-insert "wid-edit") | |
52 | (autoload 'widget-browse "wid-browse" nil t) | |
bd042c03 | 53 | (autoload 'widget-browse-other-window "wid-browse" nil t) |
d543e20b PA |
54 | (autoload 'widget-browse-at "wid-browse" nil t)) |
55 | ||
56 | (defun define-widget (name class doc &rest args) | |
57 | "Define a new widget type named NAME from CLASS. | |
58 | ||
59 | NAME and CLASS should both be symbols, CLASS should be one of the | |
60 | existing widget types, or nil to create the widget from scratch. | |
61 | ||
62 | After the new widget has been defined, the following two calls will | |
63 | create identical widgets: | |
64 | ||
65 | * (widget-create NAME) | |
66 | ||
67 | * (apply 'widget-create CLASS ARGS) | |
68 | ||
69 | The third argument DOC is a documentation string for the widget." | |
70 | (put name 'widget-type (cons class args)) | |
71 | (put name 'widget-documentation doc)) | |
72 | ||
73 | ;;; The End. | |
74 | ||
75 | (provide 'widget) | |
76 | ||
77 | ;; widget.el ends here |