X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=src%2Fdialog.c;h=b067dcc58b0bfe607a51d463315ac7cde8b42698;hp=0f0af99ea40c887c23f180c8373f0927ddc44c6b;hb=0a57cba46779af884cc537d18923dcb6313b9904;hpb=6883ee56ec887c2c48abe5b06b5e66aa74031910 diff --git a/src/dialog.c b/src/dialog.c index 0f0af99..b067dcc 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -1,6 +1,7 @@ /* Implements elisp-programmable dialog boxes -- generic. Copyright (C) 1993, 1994 Free Software Foundation, Inc. Copyright (C) 1995 Tinker Systems and INS Engineering Corp. + Copyright (C) 2000 Ben Wing. This file is part of XEmacs. @@ -21,72 +22,51 @@ Boston, MA 02111-1307, USA. */ /* Synched up with: Not in FSF. */ -/* #### There ain't nothin' here because dialog boxes have not been - properly abstracted yet. */ - #include #include "lisp.h" + #include "frame.h" #include "device.h" -DEFUN ("popup-dialog-box", Fpopup_dialog_box, 1, 1, 0, /* -Pop up a dialog box. -A dialog box description is a list. - -The first element of a dialog box must be a string, which is the title or -question. - -The rest of the elements are descriptions of the dialog box's buttons. -Each of these is a vector, the syntax of which is essentially the same as -that of popup menu items. They may have any of the following forms: - - [ "name" callback ] - [ "name" callback "suffix" ] - [ "name" callback : : ... ] - -The name is the string to display on the button; it is filtered through the -resource database, so it is possible for resources to override what string -is actually displayed. +Lisp_Object Vdelete_dialog_box_hook; +Lisp_Object Qdelete_dialog_box_hook; -If the `callback' of a button is a symbol, then it must name a command. -It will be invoked with `call-interactively'. If it is a list, then it is -evaluated with `eval'. - -One (and only one) of the buttons may be `nil'. This marker means that all -following buttons should be flushright instead of flushleft. - -Though the keyword/value syntax is supported for dialog boxes just as in -popup menus, the only keyword which is both meaningful and fully implemented -for dialog box buttons is `:active'. +DEFUN ("make-dialog-box-internal", Fmake_dialog_box_internal, 2, 2, 0, /* +Internal helper function for `make-dialog-box'. +This handles all dialog-box types except `general'. +TYPE is the same as the first argument to `make-dialog-box', and KEYS +a list of the remaining arguments. */ - (dbox_desc)) + (type, keys)) { struct frame *f = selected_frame (); struct device *d = XDEVICE (f->device); - if (!HAS_DEVMETH_P (d, popup_dialog_box)) - signal_simple_error ("Device does not support dialogs", f->device); - - if (SYMBOLP (dbox_desc)) - dbox_desc = Fsymbol_value (dbox_desc); - CHECK_CONS (dbox_desc); - CHECK_STRING (XCAR (dbox_desc)); - if (!CONSP (XCDR (dbox_desc))) - signal_simple_error ("Dialog descriptor must supply at least one button", dbox_desc); + CHECK_SYMBOL (type); - DEVMETH (d, popup_dialog_box, (f, dbox_desc)); + if (!HAS_DEVMETH_P (d, make_dialog_box_internal)) + signal_type_error (Qunimplemented, + "Device does not support dialogs", f->device); - return Qnil; + return DEVMETH (d, make_dialog_box_internal, (f, type, keys)); } void syms_of_dialog (void) { - DEFSUBR (Fpopup_dialog_box); + DEFSUBR (Fmake_dialog_box_internal); + + DEFSYMBOL (Qdelete_dialog_box_hook); } void vars_of_dialog (void) { Fprovide (intern ("dialog")); + + DEFVAR_LISP ("delete-dialog-box-hook", &Vdelete_dialog_box_hook /* +Function or functions to call when a dialog box is about to be deleted. +One arg, the dialog box id. +*/ ); + Vdelete_dialog_box_hook = Qnil; }