annotate lisp/widget.el @ 304:c6de09ad3017 r21-0b50

Import from CVS: tag r21-0b50
author cvs
date Mon, 13 Aug 2007 10:41:12 +0200
parents 0e522484dd2a
children 8626e4521993
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1 ;;; widget.el --- a library of user interface components.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3 ;; Copyright (C) 1996, 1997 Free Software Foundation, Inc.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
4
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
6 ;; Maintainer: Hrvoje Niksic <hniksic@srce.hr>
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
7 ;; Keywords: help, extensions, faces, hypermedia, dumped
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
8 ;; Version: 1.9960-x
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
9 ;; X-URL: http://www.dina.kvl.dk/~abraham/custom/
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
10
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
11 ;; This file is part of XEmacs.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
12
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
13 ;; XEmacs is free software; you can redistribute it and/or modify
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
15 ;; the Free Software Foundation; either version 2, or (at your option)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
16 ;; any later version.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
17
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
18 ;; XEmacs is distributed in the hope that it will be useful,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
21 ;; GNU General Public License for more details.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
22
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
24 ;; along with XEmacs; see the file COPYING. If not, write to the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
26 ;; Boston, MA 02111-1307, USA.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
27
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
28 ;;; Commentary:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
29
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
30 ;; This file is dumped with XEmacs.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
31
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
32 ;; If you want to use this code, please visit the URL above.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
33
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
34 ;; This file only contain the code needed to define new widget types.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
35 ;; Everything else is autoloaded from `wid-edit.el'.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
36
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
37 ;;; Code:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
38
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
39 ;; Neither XEmacs, nor latest GNU Emacs need this -- provided for
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
40 ;; compatibility.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
41 ;; (defalias 'define-widget-keywords 'ignore)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
42
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
43 (defmacro define-widget-keywords (&rest keys)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
44 "This doesn't do anything in Emacs 20 or XEmacs."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
45 (`
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
46 (eval-and-compile
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
47 (let ((keywords (quote (, keys))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
48 (while keywords
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
49 (or (boundp (car keywords))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
50 (set (car keywords) (car keywords)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
51 (setq keywords (cdr keywords)))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
52
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
53 (defun define-widget (name class doc &rest args)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
54 "Define a new widget type named NAME from CLASS.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
55
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
56 NAME and CLASS should both be symbols, CLASS should be one of the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
57 existing widget types, or nil to create the widget from scratch.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
58
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
59 After the new widget has been defined, the following two calls will
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
60 create identical widgets:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
61
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
62 * (widget-create NAME)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
63
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
64 * (apply 'widget-create CLASS ARGS)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
65
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
66 The third argument DOC is a documentation string for the widget."
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 209
diff changeset
67 (check-argument-type 'symbolp name)
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 209
diff changeset
68 (check-argument-type 'symbolp class)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
69 (put name 'widget-type (cons class args))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
70 (put name 'widget-documentation doc)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
71 name)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
72
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
73 ;;; The End.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
74
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
75 (provide 'widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
76
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
77 ;;; widget.el ends here