*************************************************************************
* >E-Menu	Documents zaps internal menu format			*
*************************************************************************

If you are writing your own mode then you may add your own menu to appear off
the the mode menu. The current modes have a writable icon of the form 'text
width' for example.

You are asked to give an offset to a 'zap menu structure' at offset e_menu in
the mode table. This file documents the format of this structure. It is of
the form:

	#&00	Menu name (12) (zero terminated)
	#&0C	Menu width (os coords)
	#&10	Module offset of 'update menu code' (see below)
	#&14	Menu entries (x n)
		-1 to terminate list of entries
		
Each menu entry is of the form:

	#&00	Flags:	b0-b7	Menu flags as for wimp. ie,
			b0	Display tick to left of item
			b1	Dotted line follows
			b2	item writable
			b3	generate warning message (see below)
			b7	ignored
			b8-b15	Minimum buffer size for this menu entry.
				(eg writable icon).
			b16-b23	Internal use : save menu start in a memory
			b24-b31	Icon colours / 0 for default
	#&04	Submenu pointer:
		If the submenu warning bit is clear then:
			0=none
			1-15=internal use : get from memory 1-15
			>16 offset in module of submenu (same structure)
		If the submenu warning bit is set then this gives the module
		offset of the code to be called to open the submenu (see
		below).
	#&08	Index word. This is a 'handle' for this menu entry which is
		passed to the interpret code.
	#&0C	Module offset of the interpret code to call when menu 
		clicked on.
	#&10	Text for this entry (0 terminated string of any length)
	ALIGN before next entry.
	
This structure is relocatable and thus can be stored directly in your mode
extension module. When Zap is run, it converts it into a standard wimp menu
with all menu entries being indirected strings. The other values are stored
at negative offsets from the standard wimp structure:

	menu pointer
	#-4	= address of update menu sub
	
	menu entry string buffer pointer
	#-12	= sub to handle submenu creation (if warning bit set)
	#-8	= index word
	#-4	= address of the interpret code to be called when clicked on
	
The update menu sub is called when the menu is created to update the 'ticks'
etc. This is called when a menu is created/recreated. The entry/exit
conditions are:

	\E	R0=offset of this menu in previous menu
		R6=w_format value (opt_format if R8=0)
		R7=w_flags value (opt_flags if R8=0)
		R8/R9=window (or 0 if called from iconbar menu)
		R10=address of the start of the wimp menu structure
		R11<>your workspace
	\X	You may corrupt R0-R11 VS on error etc
	
The interpret code is called when the menu is clicked on. Adjust clicks etc
are handled automatically. Perform the menu action. The update code will be
called again if the menu is recreated. The entry/exit conditions are:

	\E	R0=offset in menu (=R11!-4)
		R1=index word (=R10!-8)
		R2=address of menu item start
		R3=address of previous menu item start
		R6=w_format value (opt_format if R8=0)
		R7=w_flags value (opt_flags if R8=0)
		R8/R9=window (or 0 if called from iconbar menu)
		R10=address of text for this menu item
		R11=end of list of menu offsets as returned by the wimp
	\X	You may corrupt R0-R11 VS on error etc
	
The menu warning code is called when the menu warning bit is set and zap gets
a menu warning message. It has entry/exit conditions:

	\E	R8/R9=window (or 0 if called from iconbar menu)
		R11=menu warning block as returned by the wimp
	\X	R1=pointer to submenu OR window handle of leaf window to
		be opened.

All leaf windows should be warned!
