#ifndef INTUITION_INTUITION_H
#define INTUITION_INTUITION_H TRUE

#ifndef INTUITION_INTUITIONBASE_H
#include "intuition/intuitionbase.h"
#endif

#ifndef GRAPHICS_GFX_H
#include "graphics/gfx.h"
#endif

#ifndef GRAPHICS_CLIP_H
#include "graphics/clip.h"
#endif

#ifndef GRAPHICS_VIEW_H
#include "graphics/view.h"
#endif

#ifndef GRAPHICS_RASTPORT_H
#include "graphics/rastport.h"
#endif

#ifndef GRAPHICS_LAYERS_H
#include "graphics/layers.h"
#endif

#ifndef GRAPHICS_TEXT_H
#include "graphics/text.h"
#endif

#ifndef EXEC_PORTS_H
#include "exec/ports.h"
#endif

#ifndef DEVICES_TIMER_H
#include "devices/timer.h"
#endif

#ifndef DEVICES_INPUTEVENT_H
#include "devices/inputevent.h"
#endif

struct   Menu
{
   struct   Menu *NextMenu;
   SHORT    LeftEdge, TopEdge;
   SHORT    Width, Height;
   USHORT   Flags;
   BYTE    *MenuName;
   struct   MenuItem *FirstItem;


   SHORT    JazzX, JazzY, BeatX, BeatY;
};

#define MENUENABLED  0x0001L

#define MIDRAWN      0x0100L


struct   MenuItem
{
   struct   MenuItem *NextItem;
   SHORT    LeftEdge, TopEdge;
   SHORT    Width, Height;
   USHORT   Flags;

   LONG     MutualExclude;
   APTR     ItemFill;


   APTR     SelectFill;

   BYTE     Command;

   struct   MenuItem *SubItem;


   USHORT   NextSelect;
};


#define CHECKIT      0x0001L
#define ITEMTEXT     0x0002L
#define COMMSEQ      0x0004L
#define MENUTOGGLE   0x0008L
#define ITEMENABLED  0x0010L


#define HIGHFLAGS    0x00C0L
#define HIGHIMAGE    0x0000L
#define HIGHCOMP     0x0040L
#define HIGHBOX      0x0080L
#define HIGHNONE     0x00C0L


#define CHECKED      0x0100L


#define ISDRAWN      0x1000L
#define HIGHITEM     0x2000L
#define MENUTOGGLED  0x4000L






struct   Requester
{

   struct   Requester *OlderRequest;
   SHORT    LeftEdge, TopEdge;
   SHORT    Width, Height;
   SHORT    RelLeft, RelTop;

   struct   Gadget *ReqGadget;
   struct   Border *ReqBorder;
   struct   IntuiText *ReqText;
   USHORT   Flags;


    UBYTE   BackFill;

   struct   Layer *ReqLayer;

    UBYTE   ReqPad1[32];


   struct   BitMap *ImageBMap;
   struct   Window *RWindow;
    UBYTE ReqPad2[36];
};

#define POINTREL    0x0001L
#define PREDRAWN    0x0002L

#define REQOFFWINDOW 0x1000L
#define REQACTIVE    0x2000L
#define SYSREQUEST   0x4000L
#define DEFERREFRESH 0x8000L


struct   Gadget
{
   struct   Gadget *NextGadget;

   SHORT    LeftEdge, TopEdge;
   SHORT    Width, Height;

   USHORT   Flags;

   USHORT   Activation;

   USHORT   GadgetType;


   APTR     GadgetRender;


   APTR     SelectRender;

   struct   IntuiText *GadgetText;


   LONG     MutualExclude;


   APTR     SpecialInfo;

   USHORT   GadgetID;
   APTR     UserData;
};

#define GADGHIGHBITS    0x0003L
#define GADGHCOMP       0x0000L
#define GADGHBOX        0x0001L
#define GADGHIMAGE      0x0002L
#define GADGHNONE       0x0003L

