/****************************************************************
/*								*
/*	HackBench - Part 1 of 4 - hb.h - Definitions		*
/*								*
/*	Copyright (C) 1987 by Bill Kinnersley			*
/*	CS Dept, Washington State Univ, Pullman, WA 99164	*
/*								*
/*	Permission granted to redistribute this program		*
/*	provided the copyright notice remains intact.		*
/*	May not be used as part of any commercial product.	*
/*								*
/****************************************************************/

#include <stdio.h>
#include <exec/memory.h>
#include <exec/alerts.h>
#include <workbench/workbench.h>
#include <workbench/startup.h>
#include <intuition/intuitionbase.h>
#include <libraries/dosextens.h>
#include <functions.h>
#include <clib/macros.h>

#define BLACK_FILL  (ITEMTEXT | HIGHCOMP)
#define MN(m,i) ((long)(SHIFTMENU(m)|SHIFTITEM(i)|SHIFTSUB(0x1f)) & 0xffffL)
#define MEMF_CPC    (MEMF_CHIP | MEMF_PUBLIC | MEMF_CLEAR)
#define ALLOC(st)   (struct st *)AllocMem((long)sizeof(struct st), MEMF_CPC)
#define SHIFT	    (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT)
#define OBJ(nd,of) ((struct MyWBObject *)((long)(nd)-of*sizeof(struct Node)))

struct MyDrawerData {
	struct NewWindow dd_NewWindow;
	LONG dd_CurrentX, dd_CurrentY, dd_MinX, dd_MinY, dd_MaxX, dd_MaxY;
	struct Gadget dd_HorizScroll, dd_VertScroll,
		dd_UpMove, dd_DownMove, dd_LeftMove, dd_RightMove;
	struct Image dd_HorizImage, dd_VertImage;
	struct PropInfo dd_HorizProp, dd_VertProp;
	struct Window *dd_DrawerWin;
	struct List dd_Children;	/* Must be initialized */
	BPTR dd_Lock;
};

struct MyWBObject {
	struct Node wo_MasterNode, wo_Siblings,
		wo_SelectNode, wo_UtilityNode;
	struct MyWBObject *wo_Parent;
	UBYTE wo_Flags;
	char *wo_Name;
	SHORT wo_NameXOffset, wo_NameYOffset;
	struct FreeList wo_FreeList;	/* Must be initialized */
	struct Window *wo_IconWin;
	BPTR wo_Lock;
	struct Gadget wo_Gadget;
	UBYTE wo_Type;
	char *wo_DefaultTool, **wo_ToolTypes;
	LONG wo_CurrentX, wo_CurrentY;
	struct MyDrawerData *wo_DrawerData;
	char *wo_ToolWindow;
	LONG wo_StackSize;
};

/* Gadget ID's */
#define GID_WBOBJECT       0L
#define GID_HORIZSCROLL    1L
#define GID_VERTSCROLL     2L
#define GID_LEFTSCROLL     3L
#define GID_RIGHTSCROLL    4L
#define GID_UPSCROLL       5L
#define GID_DOWNSCROLL     6L
#define GID_NAME           7L

/* Menu Items */
#define OPEN	MN(0,0)
#define CLOZE	MN(0,1)
#define DUP	MN(0,2)
#define RENAME	MN(0,3)
#define INFO	MN(0,4)
#define DISCARD	MN(0,5)

#define EMPTY	MN(1,0)
#define INIT	MN(1,1)

#define CLEANUP	MN(2,0)
#define ERROR	MN(2,1)
#define REDRAW	MN(2,2)
#define SNAP	MN(2,3)
#define VERS	MN(2,4)

#define TRACE	MN(3,0)
#define WBOBJS	MN(3,1)
#define SELOBJS	MN(3,2)
#define UTILOBJS MN(3,3)
#define CHILDREN MN(3,4)
#define QUIT	MN(3,5)

/* Offsets for Object Lists */
#define MAST 0L
#define CHILD 1L
#define SEL 2L
#define UTIL 3L

/* Object Flags */
#define NORM 0
#define HIGH 1
#define RESIZE 2
#define TEMPLOCK 4

/* Window top border */
#define YOFF 10L

