/*
 * menuDefs.h
 *
 * [Generated from menuDefs, 25 September 1996]
 */

#if !defined(__CC_NORCROFT) || !defined(__arm)
  #error You must use the Norcroft ARM Compiler for Sapphire programs
#endif

#pragma include_only_once
#pragma force_top_level

#ifndef __menuDefs_h
#define __menuDefs_h

#ifndef __sapphire_h
  #include "sapphire.h"
#endif

/*----- Overview ----------------------------------------------------------*
 *
 * Macros provided:
 *
 *   BITSPEC
 *   SETBIT
 *   NEWITEM
 *   MENU
 *   MENUI
 *   TEAROFF
 *   TEAROFFI
 *   R12DATA
 *   MAKEME
 *   MHEIGHT
 *   GLOBALM
 *   ITEM
 *   ITEWI
 *   SHADE
 *   ISHADE
 *   SWITCH
 *   RADIO
 *   SPRITE
 *   HALFSZ
 *   SUBWARN
 *   SUBMENU
 *   NOWARN
 *   RULEOFF
 *   MENUEND
 */

/*----- Constants for menus -----------------------------------------------*
 *
 * In the descriptions of flags below, the data required in the packed menu
 * definition is shown in the comments.  Insert items in the order of the
 * bit precedences of the flags.
 *
 * Note -- a (*) following a description means the flag is only supported by
 * tms (the tearoff system), and a (+) means that the flag is only supported
 * by menu (the WIMP system).
 */

/* --- Flags for menu titles and items --- */

#define mFlag_indirect ((1<<0))

#define mFlag_R12 ((1<<16))

#define mFlag_noTrans ((1<<19))

/* --- Menu title flags --- */

#define mFlag_tearoff ((1<<1))

#define mFlag_makeMe ((1<<2))

#define mFlag_maxHeight ((1<<3))

#define mFlag_global ((1<<4))

/* --- Menu item flags --- */

#define mFlag_shortCut ((1<<1))

#define mFlag_iShortCut ((1<<2))

#define mFlag_shade ((1<<3))

#define mFlag_invShade ((1<<4))

#define mFlag_switch ((1<<5))

#define mFlag_radio ((1<<6))

#define mFlag_sprite ((1<<7))

#define mFlag_halfSize ((1<<8))

#define mFlag_subWarn ((1<<9))

#define mFlag_subMenu ((1<<10))

#define mFlag_noWarn ((1<<17))

#define mFlag_ruleOff ((1<<18))

#define mFlag_end ((1<<31))

/* --- Event codes --- *
 *
 * Event codes are returned in R0, with R1 being the item number within
 * the packed menu definition, indexed from 0.
 *
 * Note: mEvent_deleted is only sent to the topmost menu title by the
 * standard menu system, but is sent to the titles of all menus being closed
 * by TMS.  If you are converting from one to the other, bear this in mind.
 */

#define mEvent_select (0)

#define mEvent_subMenu (1)

#define mEvent_deleted (2)

#define mEvent_help (3)

/*----- Menu creation macros ----------------------------------------------*/

/* --- Note to reader --- *
 *
 * These macros make a lot of use of private constants and variables.  Try to
 * avoid examining these too closely, because you'll probably get lost.
 */

/* --- Set up the variables --- */

/* --- Macro: BITSPEC --- *
 *
 * Arguments:	offset == offset into workspace of target word
 *		bit == bitmask with a 1 in the position of the bit
 *
 * Use:		Assembles a bit specification referencing the described bit.
 *		The bit is described by a mask word rather than a bit
 *		position, because it is expected that you will already have
 *		set up constants for bit masks.
 */

/* --- Macro: SETBIT --- *
 *
 * Arguments:	flag == which menu flag above to set
 *
 * Use:		Sets a bit within the current item or menu title's flags
 *		word.  It ensures that items are inserted in the correct
 *		order.
 */

/* --- Macro: NEWITEM --- *
 *
 * Arguments:	--
 *
 * Use:		Starts a new menu item or menu title.  It also inserts a new
 *		flags word in the current position.
 */

/* --- Macro: MENU --- *
 *
 * Arguments:	title == the menu's title string/message tag
 *
 * Use:		Creates a nonindirected menu title and starts a new menu.
 */