#define GADGIMAGE       0x0004L

#define GRELBOTTOM      0x0008L
#define GRELRIGHT       0x0010L

#define GRELWIDTH       0x0020L

#define GRELHEIGHT      0x0040L

#define SELECTED        0x0080L

#define GADGDISABLED    0x0100L

#define RELVERIFY       0x0001L

#define GADGIMMEDIATE   0x0002L

#define ENDGADGET       0x0004L

#define FOLLOWMOUSE     0x0008L

#define RIGHTBORDER     0x0010L
#define LEFTBORDER      0x0020L
#define TOPBORDER       0x0040L
#define BOTTOMBORDER    0x0080L

#define TOGGLESELECT    0x0100L

#define STRINGCENTER    0x0200L
#define STRINGRIGHT     0x0400L

#define LONGINT         0x0800L

#define ALTKEYMAP       0x1000L

#define GADGETTYPE      0xFC00L
#define SYSGADGET       0x8000L
#define SCRGADGET       0x4000L
#define GZZGADGET       0x2000L
#define REQGADGET       0x1000L

#define SIZING          0x0010L
#define WDRAGGING       0x0020L
#define SDRAGGING       0x0030L
#define WUPFRONT        0x0040L
#define SUPFRONT        0x0050L
#define WDOWNBACK       0x0060L
#define SDOWNBACK       0x0070L
#define CLOSE           0x0080L

#define BOOLGADGET      0x0001L
#define GADGET0002      0x0002L
#define PROPGADGET      0x0003L
#define STRGADGET       0x0004L


struct   PropInfo
{
   USHORT   Flags;


   USHORT   HorizPot;
   USHORT   VertPot;


   USHORT   HorizBody;
   USHORT   VertBody;


   USHORT   CWidth;
   USHORT   CHeight;
   USHORT   HPotRes, VPotRes;
   USHORT   LeftBorder;
   USHORT   TopBorder;
};

#define AUTOKNOB        0x0001L
#define FREEHORIZ       0x0002L
#define FREEVERT        0x0004L
#define PROPBORDERLESS  0x0008L
#define KNOBHIT         0x0100L

#define KNOBHMIN  6L
#define KNOBVMIN  4L
#define MAXBODY         0xFFFFL
#define MAXPOT          0xFFFFL


struct   StringInfo
{

   UBYTE    *Buffer;
   UBYTE    *UndoBuffer;
   SHORT    BufferPos;
   SHORT    MaxChars;
   SHORT    DispPos;


   SHORT    UndoPos;
   SHORT    NumChars;
   SHORT    DispCount;
   SHORT    CLeft, CTop;
   struct   Layer *LayerPtr;


   LONG     LongInt;


   struct   KeyMap *AltKeyMap;
};


struct   IntuiText
{
   UBYTE    FrontPen, BackPen;
   UBYTE    DrawMode;
   SHORT    LeftEdge;
   SHORT    TopEdge;
   struct   TextAttr *ITextFont;
   UBYTE    *IText;
   struct   IntuiText *NextText;
};


struct   Border
{
   SHORT    LeftEdge, TopEdge;
   UBYTE    FrontPen, BackPen;
   UBYTE    DrawMode;
   BYTE    Count;
   SHORT    *XY;
   struct   Border *NextBorder;
};


struct   Image
{
   SHORT    LeftEdge;
   SHORT    TopEdge;
   SHORT    Width;
   SHORT    Height, Depth;
   USHORT   *ImageData;


   UBYTE    PlanePick, PlaneOnOff;


   struct   Image *NextImage;
};


struct   IntuiMessage
{
   struct   Message ExecMessage;


   ULONG    Class;


   USHORT   Code;


   USHORT   Qualifier;


   APTR     IAddress;


   SHORT    MouseX, MouseY;


   ULONG    Seconds, Micros;


   struct   Window *IDCMPWindow;


   struct   IntuiMessage *SpecialLink;
};

