comparison src/toolbar.c @ 20:859a2309aef8 r19-15b93

Import from CVS: tag r19-15b93
author cvs
date Mon, 13 Aug 2007 08:50:05 +0200
parents 9ee227acff29
children 131b0175ea99
comparison
equal deleted inserted replaced
19:ac1f612d5250 20:859a2309aef8
102 DEFINE_LRECORD_IMPLEMENTATION ("toolbar-button", toolbar_button, 102 DEFINE_LRECORD_IMPLEMENTATION ("toolbar-button", toolbar_button,
103 mark_toolbar_button, print_toolbar_button, 103 mark_toolbar_button, print_toolbar_button,
104 0, 0, 0, 104 0, 0, 0,
105 struct toolbar_button); 105 struct toolbar_button);
106 106
107 DEFUN ("toolbar-button-p", Ftoolbar_button_p, Stoolbar_button_p, 1, 1, 0 /* 107 DEFUN ("toolbar-button-p", Ftoolbar_button_p, 1, 1, 0, /*
108 Return non-nil if OBJECT is a toolbar button. 108 Return non-nil if OBJECT is a toolbar button.
109 */ ) 109 */
110 (object) 110 (object))
111 Lisp_Object object;
112 { 111 {
113 return (TOOLBAR_BUTTONP (object) ? Qt : Qnil); 112 return (TOOLBAR_BUTTONP (object) ? Qt : Qnil);
114 } 113 }
115 114
116 /* Only query functions are provided for toolbar buttons. They are 115 /* Only query functions are provided for toolbar buttons. They are
121 toolbar from elisp. Since we only trigger the button callbacks on 120 toolbar from elisp. Since we only trigger the button callbacks on
122 up-mouse events and we reset the flag first, there shouldn't be any 121 up-mouse events and we reset the flag first, there shouldn't be any
123 way for this to get us in trouble (like if someone decides to 122 way for this to get us in trouble (like if someone decides to
124 change the toolbar from a toolbar callback). */ 123 change the toolbar from a toolbar callback). */
125 124
126 DEFUN ("toolbar-button-callback", Ftoolbar_button_callback, 125 DEFUN ("toolbar-button-callback", Ftoolbar_button_callback, 1, 1, 0, /*
127 Stoolbar_button_callback, 1, 1, 0 /*
128 Return the callback function associated with the toolbar BUTTON. 126 Return the callback function associated with the toolbar BUTTON.
129 */ ) 127 */
130 (button) 128 (button))
131 Lisp_Object button;
132 { 129 {
133 CHECK_TOOLBAR_BUTTON (button); 130 CHECK_TOOLBAR_BUTTON (button);
134 131
135 return (XTOOLBAR_BUTTON (button)->callback); 132 return (XTOOLBAR_BUTTON (button)->callback);
136 } 133 }
137 134
138 DEFUN ("toolbar-button-help-string", Ftoolbar_button_help_string, 135 DEFUN ("toolbar-button-help-string", Ftoolbar_button_help_string, 1, 1, 0, /*
139 Stoolbar_button_help_string, 1, 1, 0 /*
140 Return the help string function associated with the toolbar BUTTON. 136 Return the help string function associated with the toolbar BUTTON.
141 */ ) 137 */
142 (button) 138 (button))
143 Lisp_Object button;
144 { 139 {
145 CHECK_TOOLBAR_BUTTON (button); 140 CHECK_TOOLBAR_BUTTON (button);
146 141
147 return (XTOOLBAR_BUTTON (button)->help_string); 142 return (XTOOLBAR_BUTTON (button)->help_string);
148 } 143 }
149 144
150 DEFUN ("toolbar-button-enabled-p", Ftoolbar_button_enabled_p, 145 DEFUN ("toolbar-button-enabled-p", Ftoolbar_button_enabled_p, 1, 1, 0, /*
151 Stoolbar_button_enabled_p, 1, 1, 0 /*
152 Return t if BUTTON is active. 146 Return t if BUTTON is active.
153 */ ) 147 */
154 (button) 148 (button))
155 Lisp_Object button;
156 { 149 {
157 CHECK_TOOLBAR_BUTTON (button); 150 CHECK_TOOLBAR_BUTTON (button);
158 151
159 return (XTOOLBAR_BUTTON (button)->enabled ? Qt : Qnil); 152 return (XTOOLBAR_BUTTON (button)->enabled ? Qt : Qnil);
160 } 153 }
161 154
162 DEFUN ("set-toolbar-button-down-flag", Fset_toolbar_button_down_flag, 155 DEFUN ("set-toolbar-button-down-flag", Fset_toolbar_button_down_flag, 2, 2, 0, /*
163 Sset_toolbar_button_down_flag, 2, 2, 0 /*
164 Don't touch. 156 Don't touch.
165 */ ) 157 */
166 (button, flag) 158 (button, flag))
167 Lisp_Object button, flag;
168 { 159 {
169 struct toolbar_button *tb; 160 struct toolbar_button *tb;
170 char old_flag; 161 char old_flag;
171 162
172 CHECK_TOOLBAR_BUTTON (button); 163 CHECK_TOOLBAR_BUTTON (button);
259 signal_simple_error ("Invalid toolbar position", position); 250 signal_simple_error ("Invalid toolbar position", position);
260 251
261 return TOP_TOOLBAR; /* not reached */ 252 return TOP_TOOLBAR; /* not reached */
262 } 253 }
263 254
264 DEFUN ("set-default-toolbar-position", Fset_default_toolbar_position, 255 DEFUN ("set-default-toolbar-position", Fset_default_toolbar_position, 1, 1, 0, /*
265 Sset_default_toolbar_position, 1, 1, 0 /*
266 Set the position that the `default-toolbar' will be displayed at. 256 Set the position that the `default-toolbar' will be displayed at.
267 Valid positions are 'top, 'bottom, 'left and 'right. 257 Valid positions are 'top, 'bottom, 'left and 'right.
268 See `default-toolbar-position'. 258 See `default-toolbar-position'.
269 */ ) 259 */
270 (position) 260 (position))
271 Lisp_Object position;
272 { 261 {
273 enum toolbar_pos cur = decode_toolbar_position (Vdefault_toolbar_position); 262 enum toolbar_pos cur = decode_toolbar_position (Vdefault_toolbar_position);
274 enum toolbar_pos new = decode_toolbar_position (position); 263 enum toolbar_pos new = decode_toolbar_position (position);
275 264
276 if (cur != new) 265 if (cur != new)
295 } 284 }
296 285
297 return position; 286 return position;
298 } 287 }
299 288
300 DEFUN ("default-toolbar-position", Fdefault_toolbar_position, 289 DEFUN ("default-toolbar-position", Fdefault_toolbar_position, 0, 0, 0, /*
301 Sdefault_toolbar_position, 0, 0, 0 /*
302 Return the position that the `default-toolbar' will be displayed at. 290 Return the position that the `default-toolbar' will be displayed at.
303 The `default-toolbar' will only be displayed here if the corresponding 291 The `default-toolbar' will only be displayed here if the corresponding
304 position-specific toolbar specifier does not provide a value. 292 position-specific toolbar specifier does not provide a value.
305 */ ) 293 */
306 () 294 ())
307 { 295 {
308 return Vdefault_toolbar_position; 296 return Vdefault_toolbar_position;
309 } 297 }
310 298
311 299
1042 } 1030 }
1043 1031
1044 /* toolbar button spec is [pixmap-pair function enabled-p help] 1032 /* toolbar button spec is [pixmap-pair function enabled-p help]
1045 or [:style 2d-or-3d :size width-or-height] */ 1033 or [:style 2d-or-3d :size width-or-height] */
1046 1034
1047 DEFUN ("check-toolbar-button-syntax", Fcheck_toolbar_button_syntax, 1035 DEFUN ("check-toolbar-button-syntax", Fcheck_toolbar_button_syntax, 1, 2, 0, /*
1048 Scheck_toolbar_button_syntax, 1, 2, 0 /*
1049 Verify the syntax of entry BUTTON in a toolbar description list. 1036 Verify the syntax of entry BUTTON in a toolbar description list.
1050 If you want to verify the syntax of a toolbar description list as a 1037 If you want to verify the syntax of a toolbar description list as a
1051 whole, use `check-valid-instantiator' with a specifier type of 'toolbar. 1038 whole, use `check-valid-instantiator' with a specifier type of 'toolbar.
1052 */ ) 1039 */
1053 (button, no_error) 1040 (button, no_error))
1054 Lisp_Object button, no_error;
1055 { 1041 {
1056 Lisp_Object *elt, glyphs, value; 1042 Lisp_Object *elt, glyphs, value;
1057 int len; 1043 int len;
1058 Error_behavior errb = decode_error_behavior_flag (no_error); 1044 Error_behavior errb = decode_error_behavior_flag (no_error);
1059 1045
1201 /* #### This is overkill. I really need to rethink the after-change 1187 /* #### This is overkill. I really need to rethink the after-change
1202 functions to make them easier to use. */ 1188 functions to make them easier to use. */
1203 MARK_TOOLBAR_CHANGED; 1189 MARK_TOOLBAR_CHANGED;
1204 } 1190 }
1205 1191
1206 DEFUN ("toolbar-specifier-p", Ftoolbar_specifier_p, 1192 DEFUN ("toolbar-specifier-p", Ftoolbar_specifier_p, 1, 1, 0, /*
1207 Stoolbar_specifier_p, 1, 1, 0 /*
1208 Return non-nil if OBJECT is a toolbar specifier. 1193 Return non-nil if OBJECT is a toolbar specifier.
1209 Toolbar specifiers are used to specify the format of a toolbar. 1194 Toolbar specifiers are used to specify the format of a toolbar.
1210 The values of the variables `default-toolbar', `top-toolbar', 1195 The values of the variables `default-toolbar', `top-toolbar',
1211 `left-toolbar', `right-toolbar', and `bottom-toolbar' are always 1196 `left-toolbar', `right-toolbar', and `bottom-toolbar' are always
1212 toolbar specifiers. 1197 toolbar specifiers.
1213 1198
1214 Valid toolbar instantiators are called \"toolbar descriptors\" 1199 Valid toolbar instantiators are called \"toolbar descriptors\"
1215 and are lists of vectors. See `default-toolbar' for a description 1200 and are lists of vectors. See `default-toolbar' for a description
1216 of the exact format. 1201 of the exact format.
1217 */ ) 1202 */
1218 (object) 1203 (object))
1219 Lisp_Object object;
1220 { 1204 {
1221 return (TOOLBAR_SPECIFIERP (object) ? Qt : Qnil); 1205 return (TOOLBAR_SPECIFIERP (object) ? Qt : Qnil);
1222 } 1206 }
1223 1207
1224 1208
1326 defsymbol (&Q2d, "2d"); 1310 defsymbol (&Q2d, "2d");
1327 defsymbol (&Q3d, "3d"); 1311 defsymbol (&Q3d, "3d");
1328 defsymbol (&Q_size, ":size"); Fset (Q_size, Q_size); 1312 defsymbol (&Q_size, ":size"); Fset (Q_size, Q_size);
1329 1313
1330 defsymbol (&Qinit_toolbar_from_resources, "init-toolbar-from-resources"); 1314 defsymbol (&Qinit_toolbar_from_resources, "init-toolbar-from-resources");
1331 defsubr (&Stoolbar_button_p); 1315 DEFSUBR (Ftoolbar_button_p);
1332 defsubr (&Stoolbar_button_callback); 1316 DEFSUBR (Ftoolbar_button_callback);
1333 defsubr (&Stoolbar_button_help_string); 1317 DEFSUBR (Ftoolbar_button_help_string);
1334 defsubr (&Stoolbar_button_enabled_p); 1318 DEFSUBR (Ftoolbar_button_enabled_p);
1335 defsubr (&Sset_toolbar_button_down_flag); 1319 DEFSUBR (Fset_toolbar_button_down_flag);
1336 defsubr (&Scheck_toolbar_button_syntax); 1320 DEFSUBR (Fcheck_toolbar_button_syntax);
1337 defsubr (&Sset_default_toolbar_position); 1321 DEFSUBR (Fset_default_toolbar_position);
1338 defsubr (&Sdefault_toolbar_position); 1322 DEFSUBR (Fdefault_toolbar_position);
1339 defsubr (&Stoolbar_specifier_p); 1323 DEFSUBR (Ftoolbar_specifier_p);
1340 } 1324 }
1341 1325
1342 void 1326 void
1343 vars_of_toolbar (void) 1327 vars_of_toolbar (void)
1344 { 1328 {