#ifndef INTUITION_INTUITION_H
#define INTUITION_INTUITION_H

/*******************************************************************
 pOS / Amiga adapt
*******************************************************************/

#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif

#ifndef __INC_POS_PSCREEN_WINDOW_H
#include <pScreen/Window.h>
#endif
#ifndef __INC_POS_PINTUI_MENU_H
#include <pIntui/Menu.h>
#endif
#ifndef __INC_POS_PGADGET_GADGET_H
#include <pGadget/Gadget.h>
#endif
#ifndef __INC_POS_PGADGET_PROPGAD_H
#include <pGadget/PropGad.h>
#endif
#ifndef __INC_POS_PGADGET_STRGAD_H
#include <pGadget/StrGad.h>
#endif
#ifndef __INC_POS_PINTUI_INTUMSG_H
#include <pIntui/IntuMsg.h>
#endif
#ifndef __INC_POS_PLAYER_RECT_H
#include <pLayer/Rect.h>
#endif
#ifndef __INC_POS_PSCREEN_SCRTAGS_H
#include <pScreen/ScrTags.h>
#endif
#ifndef __INC_POS_PINTUI_EASYREQ_H
#include <pIntui/EasyReq.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_INPUTEVENT_H
#include <devices/inputevent.h>
#endif
#ifndef UTILITY_TAGITEM_H
#include <utility/tagitem.h>
#endif
#ifndef INTUITION_SCREENS_H
#include <intuition/screens.h>
#endif
#ifndef INTUITION_PREFERENCES_H
#include <intuition/preferences.h>
#endif


struct xx_Menu_xx
{
  struct Node          mi_Node;
  SWORD                LeftEdge;
  SWORD                TopEdge;
  UWORD                Width;
  UWORD                Height;
  ULONG                Flags;
  ULONG                mi_UserData[2];
  struct pOS_IntuiObj *mi_Render;
  struct pOS_IntuiObj *mi_Select;
  struct List          mi_MembList;
  struct MenuItem     *mi_Parent;
  ULONG                MutualExclude;
  UWORD                NextSelect;
/* ... */
};



struct MenuItem
{
  struct Node          mi_Node;
  SWORD                LeftEdge;
  SWORD                TopEdge;
  UWORD                Width;
  UWORD                Height;
  ULONG                Flags;
  ULONG                mi_UserData[2];
  struct pOS_IntuiObj *ItemFill;
  struct pOS_IntuiObj *SelectFill;
  struct List          mi_MembList;
  struct MenuItem     *mi_Parent;
  ULONG                MutualExclude;
  UWORD                NextSelect;
/* ... */
};


#define CHECKIT         MENUITF_Hook
#define MENUTOGGLE      MENUITF_Toggle
#define CHECKED         MENUITF_IsChecked




struct Gadget
{
  union {
    struct MinNode  gad_Node;
    struct Gadget  *NextGadget;
  } U;

  SWORD         LeftEdge;
  SWORD         TopEdge;
  SWORD         Width;
  SWORD         Height;

  ULONG         Flags;
  ULONG         GadgetID;
  ULONG         UserData[2];

  APTR GadgetRender;
  APTR SelectRender;
  APTR GadgetText;

  ULONG         Activation;
  ULONG         GadgetType;
  APTR          SpecialInfo;
/* ... */
};

/******** only amigagad.library/amigagad.class *******/
#define GFLG_GADGHIGHBITS 0x0003
#define GFLG_GADGHCOMP    0x0000
#define GFLG_GADGHBOX     0x0001
#define GFLG_GADGHIMAGE   0x0002
#define GFLG_GADGHNONE    0x0003
#define GFLG_GADGIMAGE    0x0004
/************************************************/

#define GFLG_RELBOTTOM    GFLG_RelBottom
#define GFLG_RELRIGHT     GFLG_RelRight
#define GFLG_RELWIDTH     GFLG_RelWidth
#define GFLG_RELHEIGHT    GFLG_RelHeight
#define GFLG_SELECTED     GFLG_Selected
#define GFLG_DISABLED     GFLG_Disabled
#define GFLG_TABCYCLE     GFLG_TabCycle
#define GFLG_IMAGEDISABLE GFLG_PrivateDisable

