annotate lisp/custom/widget.el @ 157:6b37e6ddd302 r20-3b5

Import from CVS: tag r20-3b5
author cvs
date Mon, 13 Aug 2007 09:40:41 +0200
parents 43dd3413c7c7
children 28f395d8dc7a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1 ;;; widget.el --- a library of user interface components.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2 ;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3 ;; Copyright (C) 1996, 1997 Free Software Foundation, Inc.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
4 ;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
6 ;; Keywords: help, extensions, faces, hypermedia
157
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 155
diff changeset
7 ;; Version: 1.9908
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
8 ;; X-URL: http://www.dina.kvl.dk/~abraham/custom/
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
9
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
10 ;; This file is part of GNU Emacs.
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
11
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
15 ;; any later version.
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
16
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
20 ;; GNU General Public License for more details.
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
21
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
22 ;; You should have received a copy of the GNU General Public License
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
25 ;; Boston, MA 02111-1307, USA.
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
26
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
27 ;;; Commentary:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
28 ;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
29 ;; If you want to use this code, please visit the URL above.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
30 ;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
31 ;; This file only contain the code needed to define new widget types.
106
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 102
diff changeset
32 ;; Everything else is autoloaded from `wid-edit.el'.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
33
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
34 ;;; Code:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
35
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
36 (eval-when-compile (require 'cl))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
37
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
38 (defmacro define-widget-keywords (&rest keys)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
39 (`
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
40 (eval-and-compile
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
41 (let ((keywords (quote (, keys))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
42 (while keywords
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
43 (or (boundp (car keywords))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
44 (set (car keywords) (car keywords)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
45 (setq keywords (cdr keywords)))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
46
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 153
diff changeset
47 (define-widget-keywords :complete-function :complete :button-overlay
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 153
diff changeset
48 :field-overlay
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 153
diff changeset
49 :documentation-shown :button-prefix
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 153
diff changeset
50 :button-suffix :mouse-down-action :glyph-up :glyph-down :glyph-inactive
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
51 :prompt-internal :prompt-history :prompt-match
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 149
diff changeset
52 :prompt-value :deactivate :active
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
53 :inactive :activate :sibling-args :delete-button-args
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 106
diff changeset
54 :insert-button-args :append-button-args :button-args
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 106
diff changeset
55 :tag-glyph :off-glyph :on-glyph :valid-regexp
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 153
diff changeset
56 :secret :sample-face :sample-face-get :case-fold
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
57 :create :convert-widget :format :value-create :offset :extra-offset
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 153
diff changeset
58 :tag :doc :from :to :args :value :action
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
59 :value-set :value-delete :match :parent :delete :menu-tag-get
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
60 :value-get :choice :void :menu-tag :on :off :on-type :off-type
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
61 :notify :entry-format :button :children :buttons :insert-before
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
62 :delete-at :format-handler :widget :value-pos :value-to-internal
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
63 :indent :size :value-to-external :validate :error :directory
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
64 :must-match :type-error :value-inline :inline :match-inline :greedy
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
65 :button-face-get :button-face :value-face :keymap :entry-from
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 153
diff changeset
66 :entry-to :help-echo :documentation-property :tab-order)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
67
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
68 ;; These autoloads should be deleted when the file is added to Emacs.
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
69 (unless (fboundp 'load-gc)
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
70 (autoload 'widget-apply "wid-edit")
106
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 102
diff changeset
71 (autoload 'widget-create "wid-edit")
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 102
diff changeset
72 (autoload 'widget-insert "wid-edit")
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
73 (autoload 'widget-prompt-value "wid-edit")
106
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 102
diff changeset
74 (autoload 'widget-browse "wid-browse" nil t)
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
75 (autoload 'widget-browse-other-window "wid-browse" nil t)
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
76 (autoload 'widget-browse-at "wid-browse" nil t)
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
77 (autoload 'widget-minor-mode "wid-browse" nil t))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
78
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
79 (defun define-widget (name class doc &rest args)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
80 "Define a new widget type named NAME from CLASS.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
81
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
82 NAME and CLASS should both be symbols, CLASS should be one of the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
83 existing widget types, or nil to create the widget from scratch.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
84
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
85 After the new widget has been defined, the following two calls will
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
86 create identical widgets:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
87
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
88 * (widget-create NAME)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
89
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
90 * (apply 'widget-create CLASS ARGS)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
91
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
92 The third argument DOC is a documentation string for the widget."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
93 (put name 'widget-type (cons class args))
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
94 (put name 'widget-documentation doc)
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 136
diff changeset
95 name)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
96
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
97 ;;; The End.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
99 (provide 'widget)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
100
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
101 ;; widget.el ends here