aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2008-06-08 04:37:01 +0000
committerChong Yidong2008-06-08 04:37:01 +0000
commitfc0bdb33300620e5ce20b1feec99fa42c38ac34f (patch)
treee0e269bda02e6ae348cf1e3a95113e6420f63714
parentbf73263819e922f0b7a4b8783663111f749e87ae (diff)
downloademacs-fc0bdb33300620e5ce20b1feec99fa42c38ac34f.tar.gz
emacs-fc0bdb33300620e5ce20b1feec99fa42c38ac34f.zip
Relocate platform-independent menu definitions from xmenu.c.
-rw-r--r--src/keyboard.h85
1 files changed, 82 insertions, 3 deletions
diff --git a/src/keyboard.h b/src/keyboard.h
index 15edb36f958..6f18e37b948 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#include "systime.h" /* for EMACS_TIME */ 20#include "systime.h" /* for EMACS_TIME */
21#include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */
21 22
22/* Length of echobuf field in each KBOARD. */ 23/* Length of echobuf field in each KBOARD. */
23 24
@@ -194,9 +195,6 @@ extern KBOARD the_only_kboard;
194#define single_kboard 1 195#define single_kboard 1
195#endif 196#endif
196 197
197extern Lisp_Object Vlucid_menu_bar_dirty_flag;
198extern Lisp_Object Qrecompute_lucid_menubar, Qactivate_menubar_hook;
199
200/* Total number of times read_char has returned. */ 198/* Total number of times read_char has returned. */
201extern int num_input_events; 199extern int num_input_events;
202 200
@@ -220,6 +218,11 @@ extern int this_command_key_count;
220 generated by the next character. */ 218 generated by the next character. */
221extern Lisp_Object internal_last_event_frame; 219extern Lisp_Object internal_last_event_frame;
222 220
221/* Menu items. */
222
223extern Lisp_Object Vlucid_menu_bar_dirty_flag;
224extern Lisp_Object Qrecompute_lucid_menubar, Qactivate_menubar_hook;
225
223/* This holds a Lisp vector that holds the properties of a single 226/* This holds a Lisp vector that holds the properties of a single
224 menu item while decoding it in parse_menu_item. 227 menu item while decoding it in parse_menu_item.
225 Using a Lisp vector to hold this information while we decode it 228 Using a Lisp vector to hold this information while we decode it
@@ -249,6 +252,82 @@ extern Lisp_Object item_properties;
249/* Last property. */ 252/* Last property. */
250/* Not nil if item is enabled. */ 253/* Not nil if item is enabled. */
251#define ITEM_PROPERTY_ENABLE 8 254#define ITEM_PROPERTY_ENABLE 8
255
256#ifdef HAVE_X_WINDOWS
257
258/* This holds a Lisp vector that holds the results of decoding
259 the keymaps or alist-of-alists that specify a menu.
260
261 It describes the panes and items within the panes.
262
263 Each pane is described by 3 elements in the vector:
264 t, the pane name, the pane's prefix key.
265 Then follow the pane's items, with 5 elements per item:
266 the item string, the enable flag, the item's value,
267 the definition, and the equivalent keyboard key's description string.
268
269 In some cases, multiple levels of menus may be described.
270 A single vector slot containing nil indicates the start of a submenu.
271 A single vector slot containing lambda indicates the end of a submenu.
272 The submenu follows a menu item which is the way to reach the submenu.
273
274 A single vector slot containing quote indicates that the
275 following items should appear on the right of a dialog box.
276
277 Using a Lisp vector to hold this information while we decode it
278 takes care of protecting all the data from GC. */
279extern Lisp_Object menu_items;
280
281/* If non-nil, means that the global vars defined here are already in use.
282 Used to detect cases where we try to re-enter this non-reentrant code. */
283extern Lisp_Object menu_items_inuse;
284
285/* Number of slots currently allocated in menu_items. */
286extern int menu_items_allocated;
287
288/* This is the index in menu_items of the first empty slot. */
289extern int menu_items_used;
290
291/* The number of panes currently recorded in menu_items,
292 excluding those within submenus. */
293extern int menu_items_n_panes;
294
295#define MENU_ITEMS_PANE_NAME 1
296#define MENU_ITEMS_PANE_PREFIX 2
297#define MENU_ITEMS_PANE_LENGTH 3
298
299enum menu_item_idx
300{
301 MENU_ITEMS_ITEM_NAME = 0,
302 MENU_ITEMS_ITEM_ENABLE,
303 MENU_ITEMS_ITEM_VALUE,
304 MENU_ITEMS_ITEM_EQUIV_KEY,
305 MENU_ITEMS_ITEM_DEFINITION,
306 MENU_ITEMS_ITEM_TYPE,
307 MENU_ITEMS_ITEM_SELECTED,
308 MENU_ITEMS_ITEM_HELP,
309 MENU_ITEMS_ITEM_LENGTH
310};
311
312extern Lisp_Object unuse_menu_items P_ ((Lisp_Object dummy));
313
314/* This is how to deal with multibyte text if HAVE_MULTILINGUAL_MENU
315 isn't defined. The use of HAVE_MULTILINGUAL_MENU could probably be
316 confined to an extended version of this with sections of code below
317 using it unconditionally. */
318#ifdef HAVE_X_WINDOWS
319#ifdef USE_GTK
320/* gtk just uses utf-8. */
321# define ENCODE_MENU_STRING(str) ENCODE_UTF_8 (str)
322#elif defined HAVE_X_I18N
323#define ENCODE_MENU_STRING(str) ENCODE_SYSTEM (str)
324#else
325#define ENCODE_MENU_STRING(str) string_make_unibyte (str)
326#endif /* USE_GTK */
327#elif defined (HAVE_NTGUI)
328#define ENCODE_MENU_STRING(str) (str)
329#endif
330#endif /* HAVE_X_WINDOWS */
252 331
253/* Macros for dealing with lispy events. */ 332/* Macros for dealing with lispy events. */
254 333