Mercurial > hg > xemacs-beta
comparison src/dialog.c @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 3ecd8885ac67 |
children | 183866b06e0b |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
1 /* Implements elisp-programmable dialog boxes -- generic. | 1 /* Implements elisp-programmable dialog boxes -- generic. |
2 Copyright (C) 1993, 1994 Free Software Foundation, Inc. | 2 Copyright (C) 1993, 1994 Free Software Foundation, Inc. |
3 Copyright (C) 1995 Tinker Systems and INS Engineering Corp. | 3 Copyright (C) 1995 Tinker Systems and INS Engineering Corp. |
4 Copyright (C) 2000 Ben Wing. | |
4 | 5 |
5 This file is part of XEmacs. | 6 This file is part of XEmacs. |
6 | 7 |
7 XEmacs is free software; you can redistribute it and/or modify it | 8 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 under the terms of the GNU General Public License as published by the |
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 Boston, MA 02111-1307, USA. */ | 21 Boston, MA 02111-1307, USA. */ |
21 | 22 |
22 /* Synched up with: Not in FSF. */ | 23 /* Synched up with: Not in FSF. */ |
23 | 24 |
24 /* #### There ain't nothin' here because dialog boxes have not been | |
25 properly abstracted yet. */ | |
26 | |
27 #include <config.h> | 25 #include <config.h> |
28 #include "lisp.h" | 26 #include "lisp.h" |
27 | |
29 #include "frame.h" | 28 #include "frame.h" |
30 #include "device.h" | 29 #include "device.h" |
31 | 30 |
32 DEFUN ("popup-dialog-box", Fpopup_dialog_box, 1, 1, 0, /* | 31 Lisp_Object Vdelete_dialog_box_hook; |
33 Pop up a dialog box. | 32 Lisp_Object Qdelete_dialog_box_hook; |
34 A dialog box description is a list. | |
35 | 33 |
36 The first element of a dialog box must be a string, which is the title or | 34 DEFUN ("make-dialog-box-internal", Fmake_dialog_box_internal, 2, 2, 0, /* |
37 question. | 35 Internal helper function for `make-dialog-box'. |
38 | 36 This handles all dialog-box types except `general'. |
39 The rest of the elements are descriptions of the dialog box's buttons. | 37 TYPE is the same as the first argument to `make-dialog-box', and KEYS |
40 Each of these is a vector, the syntax of which is essentially the same as | 38 a list of the remaining arguments. |
41 that of popup menu items. They may have any of the following forms: | |
42 | |
43 [ "name" callback <active-p> ] | |
44 [ "name" callback <active-p> "suffix" ] | |
45 [ "name" callback :<keyword> <value> :<keyword> <value> ... ] | |
46 | |
47 The name is the string to display on the button; it is filtered through the | |
48 resource database, so it is possible for resources to override what string | |
49 is actually displayed. | |
50 | |
51 If the `callback' of a button is a symbol, then it must name a command. | |
52 It will be invoked with `call-interactively'. If it is a list, then it is | |
53 evaluated with `eval'. | |
54 | |
55 One (and only one) of the buttons may be `nil'. This marker means that all | |
56 following buttons should be flushright instead of flushleft. | |
57 | |
58 Though the keyword/value syntax is supported for dialog boxes just as in | |
59 popup menus, the only keyword which is both meaningful and fully implemented | |
60 for dialog box buttons is `:active'. | |
61 */ | 39 */ |
62 (dbox_desc)) | 40 (type, keys)) |
63 { | 41 { |
64 struct frame *f = selected_frame (); | 42 struct frame *f = selected_frame (); |
65 struct device *d = XDEVICE (f->device); | 43 struct device *d = XDEVICE (f->device); |
66 | 44 |
67 if (!HAS_DEVMETH_P (d, popup_dialog_box)) | 45 CHECK_SYMBOL (type); |
68 signal_simple_error ("Device does not support dialogs", f->device); | |
69 | 46 |
70 if (SYMBOLP (dbox_desc)) | 47 if (!HAS_DEVMETH_P (d, make_dialog_box_internal)) |
71 dbox_desc = Fsymbol_value (dbox_desc); | 48 signal_type_error (Qunimplemented, |
72 CHECK_CONS (dbox_desc); | 49 "Device does not support dialogs", f->device); |
73 CHECK_STRING (XCAR (dbox_desc)); | |
74 if (!CONSP (XCDR (dbox_desc))) | |
75 signal_simple_error ("Dialog descriptor must supply at least one button", dbox_desc); | |
76 | 50 |
77 DEVMETH (d, popup_dialog_box, (f, dbox_desc)); | 51 return DEVMETH (d, make_dialog_box_internal, (f, type, keys)); |
78 | |
79 return Qnil; | |
80 } | 52 } |
81 | 53 |
82 void | 54 void |
83 syms_of_dialog (void) | 55 syms_of_dialog (void) |
84 { | 56 { |
85 DEFSUBR (Fpopup_dialog_box); | 57 DEFSUBR (Fmake_dialog_box_internal); |
58 | |
59 DEFSYMBOL (Qdelete_dialog_box_hook); | |
86 } | 60 } |
87 | 61 |
88 void | 62 void |
89 vars_of_dialog (void) | 63 vars_of_dialog (void) |
90 { | 64 { |
91 Fprovide (intern ("dialog")); | 65 Fprovide (intern ("dialog")); |
66 | |
67 DEFVAR_LISP ("delete-dialog-box-hook", &Vdelete_dialog_box_hook /* | |
68 Function or functions to call when a dialog box is about to be deleted. | |
69 One arg, the dialog box id. | |
70 */ ); | |
71 Vdelete_dialog_box_hook = Qnil; | |
92 } | 72 } |