/* e_menu.h */

#ifndef __E_MENU_H
#define __E_MENU_H

/* A E_Menu ( from now on refered to as a menu )is a popup menu style diaplyed on the 3DFX screen */
/* Each menu is made from a collection of 0 or more menu entries that describe to look of
	each entry and how it reacts to button presses */
/* Some defines to do with menus themselves */
#define E_MENU_MAX_MENUS		32
#define E_MENU_MAX_OPEN_MENUS	16
#define E_MENU_MAX_ENTRIES		64

/* describes a miscalaneous menu error */
#define E_MENU_ERROR			-1

/* Some defines that define menu messages that go to a callback*/
#define E_MENU_M_MISC				0
#define E_MENU_M_HIGHLIGHTED		1
#define E_MENU_M_SELECTED			2
#define E_MENU_M_OPENED				3
#define E_MENU_M_CLOSED				4
#define E_MENU_M_MOVED				5
#define E_MENU_M_OVERTITLE			6
#define E_MENU_M_OPENSUBMENU		7

/* Some defines to do with entry and menu flags */
#define E_MENU_I_NONE				0
#define E_MENU_I_HIGHLIGHTED		1
#define E_MENU_I_SUBMENU			2
#define E_MENU_I_ALIGN_RIGHT		4
#define E_MENU_I_GHOSTED			8
#define E_MENU_I_NO_SELECT			16
#define E_MENU_I_ALIGN_CENTER		32
#define E_MENU_I_SUBMENU_OPEN		64
#define E_MENU_I_TICKED				128
#define E_MENU_I_TICKABLE			256

/* Some menu typedefs and structures */
/* Typedefs a callback function type for the menu */
typedef 	int menu_CALLBACKFN(int menuid,int entry_id,int message);

/* Structure for an E_Menu */
typedef struct s_E_Menu {	int identifier;		/* numerical identifier */
							int num_entries;
							char *entries_textarea[E_MENU_MAX_ENTRIES+1];
							int entries_flags[E_MENU_MAX_ENTRIES+1];
							int submenu_identifier[E_MENU_MAX_ENTRIES+1];
							int submenu_opened_identifier;
							char *title;
							menu_CALLBACKFN *menu_callback;
						} *p_E_Menu;

/* Structure for an E_Menu entry describing an open menu */
typedef struct s_E_Menu_pos {	int identifier;
								int x,y;
							} *p_E_Menu_pos;


/* Function externs */
extern void Editor_SetupMenuEnvironment(void);
extern int Editor_CreateMenu(void);
extern void Editor_CloseAllMenus(void);
extern int Editor_OpenMenu(int /*menuid*/,int /*xpos*/,int /*ypos*/);
extern void Editor_MenuAttachCallBack(int /*menuid*/,menu_CALLBACKFN * /*menu_callback*/);
extern void Editor_MenuSetTitle(int /*menuid*/,char * /*text*/);
extern void Editor_MenuAttachEntry(int /*menuid*/,int /*entryid*/,char * /*text*/, int /*flags*/);
extern void Editor_MenuAttachEntryMany(int /*menuid*/,int /*entryid*/,int /*num*/,char ** /*text*/, int * /*flags*/);
extern void Editor_MenuAttachSubMenu(int /*menuid*/,int /*entryid*/,int /*submenuid*/);
extern void Editor_SetMenuBaseId(int /*menuid*/);
extern void Editor_MenuSetFlags(int /*menuid*/,int /*entryid*/,int /*flags*/);
extern int Editor_MenuGetFlags(int /*menuid*/,int /*entryid*/);

extern void Editor_DrawMenus(br_pixelmap * /*screen*/);
extern int Editor_HandleMouse(int /*mouse_x*/,int /*mouse_y*/,int /*buttons*/);
														
#endif
							