comparison src/macmenu.c @ 62669:befffaf3d1cf

(Fx_popup_dialog): Add a third boolean argument to select frame title ("Question"/"Information"). (mac_dialog_show): Use it.
author Nick Roberts <nickrob@snap.net.nz>
date Tue, 24 May 2005 08:42:23 +0000
parents d119b1761be3
children 5ba03d610746
comparison
equal deleted inserted replaced
62668:d126643d7af1 62669:befffaf3d1cf
836 The return value is VALUE from the chosen item. 836 The return value is VALUE from the chosen item.
837 837
838 An ITEM may also be just a string--that makes a nonselectable item. 838 An ITEM may also be just a string--that makes a nonselectable item.
839 An ITEM may also be nil--that means to put all preceding items 839 An ITEM may also be nil--that means to put all preceding items
840 on the left of the dialog box and all following items on the right. 840 on the left of the dialog box and all following items on the right.
841 \(By default, approximately half appear on each side.) */) 841 \(By default, approximately half appear on each side.)
842 (position, contents) 842
843 Lisp_Object position, contents; 843 If HEADER is non-nil, the frame title for the box is "Information",
844 otherwise it is "Question". */)
845 (position, contents, header)
846 Lisp_Object position, contents, header;
844 { 847 {
845 FRAME_PTR f = NULL; 848 FRAME_PTR f = NULL;
846 Lisp_Object window; 849 Lisp_Object window;
847 850
848 check_mac (); 851 check_mac ();
925 928
926 list_of_panes (Fcons (contents, Qnil)); 929 list_of_panes (Fcons (contents, Qnil));
927 930
928 /* Display them in a dialog box. */ 931 /* Display them in a dialog box. */
929 BLOCK_INPUT; 932 BLOCK_INPUT;
930 selection = mac_dialog_show (f, 0, title, &error_name); 933 selection = mac_dialog_show (f, 0, title, header, &error_name);
931 UNBLOCK_INPUT; 934 UNBLOCK_INPUT;
932 935
933 discard_menu_items (); 936 discard_menu_items ();
934 937
935 if (error_name) error (error_name); 938 if (error_name) error (error_name);
2044 static char * button_names [] = { 2047 static char * button_names [] = {
2045 "button1", "button2", "button3", "button4", "button5", 2048 "button1", "button2", "button3", "button4", "button5",
2046 "button6", "button7", "button8", "button9", "button10" }; 2049 "button6", "button7", "button8", "button9", "button10" };
2047 2050
2048 static Lisp_Object 2051 static Lisp_Object
2049 mac_dialog_show (f, keymaps, title, error) 2052 mac_dialog_show (f, keymaps, title, header, error)
2050 FRAME_PTR f; 2053 FRAME_PTR f;
2051 int keymaps; 2054 int keymaps;
2052 Lisp_Object title; 2055 Lisp_Object title, header;
2053 char **error; 2056 char **error;
2054 { 2057 {
2055 int i, nb_buttons=0; 2058 int i, nb_buttons=0;
2056 char dialog_name[6]; 2059 char dialog_name[6];
2057 int menu_item_selection; 2060 int menu_item_selection;
2150 2153
2151 wv = xmalloc_widget_value (); 2154 wv = xmalloc_widget_value ();
2152 wv->name = dialog_name; 2155 wv->name = dialog_name;
2153 wv->help = Qnil; 2156 wv->help = Qnil;
2154 2157
2158 /* Frame title: 'Q' = Question, 'I' = Information.
2159 Can also have 'E' = Error if, one day, we want
2160 a popup for errors. */
2161 if (NILP(header))
2162 dialog_name[0] = 'Q';
2163 else
2164 dialog_name[0] = 'I';
2165
2155 /* Dialog boxes use a really stupid name encoding 2166 /* Dialog boxes use a really stupid name encoding
2156 which specifies how many buttons to use 2167 which specifies how many buttons to use
2157 and how many buttons are on the right. 2168 and how many buttons are on the right. */
2158 The Q means something also. */
2159 dialog_name[0] = 'Q';
2160 dialog_name[1] = '0' + nb_buttons; 2169 dialog_name[1] = '0' + nb_buttons;
2161 dialog_name[2] = 'B'; 2170 dialog_name[2] = 'B';
2162 dialog_name[3] = 'R'; 2171 dialog_name[3] = 'R';
2163 /* Number of buttons to put on the right. */ 2172 /* Number of buttons to put on the right. */
2164 dialog_name[4] = '0' + nb_buttons - left_count; 2173 dialog_name[4] = '0' + nb_buttons - left_count;