annotate lisp/custom/widget.el @ 112:48d667d6f17f r20-1b8

Import from CVS: tag r20-1b8
author cvs
date Mon, 13 Aug 2007 09:20:48 +0200
parents fe104dbd9147
children 8619ce7e4c50
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
112
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents: 110
diff changeset
7 ;; Version: 1.64
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
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
10 ;;; Commentary:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
11 ;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
12 ;; If you want to use this code, please visit the URL above.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
13 ;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
14 ;; 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
15 ;; Everything else is autoloaded from `wid-edit.el'.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
16
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
17 ;;; Code:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
18
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
19 (eval-when-compile (require 'cl))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
20
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
21 (defmacro define-widget-keywords (&rest keys)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
22 (`
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
23 (eval-and-compile
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
24 (let ((keywords (quote (, keys))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
25 (while keywords
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
26 (or (boundp (car keywords))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
27 (set (car keywords) (car keywords)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
28 (setq keywords (cdr keywords)))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
29
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 106
diff changeset
30 (define-widget-keywords :sibling-args :delete-button-args
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 106
diff changeset
31 :insert-button-args :append-button-args :button-args
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 106
diff changeset
32 :tag-glyph :off-glyph :on-glyph :valid-regexp
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
33 :secret :sample-face :sample-face-get :case-fold :widget-doc
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
34 :create :convert-widget :format :value-create :offset :extra-offset
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
35 :tag :doc :from :to :args :value :value-from :value-to :action
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
36 :value-set :value-delete :match :parent :delete :menu-tag-get
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
37 :value-get :choice :void :menu-tag :on :off :on-type :off-type
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
38 :notify :entry-format :button :children :buttons :insert-before
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
39 :delete-at :format-handler :widget :value-pos :value-to-internal
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
40 :indent :size :value-to-external :validate :error :directory
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
41 :must-match :type-error :value-inline :inline :match-inline :greedy
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
42 :button-face-get :button-face :value-face :keymap :entry-from
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
43 :entry-to :help-echo :documentation-property :hide-front-space
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
44 :hide-rear-space :tab-order)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
45
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
46 ;; 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
47 (unless (fboundp 'load-gc)
106
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 102
diff changeset
48 (autoload 'widget-create "wid-edit")
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 102
diff changeset
49 (autoload 'widget-insert "wid-edit")
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 102
diff changeset
50 (autoload 'widget-browse "wid-browse" nil t)
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 102
diff changeset
51 (autoload 'widget-browse-at "wid-browse" nil t))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
52
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
53 (defun define-widget (name class doc &rest args)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
54 "Define a new widget type named NAME from CLASS.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
55
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
56 NAME and CLASS should both be symbols, CLASS should be one of the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
57 existing widget types, or nil to create the widget from scratch.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
58
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
59 After the new widget has been defined, the following two calls will
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
60 create identical widgets:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
61
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
62 * (widget-create NAME)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
63
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
64 * (apply 'widget-create CLASS ARGS)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
65
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
66 The third argument DOC is a documentation string for the widget."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
67 (put name 'widget-type (cons class args))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
68 (put name 'widget-documentation doc))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
69
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
70 ;;; The End.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
71
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
72 (provide 'widget)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
73
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
74 ;; widget.el ends here