#define SIZEVERIFY         0x00000001L
#define NEWSIZE            0x00000002L
#define REFRESHWINDOW      0x00000004L
#define MOUSEBUTTONS       0x00000008L
#define MOUSEMOVE          0x00000010L
#define GADGETDOWN         0x00000020L
#define GADGETUP           0x00000040L
#define REQSET             0x00000080L
#define MENUPICK           0x00000100L
#define CLOSEWINDOW        0x00000200L
#define RAWKEY             0x00000400L
#define REQVERIFY          0x00000800L
#define REQCLEAR           0x00001000L
#define MENUVERIFY         0x00002000L
#define NEWPREFS           0x00004000L
#define DISKINSERTED       0x00008000L
#define DISKREMOVED        0x00010000
#define WBENCHMESSAGE      0x00020000
#define ACTIVEWINDOW       0x00040000
#define INACTIVEWINDOW     0x00080000
#define DELTAMOVE          0x00100000
#define VANILLAKEY         0x00200000
#define INTUITICKS         0x00400000

#define LONELYMESSAGE      0x80000000

#define MENUHOT      0x0001L
#define MENUCANCEL   0x0002L
#define MENUWAITING  0x0003L

#define WBENCHOPEN   0x0001L
#define WBENCHCLOSE  0x0002L

struct   Window
{
   struct   Window *NextWindow;

   SHORT    LeftEdge, TopEdge;
   SHORT    Width, Height;

   SHORT    MouseY, MouseX;

   SHORT    MinWidth, MinHeight;
   SHORT    MaxWidth, MaxHeight;

   ULONG    Flags;

   struct   Menu *MenuStrip;

   UBYTE    *Title;

   struct   Requester *FirstRequest;

   struct   Requester *DMRequest;

   SHORT    ReqCount;

   struct   Screen *WScreen;
   struct   RastPort *RPort;


   BYTE    BorderLeft, BorderTop, BorderRight, BorderBottom;
   struct   RastPort *BorderRPort;


   struct   Gadget *FirstGadget;


   struct   Window *Parent, *Descendant;


   USHORT  *Pointer;
   BYTE    PtrHeight;
   BYTE    PtrWidth;
   BYTE    XOffset, YOffset;


   ULONG    IDCMPFlags;
   struct   MsgPort *UserPort, *WindowPort;
   struct   IntuiMessage *MessageKey;

   UBYTE    DetailPen, BlockPen;


   struct   Image *CheckMark;

   UBYTE    *ScreenTitle;


   SHORT    GZZMouseX;
   SHORT    GZZMouseY;

   SHORT    GZZWidth;
   SHORT    GZZHeight;

   UBYTE    *ExtData;

   BYTE     *UserData;


   struct   Layer *WLayer;
};

#define WINDOWSIZING    0x0001L
#define WINDOWDRAG      0x0002L
#define WINDOWDEPTH     0x0004L
#define WINDOWCLOSE     0x0008L

#define SIZEBRIGHT      0x0010L
#define SIZEBBOTTOM     0x0020L

#define REFRESHBITS     0x00C0L
#define SMART_REFRESH   0x0000L
#define SIMPLE_REFRESH  0x0040L
#define SUPER_BITMAP    0x0080L
#define OTHER_REFRESH   0x00C0L

#define BACKDROP        0x0100L

#define REPORTMOUSE     0x0200L

#define GIMMEZEROZERO   0x0400L

#define BORDERLESS      0x0800L

#define ACTIVATE        0x1000L

#define WINDOWACTIVE     0x2000L
#define INREQUEST        0x4000L
#define MENUSTATE        0x8000L

#define RMBTRAP         0x00010000L
#define NOCAREREFRESH   0x00020000L

#define WINDOWREFRESH   0x01000000L
#define WBENCHWINDOW    0x02000000L
#define WINDOWTICKED    0x04000000L

#define SUPER_UNUSED    0xFCFC0000L


