#ifndef __INC_POS_PGADGET_GADGET_H
#define __INC_POS_PGADGET_GADGET_H
/*******************************************************************
 Includes Release 24
 (C) Copyright 1995-1997 proDAD
     All Rights Reserved

 $AUT Holger Burkarth
 $DAT >>Gadget.h<<   04 Mar 1997    15:07:15 - (C) ProDAD
*******************************************************************/
#ifndef __INC_POS_PEXEC_LIST_H
#include <pExec/List.h>
#endif


/*----------------------------------
-----------------------------------*/
struct pOS_Gadget
{
  struct pOS_Node        gad_Node;

  SWORD                  gad_LeftEdge;
  SWORD                  gad_TopEdge;
  SWORD                  gad_Width;
  SWORD                  gad_Height;

  ULONG                  gad_Flags;       /* (enum pOS_GadgetFlags) */
  ULONG                  gad_ID;          /* user-definable ID field */
  ULONG                  gad_UserData[2];

  struct pOS_IntuiObj   *gad_Render;
  struct pOS_IntuiObj   *gad_Select;

/*---------------------------------------------*/

  struct pOS_IntuiObj   *gad_Lable;

  ULONG                  gad_Activation;  /* (enum pOS_GadgetActivate) */
  ULONG                  gad_Type;        /* (enum pOS_GadgetTypes) */
  APTR                   gad_SpecialInfo;
  struct pOS_Layer      *gad_Layer;
  APTR                   gad_Target;
  const struct pOS_TagItem *gad_Map;
  struct pOS_Gadget     *gad_Parent;
  const CHAR            *gad_HelpID;

  struct pOS_Callback   *gad_Callback;
  UBYTE                  gad_ShortKey;
  UBYTE                  gad_BorTop,gad_BorLeft,gad_BorRight,gad_BorBottom;
  UBYTE                  gad_Gwk;        /* Layout-Gewicht */
  UBYTE                  gad_LableLay;    /* (enum pOS_IObjectClassLayout) */
  UBYTE                  gad_RenderLay;   /* (enum pOS_IObjectClassLayout) */
  UBYTE                  gad_MutualExclude;
  UWORD                  gad_BorderType;  /* (enum pOS_GadgetBorderTypes) */
  UWORD                  gad_LableWidth;  /* wird vom Gadget autom. berechnet */
  UWORD                  gad_LableHeight;
  struct pOS_GadgetDrop *gad_Drop;        /* Gadget-Drop-Extend */
  struct pOS_GadgetDrag *gad_Drag;        /* Gadget-Drag-Extend */

  UBYTE gad_Reserved[16-4];
};




enum pOS_GadgetFlags /* gad_Flags */
{
/*\
*** Ist GFLG_NoSelect==1 gesetzt und GACT_ToggleSelect==0, dann wird beim Anklicken
*** ein optionales IDCMP_GadgetDown gesendet (GACT_Immediate==1). Das Gadget wird
*** aber nicht GFLG_Selected==1 und wird auch nicht neugezeichnet.
\*/
  GFLG_NoSelect=         0x00000004,    /* Gadget wird nie wirklich selektiert */
  GFLG_RelBottom=        0x00000008,    /* vert. pos. is relative to bottom edge */
  GFLG_RelRight=         0x00000010,    /* horiz. pos. is relative to right edge */
  GFLG_RelWidth=         0x00000020,    /* width is relative to req/window    */
  GFLG_RelHeight=        0x00000040,    /* height is relative to req/window   */

  GFLG_Selected=         0x00000080,    /* Gadget ist selektiert */
  GFLG_Disabled=         0x00000100,    /* Gadget ist gesperrt */
  GFLG_TabCycle=         0x00000200,
  GFLG_DropSelected=     0x00000400,    /* Ein Drag-Objekt steht zur Zeit im Gadget.
                                        ** Das Flag wird von pIntui gesetzt und ist
                                        ** für Applikationen und Gadgets (const) readonly.
                                        */