#define GACT_RELVERIFY    GACT_RelVerify
#define GACT_IMMEDIATE    GACT_Immediate
#define GACT_FOLLOWMOUSE  GACT_FollowMouse
#define GACT_RIGHTBORDER  GACT_RightBorder
#define GACT_LEFTBORDER   GACT_LeftBorder
#define GACT_TOPBORDER    GACT_TopBorder
#define GACT_BOTTOMBORDER GACT_BottomBorder
#define GACT_BORDERSNIFF  GACT_BorderSniff
#define GACT_TOGGLESELECT GACT_ToggleSelect
#define GACT_STRINGLEFT   GACT_StringLeft
#define GACT_STRINGCENTER GACT_StringCenter
#define GACT_STRINGRIGHT  GACT_StringRight
#define GACT_LONGINT      GACT_LongInt
#define GACT_ACTIVEGADGET GACT_ActiveGadget


#define GTYP_GADGETTYPE GTYP_GadgetType

#define GTYP_SCRGADGET          GTYP_ScrGadget
#define GTYP_GZZGADGET          GTYP_GZZGadget

#define GTYP_SYSGADGET          GTYP_SysGadget
#define GTYP_SYSTYPEMASK        GTYP_SysTypeMask

#define GTYP_SIZING             GTYP_Sizing
#define GTYP_WDRAGGING          GTYP_WDragging
#define GTYP_SDRAGGING          GTYP_SDragging
#define GTYP_WDEPTH             GTYP_WDepth
#define GTYP_SDEPTH             GTYP_SDepth
#define GTYP_WZOOM              GTYP_WZoom
#define GTYP_CLOSE              GTYP_Close

#define GTYP_GTYPEMASK          GTYP_GTypeMask

#define GTYP_BOOLGADGET         GTYP_BoolGadget
#define GTYP_GADGET0002         GTYP_Gadget0002
#define GTYP_PROPGADGET         GTYP_PropGadget
#define GTYP_STRGADGET          GTYP_StrGadget
#define GTYP_CUSTOMGADGET       GTYP_CustomGadget


struct PropInfo
{
  UWORD Flags;

  UWORD HorizPot;
  UWORD VertPot;

