annotate lisp/w3/widget.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children 9ee227acff29
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; widget.el --- a library of user interface components.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Copyright (C) 1996 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Keywords: help, extensions, faces, hypermedia
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; Version: 0.4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; The documentation for the unbundled version of this library is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; available in `custom.texi'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; This file only contain the code needed to define new widget types.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; Everything else is autoloaded from `widget-edit.el'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 (eval-when-compile (require 'cl))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 (let ((keywords
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 '(:create :convert-widget :format :value-create :tag :doc :from :to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 :args :value :value-from :value-to :action :value-set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 :value-delete :match :parent :delete :menu-tag-get
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 :value-get :choice :void :menu-tag :on :off :on-type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 :off-type :notify :entry-format :button :children
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 :buttons :insert-before :delete-at :format-handler
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 :widget :value-pos :value-to-internal :indent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 :help-echo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 :value-to-external :validate :error :directory :must-match
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 :initial :type-error :value-inline :inline :match-inline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 :greedy :button-face :value-face :keymap :size)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (while keywords
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (or (boundp (car keywords))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (set (car keywords) (car keywords)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (setq keywords (cdr keywords))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (defun define-widget (name class doc &rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 "Define a new widget type named NAME from CLASS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 NAME and CLASS should both be symbols, CLASS should be one of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 existing widget types, or nil to create the widget from scratch.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 After the new widget has been defined, the following two calls will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 create identical widgets:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 * (widget-create NAME)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 * (apply 'widget-create CLASS ARGS)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 The third argument DOC is a documentation string for the widget."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (put name 'widget-type (cons class args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (put name 'widget-documentation doc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (autoload 'widget-create "widget-edit")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (autoload 'widget-insert "widget-edit")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (defun define-widget-group (name class doc &rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 "Define a new widget group named NAME.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 CLASS should be nil, it is reserved for future use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 MATCH should be a function taking a widget group and a list of match
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 types as an argument, and returning the remaining part of the list if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 the widget group matches the beginning of the list, or throwing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 `no-match' if not.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 CREATE should be a function taking a widget group and a list of values
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 as arguments, and returning a cons whose car is a list of widgets
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 representing the matches values and whose cdr is the remaining
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 unmatched values."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (put name 'widget-group (cons class args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 ;;; The End.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (provide 'widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 ;; widget.el ends here