annotate lisp/dialog.el @ 453:270b05afd845

Added tag r21-2-41 for changeset 3d3049ae1304
author cvs
date Mon, 13 Aug 2007 11:40:23 +0200
parents 576fb035e263
children 5aa1854ad537
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 ;;; dialog.el --- Dialog-box support for XEmacs
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) 1991-4, 1997 Free Software Foundation, Inc.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
4 ;; Copyright (C) 2000 Ben Wing.
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
5
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
6 ;; Maintainer: XEmacs Development Team
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
7 ;; Keywords: extensions, internal, dumped
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
8
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
9 ;; This file is part of XEmacs.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
10
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
11 ;; XEmacs is free software; you can redistribute it and/or modify it
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
12 ;; under the terms of the GNU General Public License as published by
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
14 ;; any later version.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
15
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
16 ;; XEmacs is distributed in the hope that it will be useful, but
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
19 ;; General Public License for more details.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
20
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
22 ;; along with XEmacs; see the file COPYING. If not, write to the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
23 ;; Free Software Foundation, 59 Temple Place - Suite 330,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
24 ;; Boston, MA 02111-1307, USA.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
25
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
26 ;;; Synched up with: Not in FSF.
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 (when dialog boxes are compiled in).
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
31
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
32 ;; Dialog boxes are non-modal at the C level, but made modal at the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
33 ;; Lisp level via hacks in functions such as yes-or-no-p-dialog-box
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
34 ;; below. Perhaps there should be truly modal dialog boxes
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
35 ;; implemented at the C level for safety. All code using dialog boxes
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
36 ;; should be careful to assume that the environment, for example the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
37 ;; current buffer, might be completely different after returning from
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
38 ;; yes-or-no-p-dialog-box, but such code is difficult to write and test.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
39
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
40 ;;; Code:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
41 (defun yes-or-no-p-dialog-box (prompt)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
42 "Ask user a yes-or-no question with a popup dialog box.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
43 Return t if the answer is \"yes\".
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
44 Takes one argument, which is the string to display to ask the question."
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
45 (save-selected-frame
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
46 (make-dialog-box 'question
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
47 :question prompt
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
48 :modal t
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
49 :buttons '(["Yes" (dialog-box-finish t)]
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
50 ["No" (dialog-box-finish nil)]
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
51 nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
52 ["Cancel" (dialog-box-cancel)]))))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
53
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
54 ;; FSF has a similar function `x-popup-dialog'.
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
55 (defun get-dialog-box-response (position contents)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
56 "Pop up a dialog box and return user's selection.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
57 POSITION specifies which frame to use.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
58 This is normally an event or a window or frame.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
59 If POSITION is t or nil, it means to use the frame the mouse is on.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
60 The dialog box appears in the middle of the specified frame.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
61
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
62 CONTENTS specifies the alternatives to display in the dialog box.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
63 It is a list of the form (TITLE ITEM1 ITEM2...).
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
64 Each ITEM is a cons cell (STRING . VALUE).
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
65 The return value is VALUE from the chosen item.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
66
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
67 An ITEM may also be just a string--that makes a nonselectable item.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
68 An ITEM may also be nil--that means to put all preceding items
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
69 on the left of the dialog box and all following items on the right."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
70 (cond
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
71 ((eventp position)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
72 (select-frame (event-frame position)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
73 ((framep position)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
74 (select-frame position))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
75 ((windowp position)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
76 (select-window position)))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
77 (make-dialog-box 'question
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
78 :question (car contents)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
79 :modal t
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
80 :buttons
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
81 (mapcar #'(lambda (x)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
82 (cond
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
83 ((null x)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
84 nil)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
85 ((stringp x)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
86 ;;this will never get selected
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
87 `[,x 'ignore nil])
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
88 (t
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
89 `[,(car x) (dialog-box-finish ',(cdr x)) t])))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
90 (cdr contents))))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
91
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
92 (defun message-box (fmt &rest args)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
93 "Display a message, in a dialog box if possible.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
94 If the selected device has no dialog-box support, use the echo area.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
95 The arguments are the same as to `format'.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
96
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
97 If the only argument is nil, clear any existing message; let the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
98 minibuffer contents show."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
99 (if (and (null fmt) (null args))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
100 (progn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
101 (clear-message nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
102 nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
103 (let ((str (apply 'format fmt args)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
104 (if (device-on-window-system-p)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
105 (get-dialog-box-response nil (list str (cons "%_OK" t)))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
106 (display-message 'message str))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
107 str)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
108
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
109 (defun message-or-box (fmt &rest args)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
110 "Display a message in a dialog box or in the echo area.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
111 If this command was invoked with the mouse, use a dialog box.
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
112 Otherwise, use the echo area.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
113 The arguments are the same as to `format'.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
114
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
115 If the only argument is nil, clear any existing message; let the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
116 minibuffer contents show."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
117 (if (should-use-dialog-box-p)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
118 (apply 'message-box fmt args)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
119 (apply 'message fmt args)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
120
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
121 (defun make-dialog-box (type &rest cl-keys)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
122 "Pop up a dialog box.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
123 TYPE is a symbol, the type of dialog box. Remaining arguments are
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
124 keyword-value pairs, specifying the particular characteristics of the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
125 dialog box. The allowed keywords are particular to each type, but
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
126 some standard keywords are common to many types:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
127
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
128 :title
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
129 The title of the dialog box's window.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
130
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
131 :modal
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
132 If true, indicates that XEmacs will wait until the user is \"done\"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
133 with the dialog box (usually, this means that a response has been
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
134 given). Typically, the response is returned. NOTE: Some dialog
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
135 boxes are always modal. If the dialog box is modal, `make-dialog-box'
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
136 returns immediately. The return value will be either nil or a
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
137 dialog box handle of some sort, e.g. a frame for type `general'.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
138
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
139 ---------------------------------------------------------------------------
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
140
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
141 Recognized types are
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
142
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
143 general
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
144 A dialog box consisting of an XEmacs glyph, typically a `layout'
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
145 widget specifying a dialog box arrangement. This is the most
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
146 general and powerful dialog box type, but requires more work than
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
147 the other types below.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
148
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
149 question
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
150 A simple dialog box that displays a question and contains one or
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
151 more user-defined buttons to specify possible responses. (This is
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
152 compatible with the old built-in dialog boxes formerly specified
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
153 using `popup-dialog-box'.)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
154
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
155 file
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
156 A file dialog box, of the type typically used in the window system
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
157 XEmacs is running on.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
158
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
159 color
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
160 A color picker.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
161
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
162 find
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
163 A find dialog box.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
164
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
165 font
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
166 A font chooser.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
167
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
168 print
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
169 A dialog box used when printing (e.g. number of pages, printer).
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
170
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
171 page-setup
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
172 A dialog box for setting page options (e.g. margins) for printing.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
173
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
174 replace
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
175 A find/replace dialog box.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
176
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
177 mswindows-message
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
178 An MS Windows-specific standard dialog box type similar to `question'.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
179
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
180 ---------------------------------------------------------------------------
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
181
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
182 For type `general':
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
183
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
184 This type creates a frame and puts the specified widget layout in it.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
185 \(Currently this is done by eliminating all areas but the gutter and placing
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
186 the layout there; but this is an implementation detail and may change.)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
187
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
188 The keywords allowed for `general' are
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
189
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
190 :spec
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
191 The widget spec -- anything that can be passed to `make-glyph'.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
192
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
193 :title
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
194 The title of the frame.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
195 :parent
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
196 The frame is made a child of this frame (defaults to the selected frame).
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
197
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
198 :properties
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
199 Additional properties of the frame, as well as `dialog-frame-plist'.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
200
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
201 ---------------------------------------------------------------------------
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
202
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
203 For type `question':
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
204
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
205 The keywords allowed are
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
206
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
207 :modal
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
208 t or nil. When t, the dialog box callback should exit the dialog box
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
209 using the functions `dialog-box-finish' or `dialog-box-cancel'.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
210 :title
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
211 The title of the frame.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
212 :question
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
213 A string, the question.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
214 :buttons
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
215 A list, describing the buttons below the question. Each of these is a
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
216 vector, the syntax of which is essentially the same as that of popup menu
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
217 items. They may have any of the following forms:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
218
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
219 [ \"name\" callback <active-p> ]
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
220 [ \"name\" callback <active-p> \"suffix\" ]
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
221 [ \"name\" callback :<keyword> <value> :<keyword> <value> ... ]
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
222
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
223 The name is the string to display on the button; it is filtered through the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
224 resource database, so it is possible for resources to override what string
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
225 is actually displayed.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
226
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
227 Accelerators can be indicated in the string by putting the sequence
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
228 \"%_\" before the character corresponding to the key that will invoke
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
229 the button. Uppercase and lowercase accelerators are equivalent. The
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
230 sequence \"%%\" is also special, and is translated into a single %.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
231
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
232 If the `callback' of a button is a symbol, then it must name a command.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
233 It will be invoked with `call-interactively'. If it is a list, then it is
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
234 evaluated with `eval'.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
235
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
236 One (and only one) of the buttons may be `nil'. This marker means that all
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
237 following buttons should be flushright instead of flushleft.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
238
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
239 Though the keyword/value syntax is supported for dialog boxes just as in
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
240 popup menus, the only keyword which is both meaningful and fully implemented
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
241 for dialog box buttons is `:active'.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
242
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
243 ---------------------------------------------------------------------------
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
244
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
245 For type `file':
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
246
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
247 The keywords allowed are
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
248
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
249 :initial-filename
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
250 The initial filename to be placed in the dialog box (defaults to nothing).
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
251 :initial-directory
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
252 The initial directory to be selected in the dialog box (defaults to the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
253 current buffer's `default-directory).
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
254 :filter-list
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
255 A list of (filter-desc filter ...)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
256 :title
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
257 The title of the dialog box (defaults to \"Open\").
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
258 :allow-multi-select t or nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
259 :create-prompt-on-nonexistent t or nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
260 :overwrite-prompt t or nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
261 :file-must-exist t or nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
262 :no-network-button t or nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
263 :no-read-only-return t or nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
264
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
265 ---------------------------------------------------------------------------
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
266
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
267 For type `print':
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
268
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
269 This invokes the Windows standard Print dialog.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
270 This dialog is usually invoked when the user selects the Print command.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
271 After the user presses OK, the program should start actual printout.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
272
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
273 The keywords allowed are
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
274
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
275 :device
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
276 An 'msprinter device.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
277 :print-settings
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
278 A printer settings object.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
279
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
280 Exactly one of these keywords must be given.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
281
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
282 The function brings up the Print dialog, where the user can
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
283 select a different printer and/or change printer options. Connection
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
284 name can change as a result of selecting a different printer device. If
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
285 a printer is specified, then changes are stored into the settings object
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
286 currently selected into that printer. If a settings object is supplied,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
287 then changes are recorded into it, and, it it is selected into a
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
288 printer, then changes are propagated to that printer
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
289 too.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
290
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
291 Return value is nil if the user has canceled the dialog. Otherwise, it
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
292 is a new plist, with the following properties:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
293 name Printer device name, even if unchanged by the user.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
294 from-page First page to print, 1-based. If not specified by the user,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
295 then this value is not included in the plist.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
296 to-page Last page to print, inclusive, 1-based. If not specified by
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
297 the user, then this value is not included in the plist.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
298 copies Number of copies to print. Always returned.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
299
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
300 The DEVICE is destroyed and an error is signaled in case of
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
301 initialization problem with the new printer.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
302
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
303 See also the `page-setup' and `print-setup' dialog boxes.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
304
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
305 ---------------------------------------------------------------------------
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
306
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
307 For type `page-setup':
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
308
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
309 This invokes the Windows standard Page Setup dialog.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
310 This dialog is usually invoked in response to the Page Setup command, and
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
311 used to choose such parameters as page orientation, print margins etc.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
312 Note that this dialog contains the \"Printer\" button, which invokes
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
313 the Printer Setup dialog (see `msprinter-print-setup-dialog') so that the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
314 user can update the printer options or even select a different printer
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
315 as well.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
316
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
317 The keywords allowed are
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
318
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
319 :device
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
320 An 'msprinter device.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
321 :print-settings
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
322 A printer settings object.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
323 :properties
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
324 A plist of job properties.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
325
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
326 Exactly one of these keywords must be given.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
327
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
328 The function brings up the Page Setup dialog, where the user
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
329 can select a different printer and/or change printer options.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
330 Connection name can change as a result of selecting a different printer
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
331 device. If a printer is specified, then changes are stored into the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
332 settings object currently selected into that printer. If a settings
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
333 object is supplied, then changes are recorded into it, and, it it is
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
334 selected into a printer, then changes are propagated to that printer
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
335 too.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
336
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
337 :properties specifies a plist of job properties;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
338 see `default-msprinter-frame-plist' for the complete list. The plist
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
339 is used to initialize the dialog.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
340
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
341 Return value is nil if the user has canceled the dialog. Otherwise,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
342 it is a new plist, containing the new list of properties.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
343
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
344 The DEVICE is destroyed and an error is signaled in case of
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
345 initialization problem with the new printer.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
346
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
347 See also the `print' and `print-setup' dialogs.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
348
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
349 ---------------------------------------------------------------------------
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
350
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
351 For type `print-setup':
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
352
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
353 This invokes the Windows standard Print Setup dialog.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
354 This dialog is usually invoked when the user selects the Printer Setup
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
355 command.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
356
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
357 The keywords allowed are
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
358
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
359 :device
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
360 An 'msprinter device.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
361 :print-settings
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
362 A printer settings object.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
363
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
364 Exactly one of these keywords must be given.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
365
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
366 The function brings up the Print Setup dialog, where the user
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
367 can select a different printer and/or change printer options.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
368 Connection name can change as a result of selecting a different printer
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
369 device. If a printer is specified, then changes are stored into the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
370 settings object currently selected into that printer. If a settings
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
371 object is supplied, then changes are recorded into it, and, it it is
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
372 selected into a printer, then changes are propagated to that printer
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
373 too.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
374
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
375 Return value is nil if the user has canceled the dialog. Otherwise, it
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
376 is a new plist, with the following properties:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
377 name Printer device name, even if unchanged by the user.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
378
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
379 The printer device is destroyed and an error is signaled if new printer
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
380 is selected by the user, but cannot be initialized.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
381
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
382 See also the `print' and `page-setup' dialogs.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
383
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
384 ---------------------------------------------------------------------------
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
385
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
386 For type `mswindows-message':
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
387
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
388 The keywords allowed are
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
389
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
390 :title
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
391 The title of the dialog box.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
392 :message
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
393 The string to display.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
394 :flags
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
395 A symbol or list of symbols:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
396
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
397 -- To specify the buttons in the message box:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
398
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
399 abortretryignore
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
400 The message box contains three push buttons: Abort, Retry, and Ignore.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
401 ok
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
402 The message box contains one push button: OK. This is the default.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
403 okcancel
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
404 The message box contains two push buttons: OK and Cancel.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
405 retrycancel
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
406 The message box contains two push buttons: Retry and Cancel.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
407 yesno
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
408 The message box contains two push buttons: Yes and No.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
409 yesnocancel
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
410 The message box contains three push buttons: Yes, No, and Cancel.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
411
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
412
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
413 -- To display an icon in the message box:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
414
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
415 iconexclamation, iconwarning
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
416 An exclamation-point icon appears in the message box.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
417 iconinformation, iconasterisk
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
418 An icon consisting of a lowercase letter i in a circle appears in
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
419 the message box.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
420 iconquestion
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
421 A question-mark icon appears in the message box.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
422 iconstop, iconerror, iconhand
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
423 A stop-sign icon appears in the message box.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
424
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
425
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
426 -- To indicate the default button:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
427
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
428 defbutton1
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
429 The first button is the default button. This is the default.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
430 defbutton2
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
431 The second button is the default button.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
432 defbutton3
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
433 The third button is the default button.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
434 defbutton4
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
435 The fourth button is the default button.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
436
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
437
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
438 -- To indicate the modality of the dialog box:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
439
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
440 applmodal
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
441 The user must respond to the message box before continuing work in
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
442 the window identified by the hWnd parameter. However, the user can
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
443 move to the windows of other applications and work in those windows.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
444 Depending on the hierarchy of windows in the application, the user
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
445 may be able to move to other windows within the application. All
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
446 child windows of the parent of the message box are automatically
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
447 disabled, but popup windows are not. This is the default.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
448 systemmodal
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
449 Same as applmodal except that the message box has the WS_EX_TOPMOST
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
450 style. Use system-modal message boxes to notify the user of serious,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
451 potentially damaging errors that require immediate attention (for
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
452 example, running out of memory). This flag has no effect on the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
453 user's ability to interact with windows other than those associated
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
454 with hWnd.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
455 taskmodal
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
456 Same as applmodal except that all the top-level windows belonging to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
457 the current task are disabled if the hWnd parameter is NULL. Use
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
458 this flag when the calling application or library does not have a
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
459 window handle available but still needs to prevent input to other
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
460 windows in the current application without suspending other
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
461 applications.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
462
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
463
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
464 In addition, you can specify the following flags:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
465
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
466 default-desktop-only
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
467 The desktop currently receiving input must be a default desktop;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
468 otherwise, the function fails. A default desktop is one an
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
469 application runs on after the user has logged on.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
470 help
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
471 Adds a Help button to the message box. Choosing the Help button or
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
472 pressing F1 generates a Help event.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
473 right
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
474 The text is right-justified.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
475 rtlreading
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
476 Displays message and caption text using right-to-left reading order
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
477 on Hebrew and Arabic systems.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
478 setforeground
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
479 The message box becomes the foreground window. Internally, Windows
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
480 calls the SetForegroundWindow function for the message box.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
481 topmost
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
482 The message box is created with the WS_EX_TOPMOST window style.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
483 service-notification
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
484 Windows NT only: The caller is a service notifying the user of an
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
485 event. The function displays a message box on the current active
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
486 desktop, even if there is no user logged on to the computer. If
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
487 this flag is set, the hWnd parameter must be NULL. This is so the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
488 message box can appear on a desktop other than the desktop
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
489 corresponding to the hWnd.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
490
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
491
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
492 The return value is one of the following menu-item values returned by
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
493 the dialog box:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
494
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
495 abort
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
496 Abort button was selected.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
497 cancel
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
498 Cancel button was selected.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
499 ignore
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
500 Ignore button was selected.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
501 no
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
502 No button was selected.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
503 ok
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
504 OK button was selected.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
505 retry
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
506 Retry button was selected.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
507 yes
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
508 Yes button was selected.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
509
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
510 If a message box has a Cancel button, the function returns the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
511 `cancel' value if either the ESC key is pressed or the Cancel button
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
512 is selected. If the message box has no Cancel button, pressing ESC has
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
513 no effect."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
514 (flet ((dialog-box-modal-loop (thunk)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
515 (let* ((frames (frame-list))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
516 (result
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
517 ;; ok, this is extremely tricky. normally a modal
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
518 ;; dialog will pop itself down using (dialog-box-finish)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
519 ;; or (dialog-box-cancel), which throws back to this
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
520 ;; catch. but question dialog boxes pop down themselves
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
521 ;; regardless, so a badly written question dialog box
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
522 ;; that does not use (dialog-box-finish) could seriously
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
523 ;; wedge us. furthermore, we disable all other frames
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
524 ;; in order to implement modality; we need to restore
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
525 ;; them before the dialog box is destroyed, because
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
526 ;; otherwise windows at least will notice that no top-
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
527 ;; level window can have the focus and will shift the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
528 ;; focus to a different app, raising it and obscuring us.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
529 ;; so we create `delete-dialog-box-hook', which is
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
530 ;; called right *before* the dialog box gets destroyed.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
531 ;; here, we put a hook on it, and when it's our dialog
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
532 ;; box and not someone else's that's being destroyed,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
533 ;; we reenable all the frames and remove the hook.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
534 ;; BUT ... we still have to deal with exiting the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
535 ;; modal loop in case it doesn't happen before us.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
536 ;; we can't do this until after the callbacks for this
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
537 ;; dialog box get executed, and that doesn't happen until
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
538 ;; after the dialog box is destroyed. so to keep things
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
539 ;; synchronous, we enqueue an eval event, which goes into
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
540 ;; the same queue as the misc-user events encapsulating
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
541 ;; the dialog callbacks and will go after it (because
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
542 ;; destroying the dialog box happens after processing
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
543 ;; its selection). if the dialog boxes are written
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
544 ;; properly, we don't see this eval event, because we've
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
545 ;; already exited our modal loop. (Thus, we make sure the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
546 ;; function given in this eval event is actually defined
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
547 ;; and does nothing.) If we do see it, though, we know
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
548 ;; that we encountered a badly written dialog box and
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
549 ;; need to exit now. Currently we just return nil, but
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
550 ;; maybe we should signal an error or issue a warning.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
551 (catch 'internal-dialog-box-finish
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
552 (let ((id (eval thunk))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
553 (sym (gensym)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
554 (fset sym
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
555 `(lambda (did)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
556 (when (eq ',id did)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
557 (mapc 'enable-frame ',frames)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
558 (enqueue-eval-event
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
559 'internal-make-dialog-box-exit did)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
560 (remove-hook 'delete-dialog-box-hook
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
561 ',sym))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
562 (add-hook 'delete-dialog-box-hook sym)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
563 (mapc 'disable-frame frames)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
564 (block nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
565 (while t
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
566 (let ((event (next-event)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
567 (if (and (eval-event-p event)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
568 (eq (event-function event)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
569 'internal-make-dialog-box-exit)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
570 (eq (event-object event) id))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
571 (return '(nil))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
572 (dispatch-event event)))))))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
573 (if (listp result)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
574 (car result)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
575 (signal 'quit nil)))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
576 (case type
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
577 (general
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
578 (cl-parsing-keywords
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
579 ((:title "XEmacs")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
580 (:parent (selected-frame))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
581 :modal
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
582 :properties
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
583 :spec)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
584 ()
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
585 (flet ((create-dialog-box-frame ()
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
586 (let* ((ftop (frame-property cl-parent 'top))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
587 (fleft (frame-property cl-parent 'left))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
588 (fwidth (frame-pixel-width cl-parent))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
589 (fheight (frame-pixel-height cl-parent))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
590 (fonth (font-height (face-font 'default)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
591 (fontw (font-width (face-font 'default)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
592 (cl-properties (append cl-properties
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
593 dialog-frame-plist))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
594 (dfheight (plist-get cl-properties 'height))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
595 (dfwidth (plist-get cl-properties 'width))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
596 (unmapped (plist-get cl-properties
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
597 'initially-unmapped))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
598 (gutter-spec cl-spec)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
599 (name (or (plist-get cl-properties 'name) "XEmacs"))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
600 (frame nil))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
601 (plist-remprop cl-properties 'initially-unmapped)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
602 ;; allow the user to just provide a glyph
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
603 (or (glyphp cl-spec) (setq cl-spec (make-glyph cl-spec)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
604 (setq gutter-spec (copy-sequence "\n"))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
605 (set-extent-begin-glyph (make-extent 0 1 gutter-spec)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
606 cl-spec)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
607 ;; under FVWM at least, if I don't specify the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
608 ;; initial position, it ends up always at (0, 0).
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
609 ;; xwininfo doesn't tell me that there are any
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
610 ;; program-specified position hints, so it must be
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
611 ;; an FVWM bug. So just be smashing and position in
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
612 ;; the center of the selected frame.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
613 (setq frame
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
614 (make-frame
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
615 (append cl-properties
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
616 `(popup ,cl-parent initially-unmapped t
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
617 menubar-visible-p nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
618 has-modeline-p nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
619 default-toolbar-visible-p nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
620 top-gutter-visible-p t
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
621 top-gutter-height ,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
622 (* dfheight fonth)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
623 top-gutter ,gutter-spec
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
624 minibuffer none
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
625 name ,name
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
626 modeline-shadow-thickness 0
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
627 vertical-scrollbar-visible-p nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
628 horizontal-scrollbar-visible-p nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
629 unsplittable t
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
630 left ,(+ fleft (- (/ fwidth 2)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
631 (/ (* dfwidth
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
632 fontw)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
633 2)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
634 top ,(+ ftop (- (/ fheight 2)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
635 (/ (* dfheight
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
636 fonth)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
637 2)))))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
638 (set-face-foreground 'modeline [default foreground] frame)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
639 (set-face-background 'modeline [default background] frame)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
640 (unless unmapped (make-frame-visible frame))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
641 (let ((newbuf (generate-new-buffer " *dialog box*")))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
642 (set-buffer-dedicated-frame newbuf frame)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
643 (set-frame-property frame 'dialog-box-buffer newbuf)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
644 (with-current-buffer newbuf
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
645 (setq frame-title-format cl-title)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
646 (make-local-hook 'delete-frame-hook)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
647 (add-hook 'delete-frame-hook
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
648 #'(lambda (frame)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
649 (kill-buffer
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
650 (frame-property
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
651 frame
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
652 'dialog-box-buffer))))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
653 frame)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
654 (if cl-modal
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
655 (dialog-box-modal-loop '(create-dialog-box-frame))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
656 (create-dialog-box-frame)))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
657 (question
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
658 (cl-parsing-keywords
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
659 ((:modal nil))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
660 t
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
661 (remf cl-keys :modal)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
662 (if cl-modal
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
663 (dialog-box-modal-loop `(make-dialog-box-internal ',type
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
664 ',cl-keys))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
665 (make-dialog-box-internal type cl-keys))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
666 (t
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
667 (make-dialog-box-internal type cl-keys)))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
668
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
669 (defun dialog-box-finish (result)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
670 "Exit a modal dialog box, returning RESULT.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
671 This is meant to be executed from a dialog box callback function."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
672 (throw 'internal-dialog-box-finish (list result)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
673
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
674 (defun dialog-box-cancel ()
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
675 "Cancel a modal dialog box.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
676 This is meant to be executed from a dialog box callback function."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
677 (throw 'internal-dialog-box-finish 'cancel))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
678
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
679 ;; an eval event, used as a trigger inside of the dialog modal loop.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
680 (defun internal-make-dialog-box-exit (did)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
681 nil)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
682
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
683 (make-obsolete 'popup-dialog-box 'make-dialog-box)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
684 (defun popup-dialog-box (desc)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
685 "Obsolete equivalent of (make-dialog-box 'question ...).
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
686
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
687 \(popup-dialog-box (QUESTION BUTTONS ...)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
688
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
689 is equivalent to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
690
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
691 \(make-dialog-box 'question :question QUESTION :buttons BUTTONS)"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
692 (check-argument-type 'stringp (car desc))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
693 (or (consp (cdr desc))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
694 (error 'syntax-error
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
695 "Dialog descriptor must supply at least one button"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
696 desc))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
697 (make-dialog-box 'question :question (car desc) :buttons (cdr desc)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 209
diff changeset
698
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
699 ;;; dialog.el ends here