/* --- Macro: MENUI --- *
 *
 * Arguments:	title == offset to title pointer in client's workspace
 *
 * Use:		Creates an indirected menu title and starts a new menu.
 */

/* --- Macro: TEAROFF --- *
 *
 * Arguments:	title == menu's title string/message tag
 *
 * Use:		Creates a nonindirected tearoff menu title and starts a new
 *		menu.
 */

/* --- Macro: TEARI --- *
 *
 * Arguments:	title == offset to title pointer in client's workspace
 *
 * Use:		Creates an indirected tearoff menu title and starts a new
 *		menu.
 */

/* --- Macro: R12DATA --- *
 *
 * Arguments:	--
 *
 * Use:		Sets the current menu item or menu title to use the client's
 *		R12 pointer rather than its R10 pointer for workspace.
 */

/* --- Macro: NOTRANS --- *
 *
 * Arguments:	--
 *
 * Use:		Disables message translation of the current item or menu
 *		title.  This is useful if you're building the item or title
 *		text dynamically.
 */

/* --- Macro: MAKEME --- *
 *
 * Arguments:	makeProc == pointer to procedure which will remake the menu
 *
 * Use:		Sets the current menu to require being remade from scratch
 *		when being updated (e.g. after an item is selected).
 */

/* --- Macro: MHEIGHT --- *
 *
 * Arguments:	height == maximum permitted height for menu in OS units
 *
 * Use:		Sets the menu's maximum allowable height.
 */

/* --- Macro: GLOBALM --- *
 *
 * Arguments:	--
 *
 * Use:		Sets the menu's maximum allowable height.
 */

/* --- Macro: ITEM --- *
 *
 * Arguments:	text == item's text string/message tag
 *
 * Use:		Creates a new nonindirected menu item.
 */

/* --- Macro: ITEMI --- *
 *
 * Arguments:	text == offset of pointer to menu text
 *
 * Use:		Creates a new indirected menu item
 */

/* --- Macro: SHADE --- *
 *
 * Arguments:	$offset,$bit == bitspec of item's `shaded' bit
 *
 * Use:		Sets the current item to be shadable.
 */

/* --- Macro: ISHADE --- *
 *
 * Arguments:	offset,$bit == bitspec of item's `unshaded' bit
 *
 * Use:		Sets the current item to be inverse shadable.
 */

/* --- Macro: SWITCH --- *
 *
 * Arguments:	offset,$bit == bitspec of item's `ticked' bit
 *
 * Use:		Sets the current item to be tickable.
 */

/* --- Macro: RADIO --- *
 *
 * Arguments:	group == offset of this item's radio group selector
 *		selector == value of selector to blob this item
 *
 * Use:		Marks this item as a radio item, so that it is blobbed (or
 *		ticked under the WIMP menu system) when the selector in the
 *		client's workspace matches the item's selector.
 */

/* --- Macro: SPRITE --- *
 *
 * Arguments:	sprite == EITHER address of validation string, OR offset of
 *		  sprite name pointer (if area argument given)
 *		area == (optional) sprite area, or -1 for resspr_area
 *
 * Use:		Adds a sprite to the menu item definition.
 */

/* --- Macro: HALFSZ --- *
 *
 * Arguments:	--
 *
 * Use:		Sets the item to display its sprite at half size
 */

/* --- Macro: SUBWARN --- *
 *
 * Arguments:	--
 *
 * Use:		Sets the item to generate submenu warnings when its submenu
 *		arrow is pointed at.
 */

/* --- Macro: SUBMENU --- *
 *
 * Arguments:	subMenu == pointer to packed definition of the submenu
 *		handler == pointer to handler routine
 *
 * Use:		Attaches the given menu as a submenu of this item.
 */

/* --- Macro: NOWARN --- *
 *
 * Arguments:	--
 *
 * Use:		Prevents this item from returning submenu events if it is
 *		shaded.
 */

/* --- Macro: RULEOFF --- *
 *
 * Arguments:	--
 *
 * Use:		Inserts a ruleoff after the current item, assuming there are
 *		some more items after it.
 */

/* --- Macro: MENUEND --- *
 *
 * Arguments:	--
 *
 * Use:		Finishes off the current menu.
 */

/*----- That's all, folks -------------------------------------------------*/

#endif