  UWORD HorizBody;
  UWORD VertBody;

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



#define FREEHORIZ       PRGADF_FreeHoriz
#define FREEVERT        PRGADF_FreeVert
#define KNOBHIT         PRGADF_KnobHit

#define MAXBODY         0xffff
#define MAXPOT          0xffff


struct StringInfo
{
  CHAR          *Buffer;
  CHAR          *UndoBuffer;
  UWORD          BufferPos;
  UWORD          MaxChars;
  UWORD          DispPos;
  UWORD          UndoPos;
  UWORD          NumChars;
  SLONG          LongInt;
  struct KeyMap *AltKeyMap;
};


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


struct Image
{
  SWORD   LeftEdge;
  SWORD   TopEdge;
  UWORD   Width;
  UWORD   Height;
  UWORD   Depth;
  UWORD  *ImageData;
  UBYTE   PlanePick, PlaneOnOff;
  struct Image *NextImage;
};


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


struct IntuiMessage
{
  struct Message ExecMessage;
  ULONG          Class;
  ULONG          Code;
  UWORD          Qualifier;
  APTR           IAddress;
  SLONG MouseX, MouseY;
  ULONG Seconds,Micros;
  struct Window  *IDCMPWindow;
};

#define IDCMP_SIZEVERIFY        IDCMP_SizeVerify
#define IDCMP_NEWSIZE           IDCMP_NewSize
#define IDCMP_REFRESHWINDOW     IDCMP_RefreshWindow
#define IDCMP_MOUSEBUTTONS      IDCMP_MouseButtons
#define IDCMP_MOUSEMOVE         IDCMP_MouseMove
#define IDCMP_GADGETDOWN        IDCMP_GadgetDown
#define IDCMP_GADGETUP          IDCMP_GadgetUp
#define IDCMP_MENUPICK          IDCMP_MenuPick
#define IDCMP_CLOSEWINDOW       IDCMP_CloseWindow
#define IDCMP_RAWKEY            IDCMP_RawKey
#define IDCMP_MENUVERIFY        IDCMP_MenuVerify
#define IDCMP_DISKINSERTED      IDCMP_DiskInserted
#define IDCMP_DISKREMOVED       IDCMP_DiskRemoved
#define IDCMP_ACTIVEWINDOW      IDCMP_ActiveWindow
#define IDCMP_INACTIVEWINDOW    IDCMP_InactiveWindow
#define IDCMP_VANILLAKEY        IDCMP_VanillaKey
#define IDCMP_INTUITICKS        IDCMP_IntuiTicks
#define IDCMP_CHANGEWINDOW      IDCMP_ChangeWindow



struct IBox
{
  SWORD Left,Top;
  SWORD Width,Height;
};

struct NewWindow
{
  WORD LeftEdge, TopEdge;
  WORD Width, Height;
  UBYTE DetailPen, BlockPen;
  ULONG IDCMPFlags;
  ULONG Flags;
  struct Gadget *FirstGadget;
  struct Image *CheckMark;
  UBYTE *Title;
  struct Screen *Screen;
  struct BitMap *BitMap;
  WORD MinWidth, MinHeight;
  UWORD MaxWidth, MaxHeight;
  UWORD Type;
};


struct Window
{
  struct Node      win_Node;
  SLONG            LeftEdge;
  SLONG            TopEdge;
  ULONG            Width;
  ULONG            Height;
  SLONG            MouseX;
  SLONG            MouseY;
  CHAR            *Title;
  struct RastPort *RPort;
  UBYTE            win_Reserved1[32];
  SBYTE           *UserData;
  ULONG            UserData1;
  SLONG            GZZMouseX;
  SLONG            GZZMouseY;
  ULONG            GZZWidth;
  ULONG            GZZHeight;
  struct MinList   win_GadList;
  ULONG            MinWidth,MinHeight;
  ULONG            MaxWidth,MaxHeight;
  ULONG            Flags;
  UBYTE            win_MorFlags[16];
  UBYTE BorderTop,BorderLeft,BorderRight,BorderBottom;
  CHAR            *ScreenTitle;
  struct Screen   *WScreen;
  struct Layer    *WLayer;
  struct TextFont *IFont;
  struct MsgPort  *UserPort;
  ULONG            IDCMPFlags;

  UBYTE                  win_MorIDCMP[16];
  struct Rectangle       win_ZipRect;
  struct RastPort       *win_BorderRPort;
  struct Layer          *win_BorderLayer;
  struct pOS_ExList      win_Private;