  GFLG_PrivateDisable=   0x00000800,    /* Beim Sperren vom Gadget (GFLG_Disabled) zeichnet
                                        ** pIntui kein Raster, sondern das Gadget muß
                                        ** ein eigenes Disable verwenden.
                                        ** !! nur für Gadgets modifizierbar !!
                                        */

  GFLG_OSLable=          0x00001000,    /* Lable ist außerhalb der Gadget-Box */
  GFLG_Alternate=        0x00002000,    /* Gadget muß erneuert werden  */
  GFLG_FixSize=          0x00004000,    /* das Gadget muß genau mit den GetIBox-Größen bedient werden */

  GFLG_UseMthAddRem=     0x00010000,    /* es werden GCLMTH_Add/GCLMTH_Rem gesendet */
  GFLG_UseMthLayout=     0x00020000,    /* GCLMTH_Layout wird gesendet */
  GFLG_IgnoreIE=         0x00040000,    /* Input-Events ignorieren */
  GFLG_HighlightDropBox= 0x00080000,    /* der GadgetBorder wird bei Drop hervorgehoben */
  GFLG_StdCallback=      0x00100000,    /* gad_Callback wird als Standard-Callback berachtet */
  GFLG_StdTargetMap=     0x00200000,    /* gad_Target und gad_Map wird im Standard-Modus bearbeitet */
  GFLG_HighlightFocus=   0x00400000     /* Gadget-Focus wird grafisch angezeigt */
};








enum pOS_GadgetActivate /* gad_Activation */
{
  GACT_RelVerify=       0x0001,
  GACT_Immediate=       0x0002,
  GACT_UpdateGadget=    0x0004, /* UpdateGadget erzeugen */

  GACT_RightBorder=     0x0010,
  GACT_LeftBorder=      0x0020,
  GACT_TopBorder=       0x0040,
  GACT_BottomBorder=    0x0080,

  GACT_ToggleSelect=    0x0100,  /* */

  GACT_StringLeft=      0x0000,  /* */
  GACT_StringCenter=    0x0200,
  GACT_StringRight=     0x0400,
  GACT_LongInt=         0x0800,  /* */

  GACT_ActiveGadget=    0x4000,
  GACT_AnimateGadget=   0x8000, /* Gadget wird mit GCLMTHRE_TickFrame versorgt */


  GACT_AnyBorderFlag =GACT_RightBorder | GACT_LeftBorder |
                      GACT_TopBorder | GACT_BottomBorder,

  GACT_StandardDrop=    0x00010000, /* */
  GACT_StandardDrag=    0x00020000, /* */
  GACT_FixFocus=        0x00040000, /* der Eingabefocus kann nicht mit pOS_ActivateGadget() entzogen werden */
  GACT_FetchFocus=      0x00080000  /* nach GadgetUp bleibt der Fokus auf dem Gadget */
};



enum pOS_GadgetTypes /* gad_Type */
{
  GTYP_GadgetType=           0xFC00,  /* all Gadget Global Type flags (padded) */

  GTYP_ScrGadget=            0x4000,  /* 1 = ScreenGadget, 0 = WindowGadget */
  GTYP_GZZGadget=            0x2000,  /* 1 = for WFLG_GIMMEZEROZERO borders */

  GTYP_SysGadget=            0x8000,
  GTYP_SysTypeMask=          0x00F0,

  GTYP_Sizing=               0x0010,  /* Window sizing gadget */
  GTYP_WDragging=            0x0020,  /* Window drag bar */
  GTYP_SDragging=            0x0030,  /* Screen drag bar */
  GTYP_WDepth=               0x0040,  /* Window depth gadget */
  GTYP_SDepth=               0x0050,  /* Screen depth gadget */
  GTYP_WZoom=                0x0060,  /* Window zoom gadget */
  GTYP_Close=                0x0080,  /* Window close gadget */

  GTYP_GTypeMask=            0x0007,

