#ifndef LIBRARIES_GTDRAG_H
#define LIBRARIES_GTDRAG_H 1
/*
**  $VER: gtdrag.h 1.6 (6.11.96)
**  Includes Release 2.1
**
**  Drag&Drop with GadTools
**
**  (C) Copyright 1996 Axel Dörfler
**      All rights Reserved
*/

#include <exec/nodes.h>
#include <utility/hooks.h>

/* The ImageNode structure is used to have both text and images in a listview.
 * A render hook for this type is provided (in future releases). It is not a must!
 */

struct ImageNode
{
  struct Node *in_Succ;
  struct Node *in_Pred;
  UBYTE  in_Type;
  BYTE   in_Pri;
  STRPTR in_Name;
  struct Image *in_Image;
};

/* The DragGadget structure manages the gadgets which support dragging.
 * Remember that these fields are read-only!
 */

#define DGF_IMAGES 1       /* Images only, if possible */
#define DGF_NODRAG 2       /* can't be the source of a drag */
#define DGF_SAME 4         /* icon can be dragged over the same gadget */

struct DragGadget
{
  struct MinNode dg_Node;
  struct Gadget *dg_Gadget;
  struct Window *dg_Window;
  struct Task *dg_Task;       /* pointer to the owner task */
  struct List *dg_List;
  struct Hook *dg_Render;
  ULONG  dg_Type;
  ULONG  dg_Mask,dg_AcceptMask;
  WORD   dg_ItemHeight;
  WORD   dg_Width;
  WORD   dg_Height;
  UWORD  dg_Flags;
};

/* You receive the DragMsg structure if someone has dragged an item.
 * And again, all fields are read-only!
 */

#define DMT_GADGET 1    /* target is a window */
#define DMT_WINDOW 2    /* target is a gadget */
#define DMT_UNKNOWN 4   /* target doesn't support drag&drop */

struct DragMsg
{
  struct MinNode dm_Node;
  ULONG  dm_Type;
  struct ImageNode *dm_Object;  /* dragged object */
  struct DragGadget *dm_Source;
  STRPTR dm_SourceApp;          /* owner Name or NULL for your own */
  APTR   dm_Target;             /* pointer to a DragGadget or Window */
  LONG   dm_SourceEntry;        /* the list position of the entry */
  LONG   dm_TargetEntry;        /* dto. - may be higher than the number of entries */
  LONG   dm_X,dm_Y;             /* exact co-ordinates */
};

/* The flags for the IDCMP-MsgPort of your Window */

#define DRAGIDCMP (LISTVIEWIDCMP | IDCMP_MOUSEBUTTONS)

/* Tags to pass to GTD_AddGadget() */

#define GTDA_TagBase    (TAG_USER + 0x90000)
#define GTDA_ItemHeight GTDA_TagBase + 1      /* height of a listview entry */
#define GTDA_RenderHook GTDA_TagBase + 2      /* render hook for listview */
#define GTDA_Images     GTDA_TagBase + 3      /* drags only images (listview MUST contain ImageNodes) */
#define GTDA_Width      GTDA_TagBase + 4      /* width of icon (only for GTDA_RenderHook & GTDA_Images) */
#define GTDA_Height     GTDA_TagBase + 5      /* height of a icon ("") */
#define GTDA_NoDrag     GTDA_TagBase + 6      /* do not drag from this gadget */
#define GTDA_Object     GTDA_TagBase + 7      /* drag node from a non-listview */
#define GTDA_Same       GTDA_TagBase + 8      /* set DGF_SAME */
#define GTDA_Mask       GTDA_TagBase + 9      /* mask value */
#define GTDA_AcceptMask GTDA_TagBase + 10     /* accept mask value */

/* Tags to pass to GTD_AddApp() */

#define GTDA_InternalOnly  GTDA_TagBase + 42   /* drags only internally */

#endif