  struct pOS_IClassInfo *win_ICI;
  UBYTE                  win_BackfillColor;
  UBYTE                  win_Pad1;
  SWORD                  win_BfScrollX;
  SWORD                  win_BfScrollY;
  struct Menu           *MenuStrip;

/* ... */
};


#define WFLG_SIZEGADGET     WINFLGF_SizeGadget
#define WFLG_DRAGBAR        WINFLGF_Dragbar
#define WFLG_DEPTHGADGET    WINFLGF_DepthGadget
#define WFLG_CLOSEGADGET    WINFLGF_CloseGadget
#define WFLG_SIZEBRIGHT     WINFLGF_SizeBRight
#define WFLG_SIZEBBOTTOM    WINFLGF_SizeBBottom
#define WFLG_REFRESHBITS    WINFLGF_RefreshBits
#define WFLG_SMART_REFRESH  WINFLGF_SmartRefresh
#define WFLG_SIMPLE_REFRESH WINFLGF_SimpleRefresh
#define WFLG_SUPER_BITMAP   WINFLGF_SuperBitmap
#define WFLG_OTHER_REFRESH  WINFLGF_OtherRefresh
#define WFLG_BACKDROP       WINFLGF_Backdrop
#define WFLG_REPORTMOUSE    WINFLGF_ReportMouse
#define WFLG_GIMMEZEROZERO  WINFLGF_GimmeZeroZero
#define WFLG_BORDERLESS     WINFLGF_Borderless
#define WFLG_ACTIVATE       WINFLGF_Activate
#define WFLG_RMBTRAP        WINFLGF_RMBTrap
#define WFLG_NOCAREREFRESH  WINFLGF_NoCareRefresh

#define DEFAULTMOUSEQUEUE       (3)

#define WFLG_WINDOWACTIVE   WINFLGF_Activate


#define WA_Left                 SCRTAG_LeftEdge
#define WA_Top                  SCRTAG_TopEdge
#define WA_Width                SCRTAG_Width
#define WA_Height               SCRTAG_Height
#define WA_DetailPen             _PxA_IGNORE
#define WA_BlockPen              _PxA_IGNORE
#define WA_IDCMP                SCRTAG_IDCMP
#define WA_Flags                SCRTAG_Flags
#define WA_Gadgets              SCRTAG_Gadget
#define WA_Checkmark             _PxA_IGNORE
#define WA_Title                SCRTAG_Title
#define WA_ScreenTitle          SCRTAG_ScreenTitle
#define WA_CustomScreen         SCRTAG_Screen
#define WA_SuperBitMap          SCRTAG_SuperGfxMap
#define WA_MinWidth             SCRTAG_MinWidth
#define WA_MinHeight            SCRTAG_MinHeight
#define WA_MaxWidth             SCRTAG_MaxWidth
#define WA_MaxHeight            SCRTAG_MaxHeight
#define WA_InnerWidth           SCRTAG_InnerWidth
#define WA_InnerHeight          SCRTAG_InnerHeight

#define WA_PubScreenName        SCRTAG_PubName
#define WA_PubScreen            SCRTAG_Screen
#define WA_PubScreenFallBack     _PxA_IGNORE
#define WA_Colors                _PxA_IGNORE
#define WA_Zoom                 SCRTAGF_Zoom
#define WA_MouseQueue            _PxA_IGNORE
#define WA_BackFill              _PxA_IGNORE
#define WA_RptQueue              _PxA_IGNORE

#define WA_SizeGadget           SCRTAGF_SizeGadget
#define WA_DragBar              SCRTAGF_DragBar
#define WA_DepthGadget          SCRTAGF_DepthGadget
#define WA_CloseGadget          SCRTAGF_CloseGadget
#define WA_Backdrop             SCRTAGF_Backdrop
#define WA_ReportMouse           _PxA_IGNORE
#define WA_NoCareRefresh        SCRTAGF_NoCareRefresh
#define WA_Borderless           SCRTAGF_Borderless
#define WA_Activate             SCRTAGF_Activate
#define WA_RMBTrap               _PxA_IGNORE
#define WA_SmartRefresh          _PxA_IGNORE
#define WA_SizeBRight           SCRTAGF_SizeBRight
#define WA_SizeBBottom          SCRTAGF_SizeBBottom
#define WA_SimpleRefresh        SCRTAGF_SimpleRefresh
#define WA_AutoAdjust           SCRTAG_AutoAdjust
#define WA_GimmeZeroZero        SCRTAGF_GimmeZeroZero
#define WA_NewLookMenus         TAG_IGNORE
#define WA_MenuHelp              _PxA_IGNORE
#define WA_Pointer               _PxA_IGNORE
#define WA_BusyPointer           _PxA_IGNORE
#define WA_PointerDelay          _PxA_IGNORE
#define WA_AmigaKey              _PxA_IGNORE
#define WA_NotifyDepth           _PxA_IGNORE
#define WA_TabletMessages        _PxA_IGNORE
#define WA_HelpGroup             _PxA_IGNORE
#define WA_HelpGroupWindow       _PxA_IGNORE



struct EasyStruct
{
  UWORD        es_StructSize;
  ULONG        es_Flags;
  CHAR        *es_Title;
  CHAR        *es_TextFormat;
  CHAR        *es_GadgetFormat;
  CHAR        *es_HelpID;
  CHAR        *es_HelpFile;
  struct TagItem *es_Tags;
};



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






/* = MACROS ============================================================== */


#define MENUNUM(n) ((ULONG)  (n) >> 24         )
#define ITEMNUM(n) ((ULONG) ((n) >> 16) & 0xff )
#define SUBNUM(n)  ((ULONG) ((n) >>  8) & 0xff )

#define SHIFTMENU(n) ( (n) << 24)
#define SHIFTITEM(n) ( (n) << 16)
#define SHIFTSUB(n)  ( (n) <<  8)


#define FULLMENUNUM( menu, item, sub )  \
        ( SHIFTSUB(sub) | SHIFTITEM(item) | SHIFTMENU(menu) )

#define NOMENU 0x00FF
#define NOITEM 0x00FF
#define NOSUB  0x00FF
#define MENUNULL 0xffFFFF

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

#define ALERT_TYPE      0x80000000
#define RECOVERY_ALERT  0x00000000
#define DEADEND_ALERT   0x80000000

#define AUTOFRONTPEN    0
#define AUTOBACKPEN     1
#define AUTODRAWMODE    JAM2
#define AUTOLEFTEDGE    6
#define AUTOTOPEDGE     3
#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 MIDDLEUP        (IECODE_MBUTTON | IECODE_UP_PREFIX)
#define MIDDLEDOWN      (IECODE_MBUTTON)
#define ALTLEFT         (IEQUALIFIER_LALT)
#define ALTRIGHT        (IEQUALIFIER_RALT)
#define AMIGALEFT       (IEQUALIFIER_LCOMMAND)
#define AMIGARIGHT      (IEQUALIFIER_RCOMMAND)
#define AMIGAKEYS       (AMIGALEFT | AMIGARIGHT)

#define CURSORUP        0x4C
#define CURSORLEFT      0x4F
#define CURSORRIGHT     0x4E
#define CURSORDOWN      0x4D
#define KEYCODE_Q       0x10
#define KEYCODE_Z       0x31
#define KEYCODE_X       0x32
#define KEYCODE_V       0x34
#define KEYCODE_B       0x35
#define KEYCODE_N       0x36
#define KEYCODE_M       0x37
#define KEYCODE_LESS    0x38
#define KEYCODE_GREATER 0x39




#ifdef __IGNORE_NOT_SUPPORTED__

#define IDCMP_IDCMPUPDATE       0x80008000 /* dummy */
#define IDCMP_GADGETHELP        0x90008000 /* dummy */
#define IDCMP_REQVERIFY         0xa0008000 /* dummy */
#define IDCMP_REQCLEAR          0xb0008000 /* dummy */
#define IDCMP_NEWPREFS          0xc0008000 /* dummy */
#define IDCMP_MENUHELP          0xd0008000 /* dummy */


#define IDCMP_GETTAGITEM(msg) \
 ( (struct TagItem*) ((struct pOS_IntuiMessage*)msg)->im_Data )



#define MENUENABLED 0
#define MIDRAWN     0
#define COMMSEQ     0
#define ITEMENABLED 0
#define ITEMTEXT    0
#define HIGHFLAGS  0
#define HIGHIMAGE  0
#define HIGHCOMP   0
#define HIGHBOX    0
#define HIGHNONE   0

#define GFLG_RELSPECIAL 0
#define GFLG_LABELMASK  0
#define GFLG_LABELITEXT 0
#define GFLG_LABELSTRING 0
#define GFLG_LABELIMAGE  0
#define GFLG_STRINGEXTEND 0
#define GFLG_EXTENDED     0
#define GACT_ENDGADGET    0
#define GACT_BOOLEXTEND   0
#define GACT_ALTKEYMAP    0
#define GACT_STRINGEXTEND 0
#define GMORE_BOUNDS       0
#define GMORE_GADGETHELP   0
#define GMORE_SCROLLRASTER 0

#define AUTOKNOB        0
#define PROPNEWLOOK     0

#define CWCODE_MOVESIZE 0
#define CWCODE_DEPTH    0
#define MENUHOT         0
#define MENUCANCEL      0
#define MENUWAITING     0
#define OKOK            0
#define OKABORT         0
#define OKCANCEL        0

#define WFLG_NW_EXTENDED 0
#define WFLG_INREQUEST      0
#define WFLG_MENUSTATE      0
#define WFLG_WINDOWREFRESH  0
#define WFLG_WBENCHWINDOW   0
#define WFLG_WINDOWTICKED   0
#define WFLG_VISITOR        0
#define WFLG_ZOOMED         0
#define WFLG_HASZOOM        0




struct ColorSpec
{
  WORD  ColorIndex;
  UWORD Red;
  UWORD Green;
  UWORD Blue;
};













#endif /** __IGNORE_NOT_SUPPORTED__ **/








#ifndef INTUITION_IOBSOLETE_H
#include <intuition/iobsolete.h>
#endif

#endif