struct   NewWindow
{
   SHORT    LeftEdge, TopEdge;
   SHORT    Width, Height;

   UBYTE    DetailPen, BlockPen;

   ULONG    IDCMPFlags;

   ULONG    Flags;


   struct   Gadget *FirstGadget;


   struct   Image *CheckMark;

   UBYTE    *Title;


   struct   Screen *Screen;


   struct   BitMap *BitMap;


   SHORT    MinWidth, MinHeight;
   SHORT    MaxWidth, MaxHeight;


   USHORT   Type;
};


struct   Screen
{
   struct   Screen *NextScreen;
   struct   Window *FirstWindow;

   SHORT    LeftEdge, TopEdge;
   SHORT    Width, Height;

   SHORT    MouseY, MouseX;

   USHORT   Flags;

   UBYTE    *Title;
   UBYTE    *DefaultTitle;


   BYTE    BarHeight, BarVBorder, BarHBorder, MenuVBorder, MenuHBorder;
   BYTE    WBorTop, WBorLeft, WBorRight, WBorBottom;

   struct   TextAttr *Font;


   struct   ViewPort ViewPort;
   struct   RastPort RastPort;
   struct   BitMap BitMap;
   struct   Layer_Info LayerInfo;


   struct   Gadget *FirstGadget;

   UBYTE    DetailPen, BlockPen;


   USHORT   SaveColor0;


   struct   Layer *BarLayer;

   UBYTE    *ExtData;

   UBYTE    *UserData;
};

#define SCREENTYPE   0x000FL

#define WBENCHSCREEN 0x0001L
#define CUSTOMSCREEN 0x000FL

#define SHOWTITLE    0x0010L

#define BEEPING      0x0020L

#define CUSTOMBITMAP 0x0040L

struct   NewScreen
{
   SHORT    LeftEdge, TopEdge, Width, Height, Depth;

   UBYTE    DetailPen, BlockPen;

   USHORT   ViewModes;

   USHORT   Type;

   struct   TextAttr *Font;

   UBYTE    *DefaultTitle;

   struct   Gadget *Gadgets;


   struct   BitMap *CustomBitMap;
};


#define  FILENAME_SIZE  30L

#define  POINTERSIZE (1 + 16 + 1) * 2L

#define TOPAZ_EIGHTY 8L
#define TOPAZ_SIXTY 9L

struct   Preferences
{

   BYTE    FontHeight;


   UBYTE    PrinterPort;


   USHORT   BaudRate;


   struct   timeval KeyRptSpeed;
   struct   timeval KeyRptDelay;
   struct   timeval DoubleClick;


   USHORT   PointerMatrix[POINTERSIZE];
   BYTE    XOffset;
   BYTE    YOffset;
   USHORT   color17;
   USHORT   color18;
   USHORT   color19;
   USHORT   PointerTicks;


   USHORT   color0;
   USHORT   color1;
   USHORT   color2;
   USHORT   color3;


   BYTE    ViewXOffset;
   BYTE    ViewYOffset;
    WORD ViewInitX, ViewInitY;

    BOOL EnableCLI;


   USHORT   PrinterType;
   UBYTE    PrinterFilename[FILENAME_SIZE];


   USHORT   PrintPitch;
   USHORT   PrintQuality;
   USHORT   PrintSpacing;
    UWORD PrintLeftMargin;
    UWORD PrintRightMargin;
   USHORT   PrintImage;
   USHORT   PrintAspect;
   USHORT   PrintShade;
    WORD PrintThreshold;


   USHORT   PaperSize;
    UWORD PaperLength;
   USHORT   PaperType;

   BYTE    padding[50];
};

#define PARALLEL_PRINTER 0x00L
#define SERIAL_PRINTER  0x01L

#define BAUD_110     0x00L
#define BAUD_300     0x01L
#define BAUD_1200    0x02L
#define BAUD_2400    0x03L
#define BAUD_4800    0x04L
#define BAUD_9600    0x05L
#define BAUD_19200   0x06L
#define BAUD_MIDI    0x07L

