0
|
1 /* Implements elisp-programmable dialog boxes -- generic.
|
|
2 Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
|
3 Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
|
|
4
|
|
5 This file is part of XEmacs.
|
|
6
|
|
7 XEmacs is free software; you can redistribute it and/or modify it
|
|
8 under the terms of the GNU General Public License as published by the
|
|
9 Free Software Foundation; either version 2, or (at your option) any
|
|
10 later version.
|
|
11
|
|
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
15 for more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License
|
|
18 along with XEmacs; see the file COPYING. If not, write to
|
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
20 Boston, MA 02111-1307, USA. */
|
|
21
|
|
22 /* Synched up with: Not in FSF. */
|
|
23
|
|
24 #include <config.h>
|
|
25 #include "lisp.h"
|
284
|
26 #include "frame.h"
|
|
27 #include "device.h"
|
|
28
|
|
29 DEFUN ("popup-dialog-box", Fpopup_dialog_box, 1, 1, 0, /*
|
|
30 Pop up a dialog box.
|
|
31 A dialog box description is a list.
|
|
32
|
|
33 The first element of a dialog box must be a string, which is the title or
|
|
34 question.
|
|
35
|
|
36 The rest of the elements are descriptions of the dialog box's buttons.
|
|
37 Each of these is a vector, the syntax of which is essentially the same as
|
|
38 that of popup menu items. They may have any of the following forms:
|
|
39
|
|
40 [ "name" callback <active-p> ]
|
|
41 [ "name" callback <active-p> "suffix" ]
|
|
42 [ "name" callback :<keyword> <value> :<keyword> <value> ... ]
|
|
43
|
|
44 The name is the string to display on the button; it is filtered through the
|
|
45 resource database, so it is possible for resources to override what string
|
|
46 is actually displayed.
|
|
47
|
404
|
48 Accelerators can be indicated in the string by putting the sequence
|
|
49 "%_" before the character corresponding to the key that will invoke
|
|
50 the button. Uppercase and lowercase accelerators are equivalent. The
|
|
51 sequence "%%" is also special, and is translated into a single %.
|
|
52
|
284
|
53 If the `callback' of a button is a symbol, then it must name a command.
|
|
54 It will be invoked with `call-interactively'. If it is a list, then it is
|
|
55 evaluated with `eval'.
|
|
56
|
|
57 One (and only one) of the buttons may be `nil'. This marker means that all
|
|
58 following buttons should be flushright instead of flushleft.
|
|
59
|
|
60 Though the keyword/value syntax is supported for dialog boxes just as in
|
|
61 popup menus, the only keyword which is both meaningful and fully implemented
|
404
|
62 for dialog box buttons is `:active'. */
|
284
|
63 (dbox_desc))
|
|
64 {
|
|
65 struct frame *f = selected_frame ();
|
|
66 struct device *d = XDEVICE (f->device);
|
286
|
67
|
|
68 if (!HAS_DEVMETH_P (d, popup_dialog_box))
|
|
69 signal_simple_error ("Device does not support dialogs", f->device);
|
|
70
|
|
71 if (SYMBOLP (dbox_desc))
|
|
72 dbox_desc = Fsymbol_value (dbox_desc);
|
|
73 CHECK_CONS (dbox_desc);
|
|
74 CHECK_STRING (XCAR (dbox_desc));
|
|
75 if (!CONSP (XCDR (dbox_desc)))
|
404
|
76 signal_simple_error ("Dialog descriptor must supply at least one button",
|
|
77 dbox_desc);
|
286
|
78
|
|
79 DEVMETH (d, popup_dialog_box, (f, dbox_desc));
|
284
|
80
|
|
81 return Qnil;
|
|
82 }
|
0
|
83
|
|
84 void
|
|
85 syms_of_dialog (void)
|
|
86 {
|
284
|
87 DEFSUBR (Fpopup_dialog_box);
|
0
|
88 }
|
|
89
|
|
90 void
|
|
91 vars_of_dialog (void)
|
|
92 {
|
|
93 Fprovide (intern ("dialog"));
|
|
94 }
|