annotate lisp/custom/widget.el @ 24:4103f0995bd7 r19-15b95

Import from CVS: tag r19-15b95
author cvs
date Mon, 13 Aug 2007 08:51:03 +0200
parents 8fc7fe29b841
children 441bb1e64a06
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
1 ;;; widget.el --- a library of user interface components.
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
2 ;;
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 20
diff changeset
3 ;; Copyright (C) 1996, 1997 Free Software Foundation, Inc.
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
4 ;;
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
6 ;; Keywords: help, extensions, faces, hypermedia
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
7 ;; Version: 1.44
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
8 ;; X-URL: http://www.dina.kvl.dk/~abraham/custom/
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
9
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
10 ;;; Commentary:
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
11 ;;
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
12 ;; If you want to use this code, please visit the URL above.
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
13 ;;
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
14 ;; This file only contain the code needed to define new widget types.
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
15 ;; Everything else is autoloaded from `widget-edit.el'.
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
16
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
17 ;;; Code:
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
19 (eval-when-compile (require 'cl))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
20
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
21 (defmacro define-widget-keywords (&rest keys)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
22 (`
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
23 (eval-and-compile
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
24 (let ((keywords (quote (, keys))))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
25 (while keywords
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
26 (or (boundp (car keywords))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
27 (set (car keywords) (car keywords)))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
28 (setq keywords (cdr keywords)))))))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
29
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 20
diff changeset
30 (define-widget-keywords :tag-glyph :off-glyph :on-glyph :valid-regexp
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
31 :secret :sample-face :sample-face-get :case-fold :widget-doc
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
32 :create :convert-widget :format :value-create :offset :extra-offset
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
33 :tag :doc :from :to :args :value :value-from :value-to :action
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
34 :value-set :value-delete :match :parent :delete :menu-tag-get
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
35 :value-get :choice :void :menu-tag :on :off :on-type :off-type
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
36 :notify :entry-format :button :children :buttons :insert-before
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
37 :delete-at :format-handler :widget :value-pos :value-to-internal
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
38 :indent :size :value-to-external :validate :error :directory
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
39 :must-match :type-error :value-inline :inline :match-inline :greedy
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
40 :button-face-get :button-face :value-face :keymap :entry-from
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
41 :entry-to :help-echo :documentation-property :hide-front-space
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
42 :hide-rear-space)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
43
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
44 ;; These autoloads should be deleted when the file is added to Emacs.
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
45 (unless (fboundp 'load-gc)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
46 (autoload 'widget-create "widget-edit")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
47 (autoload 'widget-insert "widget-edit")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
48 (autoload 'widget-browse "widget-browse" nil t)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
49 (autoload 'widget-browse-at "widget-browse" nil t))
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
50
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
51 (defun define-widget (name class doc &rest args)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
52 "Define a new widget type named NAME from CLASS.
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
53
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
54 NAME and CLASS should both be symbols, CLASS should be one of the
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
55 existing widget types, or nil to create the widget from scratch.
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
56
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
57 After the new widget has been defined, the following two calls will
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
58 create identical widgets:
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
59
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
60 * (widget-create NAME)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
61
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
62 * (apply 'widget-create CLASS ARGS)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
63
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
64 The third argument DOC is a documentation string for the widget."
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
65 (put name 'widget-type (cons class args))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
66 (put name 'widget-documentation doc))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
67
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
68 ;;; The End.
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
69
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
70 (provide 'widget)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
71
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents:
diff changeset
72 ;; widget.el ends here