#define FANFOLD      0x00L
#define SINGLE       0x80L

#define PICA         0x000L
#define ELITE        0x400L
#define FINE         0x800L

#define DRAFT        0x000L
#define LETTER       0x100L

#define SIX_LPI      0x000L
#define EIGHT_LPI    0x200L

#define IMAGE_POSITIVE  0x00L
#define IMAGE_NEGATIVE  0x01L

#define ASPECT_HORIZ 0x00L
#define ASPECT_VERT  0x01L

#define SHADE_BW        0x00L
#define SHADE_GREYSCALE 0x01L
#define SHADE_COLOR     0x02L

#define US_LETTER    0x00L
#define US_LEGAL     0x10L
#define N_TRACTOR    0x20L
#define W_TRACTOR    0x30L
#define CUSTOM       0x40L

#define CUSTOM_NAME     0x00L
#define  ALPHA_P_101    0x01L
#define BROTHER_15XL    0x02L
#define CBM_MPS1000     0x03L
#define DIAB_630        0x04L
#define DIAB_ADV_D25    0x05L
#define DIAB_C_150      0x06L
#define EPSON           0x07L
#define EPSON_JX_80     0x08L
#define OKIMATE_20      0x09L
#define QUME_LP_20      0x0AL

#define HP_LASERJET     0x0BL
#define HP_LASERJET_PLUS   0x0CL


struct   Remember
{
   struct   Remember *NextRemember;
   ULONG    RememberSize;
   UBYTE    *Memory;
};


#define MENUNUM(n)   ((long)n & 0x1F)
#define ITEMNUM(n)   (((long)n >> 5) & 0x003F)
#define SUBNUM(n)    (((long)n >> 11) & 0x001F)

#define SHIFTMENU(n) ((long)n & 0x1F)
#define SHIFTITEM(n) (((long)n & 0x3F) << 5)
#define SHIFTSUB(n)  (((long)n & 0x1F) << 11)

#define NOMENU       0x001FL
#define NOITEM       0x003FL
#define NOSUB        0x001FL
#define MENUNULL     0xFFFFL

#define FOREVER for(;;)
#define SIGN(x) ( ((x) > 0) - ((x) < 0) )
#define NOT !

#define CHECKWIDTH      19L
#define COMMWIDTH       27L
#define LOWCHECKWIDTH   13L
#define LOWCOMMWIDTH    16L

#define ALERT_TYPE      0x80000000L
#define RECOVERY_ALERT  0x00000000L
#define DEADEND_ALERT   0x80000000L

#define AUTOFRONTPEN    0L
#define AUTOBACKPEN     1L
#define AUTODRAWMODE    JAM2
#define AUTOLEFTEDGE    6L
#define AUTOTOPEDGE     3L
#define AUTOITEXTFONT   NULL
#define AUTONEXTTEXT    NULL

#define SELECTUP        (IECODE_LBUTTON | IECODE_UP_PREFIX)
#define SELECTDOWN      (IECODE_LBUTTON)
#define MENUUP          (IECODE_RBUTTON | IECODE_UP_PREFIX)
#define MENUDOWN        (IECODE_RBUTTON)
#define ALTLEFT         (IEQUALIFIER_LALT)
#define ALTRIGHT        (IEQUALIFIER_RALT)
#define AMIGALEFT       (IEQUALIFIER_LCOMMAND)
#define AMIGARIGHT      (IEQUALIFIER_RCOMMAND)
#define AMIGAKEYS       (AMIGALEFT | AMIGARIGHT)

#define CURSORUP        0x4CL
#define CURSORLEFT      0x4FL
#define CURSORRIGHT     0x4EL
#define CURSORDOWN      0x4DL
#define KEYCODE_Q       0x10L
#define KEYCODE_X       0x32L
#define KEYCODE_N       0x36L
#define KEYCODE_M       0x37L

#endif
