diff options
| author | Nick Roberts | 2005-05-24 03:45:42 +0000 |
|---|---|---|
| committer | Nick Roberts | 2005-05-24 03:45:42 +0000 |
| commit | 6a040d6a2c6a8163fb803c9881295c180e1bb8dd (patch) | |
| tree | 6e5166a7316e6fa457e35a25955cb640e2ee8ad6 /src | |
| parent | 897001fedbe455f04b9fefdc8f7360b2b93849a8 (diff) | |
| download | emacs-6a040d6a2c6a8163fb803c9881295c180e1bb8dd.tar.gz emacs-6a040d6a2c6a8163fb803c9881295c180e1bb8dd.zip | |
(Fx_popup_dialog): Add a third boolean argument to
select frame title ("Question"/"Information").
(xdialog_show): Use it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xmenu.c | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/src/xmenu.c b/src/xmenu.c index 768bd62da52..6f758d12fc7 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -116,7 +116,8 @@ extern Lisp_Object Qmenu_bar_update_hook; | |||
| 116 | extern void set_frame_menubar P_ ((FRAME_PTR, int, int)); | 116 | extern void set_frame_menubar P_ ((FRAME_PTR, int, int)); |
| 117 | extern XtAppContext Xt_app_con; | 117 | extern XtAppContext Xt_app_con; |
| 118 | 118 | ||
| 119 | static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, char **)); | 119 | static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, Lisp_Object, |
| 120 | char **)); | ||
| 120 | static void popup_get_selection P_ ((XEvent *, struct x_display_info *, | 121 | static void popup_get_selection P_ ((XEvent *, struct x_display_info *, |
| 121 | LWLIB_ID, int)); | 122 | LWLIB_ID, int)); |
| 122 | 123 | ||
| @@ -129,7 +130,8 @@ static void popup_get_selection P_ ((XEvent *, struct x_display_info *, | |||
| 129 | #include "gtkutil.h" | 130 | #include "gtkutil.h" |
| 130 | #define HAVE_BOXES 1 | 131 | #define HAVE_BOXES 1 |
| 131 | extern void set_frame_menubar P_ ((FRAME_PTR, int, int)); | 132 | extern void set_frame_menubar P_ ((FRAME_PTR, int, int)); |
| 132 | static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, char **)); | 133 | static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, Lisp_Object, |
| 134 | char **)); | ||
| 133 | #endif | 135 | #endif |
| 134 | 136 | ||
| 135 | /* This is how to deal with multibyte text if HAVE_MULTILINGUAL_MENU | 137 | /* This is how to deal with multibyte text if HAVE_MULTILINGUAL_MENU |
| @@ -999,7 +1001,7 @@ no quit occurs and `x-popup-menu' returns nil. */) | |||
| 999 | 1001 | ||
| 1000 | #ifdef HAVE_MENUS | 1002 | #ifdef HAVE_MENUS |
| 1001 | 1003 | ||
| 1002 | DEFUN ("x-popup-dialog", Fx_popup_dialog, Sx_popup_dialog, 2, 2, 0, | 1004 | DEFUN ("x-popup-dialog", Fx_popup_dialog, Sx_popup_dialog, 2, 3, 0, |
| 1003 | doc: /* Pop up a dialog box and return user's selection. | 1005 | doc: /* Pop up a dialog box and return user's selection. |
| 1004 | POSITION specifies which frame to use. | 1006 | POSITION specifies which frame to use. |
| 1005 | This is normally a mouse button event or a window or frame. | 1007 | This is normally a mouse button event or a window or frame. |
| @@ -1007,7 +1009,7 @@ If POSITION is t, it means to use the frame the mouse is on. | |||
| 1007 | The dialog box appears in the middle of the specified frame. | 1009 | The dialog box appears in the middle of the specified frame. |
| 1008 | 1010 | ||
| 1009 | CONTENTS specifies the alternatives to display in the dialog box. | 1011 | CONTENTS specifies the alternatives to display in the dialog box. |
| 1010 | It is a list of the form (TITLE ITEM1 ITEM2...). | 1012 | It is a list of the form (DIALOG ITEM1 ITEM2...). |
| 1011 | Each ITEM is a cons cell (STRING . VALUE). | 1013 | Each ITEM is a cons cell (STRING . VALUE). |
| 1012 | The return value is VALUE from the chosen item. | 1014 | The return value is VALUE from the chosen item. |
| 1013 | 1015 | ||
| @@ -1016,11 +1018,14 @@ An ITEM may also be nil--that means to put all preceding items | |||
| 1016 | on the left of the dialog box and all following items on the right. | 1018 | on the left of the dialog box and all following items on the right. |
| 1017 | \(By default, approximately half appear on each side.) | 1019 | \(By default, approximately half appear on each side.) |
| 1018 | 1020 | ||
| 1021 | If HEADER is non-nil, the frame title for the box is "Information", | ||
| 1022 | otherwise it is "Question". | ||
| 1023 | |||
| 1019 | If the user gets rid of the dialog box without making a valid choice, | 1024 | If the user gets rid of the dialog box without making a valid choice, |
| 1020 | for instance using the window manager, then this produces a quit and | 1025 | for instance using the window manager, then this produces a quit and |
| 1021 | `x-popup-dialog' does not return. */) | 1026 | `x-popup-dialog' does not return. */) |
| 1022 | (position, contents) | 1027 | (position, contents, header) |
| 1023 | Lisp_Object position, contents; | 1028 | Lisp_Object position, contents, header; |
| 1024 | { | 1029 | { |
| 1025 | FRAME_PTR f = NULL; | 1030 | FRAME_PTR f = NULL; |
| 1026 | Lisp_Object window; | 1031 | Lisp_Object window; |
| @@ -1115,7 +1120,7 @@ for instance using the window manager, then this produces a quit and | |||
| 1115 | 1120 | ||
| 1116 | /* Display them in a dialog box. */ | 1121 | /* Display them in a dialog box. */ |
| 1117 | BLOCK_INPUT; | 1122 | BLOCK_INPUT; |
| 1118 | selection = xdialog_show (f, 0, title, &error_name); | 1123 | selection = xdialog_show (f, 0, title, header, &error_name); |
| 1119 | UNBLOCK_INPUT; | 1124 | UNBLOCK_INPUT; |
| 1120 | 1125 | ||
| 1121 | unbind_to (specpdl_count, Qnil); | 1126 | unbind_to (specpdl_count, Qnil); |
| @@ -3020,11 +3025,11 @@ static char * button_names [] = { | |||
| 3020 | "button6", "button7", "button8", "button9", "button10" }; | 3025 | "button6", "button7", "button8", "button9", "button10" }; |
| 3021 | 3026 | ||
| 3022 | static Lisp_Object | 3027 | static Lisp_Object |
| 3023 | xdialog_show (f, keymaps, title, error) | 3028 | xdialog_show (f, keymaps, title, header, error_name) |
| 3024 | FRAME_PTR f; | 3029 | FRAME_PTR f; |
| 3025 | int keymaps; | 3030 | int keymaps; |
| 3026 | Lisp_Object title; | 3031 | Lisp_Object title, header; |
| 3027 | char **error; | 3032 | char **error_name; |
| 3028 | { | 3033 | { |
| 3029 | int i, nb_buttons=0; | 3034 | int i, nb_buttons=0; |
| 3030 | char dialog_name[6]; | 3035 | char dialog_name[6]; |
| @@ -3036,11 +3041,11 @@ xdialog_show (f, keymaps, title, error) | |||
| 3036 | /* 1 means we've seen the boundary between left-hand elts and right-hand. */ | 3041 | /* 1 means we've seen the boundary between left-hand elts and right-hand. */ |
| 3037 | int boundary_seen = 0; | 3042 | int boundary_seen = 0; |
| 3038 | 3043 | ||
| 3039 | *error = NULL; | 3044 | *error_name = NULL; |
| 3040 | 3045 | ||
| 3041 | if (menu_items_n_panes > 1) | 3046 | if (menu_items_n_panes > 1) |
| 3042 | { | 3047 | { |
| 3043 | *error = "Multiple panes in dialog box"; | 3048 | *error_name = "Multiple panes in dialog box"; |
| 3044 | return Qnil; | 3049 | return Qnil; |
| 3045 | } | 3050 | } |
| 3046 | 3051 | ||
| @@ -3077,7 +3082,7 @@ xdialog_show (f, keymaps, title, error) | |||
| 3077 | if (NILP (item_name)) | 3082 | if (NILP (item_name)) |
| 3078 | { | 3083 | { |
| 3079 | free_menubar_widget_value_tree (first_wv); | 3084 | free_menubar_widget_value_tree (first_wv); |
| 3080 | *error = "Submenu in dialog items"; | 3085 | *error_name = "Submenu in dialog items"; |
| 3081 | return Qnil; | 3086 | return Qnil; |
| 3082 | } | 3087 | } |
| 3083 | if (EQ (item_name, Qquote)) | 3088 | if (EQ (item_name, Qquote)) |
| @@ -3091,7 +3096,7 @@ xdialog_show (f, keymaps, title, error) | |||
| 3091 | if (nb_buttons >= 9) | 3096 | if (nb_buttons >= 9) |
| 3092 | { | 3097 | { |
| 3093 | free_menubar_widget_value_tree (first_wv); | 3098 | free_menubar_widget_value_tree (first_wv); |
| 3094 | *error = "Too many dialog items"; | 3099 | *error_name = "Too many dialog items"; |
| 3095 | return Qnil; | 3100 | return Qnil; |
| 3096 | } | 3101 | } |
| 3097 | 3102 | ||
| @@ -3121,11 +3126,18 @@ xdialog_show (f, keymaps, title, error) | |||
| 3121 | wv = xmalloc_widget_value (); | 3126 | wv = xmalloc_widget_value (); |
| 3122 | wv->name = dialog_name; | 3127 | wv->name = dialog_name; |
| 3123 | wv->help = Qnil; | 3128 | wv->help = Qnil; |
| 3129 | |||
| 3130 | /* Frame title: 'Q' = Question, 'I' = Information. | ||
| 3131 | Can also have 'E' = Error if, one day, we want | ||
| 3132 | a popup for errors. */ | ||
| 3133 | if (NILP(header)) | ||
| 3134 | dialog_name[0] = 'Q'; | ||
| 3135 | else | ||
| 3136 | dialog_name[0] = 'I'; | ||
| 3137 | |||
| 3124 | /* Dialog boxes use a really stupid name encoding | 3138 | /* Dialog boxes use a really stupid name encoding |
| 3125 | which specifies how many buttons to use | 3139 | which specifies how many buttons to use |
| 3126 | and how many buttons are on the right. | 3140 | and how many buttons are on the right. */ |
| 3127 | The Q means something also. */ | ||
| 3128 | dialog_name[0] = 'Q'; | ||
| 3129 | dialog_name[1] = '0' + nb_buttons; | 3141 | dialog_name[1] = '0' + nb_buttons; |
| 3130 | dialog_name[2] = 'B'; | 3142 | dialog_name[2] = 'B'; |
| 3131 | dialog_name[3] = 'R'; | 3143 | dialog_name[3] = 'R'; |