  GTYP_BoolGadget=           0x0001,
  GTYP_PropGadget=           0x0003,
  GTYP_StrGadget=            0x0004,
  GTYP_CustomGadget=         0x0005,



  GTYP_Reentrant=         0x00010000,   /* Gadget wird ohne pOS_LockIntuiGadget()
                                        ** bedient. Dem Gadget ist es freigestellt
                                        ** pOS_LockIntuiGadget() aufzurufen.
                                        */


  GTYP_GShortKeyMask=     0x03000000,
  GTYP_KeyNone=           0x00000000,  /* ShortKey => no action */
  GTYP_KeyActivate=       0x01000000,  /* ShortKey => Activate-Gadget */
  GTYP_KeySelect=         0x02000000,  /* ShortKey => Select-Gadget */
  GTYP_KeyActSelect=      0x03000000,  /* ShortKey => Activate+Select-Gadget */

  GTYP_KeyRETURN=         0x04000000,  /* is the gadget active, RETURN is the same as click */



  GTYP_DbInWindow=        0x40000000    /* Internal - Debug */
};


/** pOS_DrawBorderBox() **/
enum pOS_GadgetBorderTypes /** gad_BorderType **/   /* ICLTAG_GadBorderType */
{
  GADBORTYP_None=0,
  GADBORTYP_BlkBox,             /* Black-Box */
  GADBORTYP_BevelUpBox,         /* 3D/hochgestellt */
  GADBORTYP_BevelDownBox,       /* 3D/tiefgestellt */
  GADBORTYP_RBevelUpBox,        /* 3D/hochgestellt/rund */
  GADBORTYP_RBevelDownBox,      /* 3D/tiefgestellt/rund */
  GADBORTYP_BevelBox,           /* 3D/hoch-/tiefgestellt */
  GADBORTYP_HfBevelUpBox,       /* 3D/hochgestellt (halbhell) */
  GADBORTYP_HfBevelDownBox,     /* 3D/tiefgestellt (halbhell) */
  GADBORTYP_HfRBevelUpBox,      /* 3D/hochgestellt/rund (halbhell) */
  GADBORTYP_HfRBevelDownBox,    /* 3D/tiefgestellt/rund (halbhell) */
  GADBORTYP_XBox,               /* verzahnte Box für Gruppen-Rahmen */
  GADBORTYP_ZBox,               /* Black-White-Black für Boxen mit weißem Inhalt */
  GADBORTYP_Bevel1UpBox,        /* wie GADBORTYP_BevelUpBox, aber mit 1Pixel Luft */
  GADBORTYP_Bevel1DownBox,      /* wie GADBORTYP_BevelDownBox, aber mit 1Pixel Luft */
  GADBORTYP_StrBox,
  GADBORTYP_RBevelBox,          /* 3D/hoch-/tiefgestellt/rund */

  GADBORTYP_TypMask = 0x00ff,

  GADBORF_BlkOverBorder = 0x0100, /* ... plus Black-Border */
  GADBORF_BgOverBorder  = 0x0200  /* ... plus Background-Border */

};





/** pOS_CalcGadInner(win,gad,rect,flags) **/
enum pOS_CalcGadInnerFlags
{
  CALCGADINF_None       = 0x00, /* nothing ;-) */
  CALCGADINF_CalcGadBox = 0x01, /* call pOS_CalcGadgetBox() */
  CALCGADINF_Relativ    = 0x02, /* 'rect' relativ to Min (Max-=Min; Min=0) */
  CALCGADINF_Border     = 0x04, /* add Border (inner gadget region) */
  CALCGADINF_Lable      = 0x08, /* sub Lable-Size */
  CALCGADINF_Absolut    = 0x10, /* (~CALCGADINF_Relativ) */
  CALCGADINF_NegBorder  = 0x20, /* sub Border (~CALCGADINF_Border) */
  CALCGADINF_NegLable   = 0x40  /* add Lable-Size (~CALCGADINF_Lable) */
};





#endif
