#ifndef POPUP_MENU_H
#define POPUP_MENU_H

#include <stdio.h>
#include <graphics/display.h>
#include <graphics/gfxmacros.h>
#include <intuition/intuition.h>

/* The following constants are the font characteristics of topaz eight :
 * If you want a different font, you'll have to open it in the Init_MenuPackage
 * and set these constants to the appropriate values.
 */
#define FONT_HEIGHT   8   /* pixel height of an average character */
#define FONT_WIDTH    8   /* pixel width of an average character */
#define FONT_BASELINE 6   /* relative pixel location of character baseline */

#define MAX(a,b) ((a > b) ? a : b)

#define NOITEM_SELECTED 0  /* returned from PopUp if no item was selected */
#define OUTSIDE_WINDOW -1  /* returned from PopUp if cursor outside of window */

struct PopUp_Item {
   char *text;		         /* text string to be displayed */
   SHORT selection_id;	         /* id returned when this item is selected */
   SHORT left, top;              /* top/left offset within menu */
   SHORT height,width;           /* desired height/width of selection box */
   UBYTE color;                  /* desired text color (= color register) */
   struct PopUp_Item *next;      /* link to next menu item */
};

struct PopUp_Menu {
   SHORT depth;                     /* number of bit-planes to use */
   SHORT left,top, height;          /* used internally */
   SHORT width;  	            /* desired width of menu */
   USHORT deactivate;               /* what MOUSEBUTTON deactives the menu */
   UBYTE outline_color, area_color; /* color registers */
   struct ClipRect cr;              /* clipping rectangle for display */
   struct RastPort rp;              /* raster port for drawing into menu area */
   struct BitMap bitmap;            /* actual bitmap for rendering the menu */
   struct PopUp_Item *first_item;   /* first in list of menu items */
   struct PopUp_Item *active_item;  /* for internal use only */
};

#define Inside_Window(x,y,w)(((x)>0)&&((x)<(w)->Width)&&((y)>0)&&((y)<(w)->Height))
#endif
