#ifndef MAKER_H
#define MAKER_H

#include <exec/types.h>
#include <intuition/intuition.h>
#include <graphics/rastport.h>
#include <libraries/gadtools.h>

typedef struct Screen			Screen;
typedef struct Menu				Menu;
typedef struct IntuiMessage	IntuiMessage;
typedef struct RastPort			RastPort;
typedef struct Gadget			Gadget;
typedef struct Window			Window;
typedef struct Message			Message;
typedef struct IntuiText		IntuiText;
typedef struct TextFont			TextFont;
typedef struct TextAttr			TextAttr;
typedef struct Remember			Remember;
typedef struct List				List;
typedef struct Node				Node;

#define	SOLID			0xffff
#define	DASH			0xf0f0

#define	MAX_TEXT_LEN	80
#define	FONT_NAME_LEN	50

#define KEYCODE_Delete			127
#define KEYCODE_BackSpace		8


enum { OTYPE_Rect, OTYPE_Line, OTYPE_Text, OTYPE_Button, OTYPE_String, OTYPE_Palette,
			OTYPE_CheckBox, OTYPE_ListView, OTYPE_Cycle, OTYPE_MX, OTYPE_Scroller,
			OTYPE_Slider, OTYPE_IText };

enum { grayPen, blackPen, whitePen, bluePen };

#define RectWidth(rect)		((rect).maxX-(rect).minX+1)
#define RectHeight(rect)	((rect).maxY-(rect).minY+1)

typedef struct
{
	USHORT	minX,
				minY,
				maxX,
				maxY;
}	Rect;

/*
typedef struct
{
	USHORT	x,
				y;
}	Point;
*/

/*		The common linked list	element		*/

#define	LINK_NODE	struct LinkNode	*next;			\
							USHORT				type;				\
							USHORT				numBytes;		\
							Rect					rect;

typedef	struct LinkNode
{
	LINK_NODE
} LinkNode;


/*
		This structure is common to all gadget-type objects
		It includes the standard LinkNode structure, plus some common gadget data
*/

#define	GADGET_OBJ		Gadget				*gadget;							\
								Gadget				*topGadget;						\
								Remember				*remKey;							\
								ULONG					flags;							\
								char					label[MAX_TEXT_LEN];			\
								USHORT				numGadget;						\
								BOOL					disable;
	
typedef	struct GadgetObj
{
	LINK_NODE
	
	GADGET_OBJ
} GadgetObj;

/*		the rectangle is not a Gadtools gadget		*/

typedef	struct RectObj
{
	LINK_NODE	
	
	USHORT				color;
} RectObj;

typedef	struct TextObj
{
	LINK_NODE
	GADGET_OBJ	
	
	BOOL					copyText;
	BOOL					border;
} TextObj;

typedef	struct ButtonObj
{
	LINK_NODE
	GADGET_OBJ	
} ButtonObj;

typedef	struct CycleObj
{
	LINK_NODE
	GADGET_OBJ	
	
	UWORD					activeItem;
	char					**textLabels;
	
	UWORD					tempValue;
} CycleObj;

typedef	struct MXObj
{
	LINK_NODE
	GADGET_OBJ	
	
	UWORD					activeItem;
	UWORD					extraSpacing;
	char					**textLabels;
} MXObj;

typedef	struct CheckBoxObj
{
	LINK_NODE
	GADGET_OBJ	
	
	BOOL						checked;
} CheckBoxObj;

typedef	struct ScrollerObj
{
	LINK_NODE
	GADGET_OBJ	
	
	WORD						topItem;
	WORD						totalItems;
	WORD						visibleItems;
	UWORD						arrowSize;
	UWORD						orientation;
	BOOL						immediateMsg;
	BOOL						releaseMsg;
} ScrollerObj;

typedef	struct SliderObj
{
	LINK_NODE
	GADGET_OBJ	
	
	WORD						minLevel;
	WORD						maxLevel;
	WORD						currentLevel;
	UWORD						maxChars;
	char						format[MAX_TEXT_LEN];
	UWORD						levelPlace;
	UWORD						orientation;
	BOOL						immediateMsg;
	BOOL						releaseMsg;
} SliderObj;

typedef	struct StringObj
{
	LINK_NODE
	GADGET_OBJ	
	
	UWORD					maxChars;
	char					theChars[MAX_TEXT_LEN];
} StringObj;

typedef	struct PaletteObj
{
	LINK_NODE
	GADGET_OBJ	
	
	UBYTE					firstColor;
	UBYTE					colorOffset;
	UWORD					depth;
	UWORD					indicatorWidth;
	UWORD					indicatorHeight;
} PaletteObj;

typedef	struct ListViewObj
{
	LINK_NODE
	GADGET_OBJ	
	
	StringObj				*stringObj;
	List						itemList;
	
	UWORD						topItem;
	BOOL						readOnly;
	UWORD						scrollWidth;
	UWORD						selectedItem;
	UWORD						extraSpacing;
	UWORD						tempStringID;
} ListViewObj;

typedef	struct ITextObj
{
	LINK_NODE
	
	IntuiText			iText;
	char					label[MAX_TEXT_LEN];
	TextAttr				textAttr;
	char					fontName[FONT_NAME_LEN];
} ITextObj;

typedef struct
{
	ULONG		seconds,
				micros;
} TimeStamp;

#endif 	/*	MAKER_H	*/

