#ifndef INTUITION_GADGETCLASS_H
#define INTUITION_GADGETCLASS_H 1
/*
**  $Filename: intuition/gadgetclass.h $
**  $Release: 2.0 release 1 $
**  $Revision: 1.11 $
**  $Date: 90/07/12 $
**
**  Custom and 'boopsi' gadget class interface
**
**  (C) Copyright 1985,1986,1987,1988,1989,1990 Commodore-Amiga, Inc.
**	    All Rights Reserved
*/

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

#ifndef INTUITION_INTUITION_H
#include <intuition/intuition.h>
#endif

#ifndef UTILITY_TAGITEM_H
#include <utility/tagitem.h>
#endif


/* Gadget Class attributes	*/

#define	   GA_Dummy		(TAG_USER +0x30000)
#define    GA_LEFT		(GA_Dummy + 0x0001)
#define    GA_RELRIGHT		(GA_Dummy + 0x0002)
#define    GA_TOP		(GA_Dummy + 0x0003)
#define    GA_RELBOTTOM		(GA_Dummy + 0x0004)
#define    GA_WIDTH		(GA_Dummy + 0x0005)
#define    GA_RELWIDTH		(GA_Dummy + 0x0006)
#define    GA_HEIGHT		(GA_Dummy + 0x0007)
#define    GA_RELHEIGHT		(GA_Dummy + 0x0008)
#define    GA_TEXT		(GA_Dummy + 0x0009) /* ti_Data is (UBYTE *) */
#define    GA_IMAGE		(GA_Dummy + 0x000A)
#define    GA_BORDER		(GA_Dummy + 0x000B)
#define    GA_SELECTRENDER	(GA_Dummy + 0x000C)
#define    GA_HIGHLIGHT		(GA_Dummy + 0x000D)
#define    GA_DISABLED		(GA_Dummy + 0x000E)
#define    GA_GZZGADGET		(GA_Dummy + 0x000F)
#define    GA_ID		(GA_Dummy + 0x0010)
#define    GA_USERDATA		(GA_Dummy + 0x0011)
#define    GA_SPECIALINFO	(GA_Dummy + 0x0012)
#define    GA_SELECTED		(GA_Dummy + 0x0013)
#define    GA_ENDGADGET		(GA_Dummy + 0x0014)
#define    GA_IMMEDIATE		(GA_Dummy + 0x0015)
#define    GA_RELVERIFY		(GA_Dummy + 0x0016)
#define    GA_FOLLOWMOUSE	(GA_Dummy + 0x0017)
#define    GA_RIGHTBORDER	(GA_Dummy + 0x0018)
#define    GA_LEFTBORDER	(GA_Dummy + 0x0019)
#define    GA_TOPBORDER		(GA_Dummy + 0x001A)
#define    GA_BOTTOMBORDER	(GA_Dummy + 0x001B)
#define    GA_TOGGLESELECT	(GA_Dummy + 0x001C)

    /* internal use only, until further notice, please */
#define    GA_SYSGADGET		(GA_Dummy + 0x001D)
	/* bool, sets SYSGADGET field in type	*/
#define    GA_SYSGTYPE		(GA_Dummy + 0x001E)
	/* e.g., WUPFRONT, ...	*/

#define    GA_PREVIOUS		(GA_Dummy + 0x001F)
	/* previous gadget (or (struct Gadget **)) in linked list
	 * NOTE: This attribute CANNOT be used to link new gadgets
	 * into the gadget list of an open window or requester.
	 * You must use AddGList().
	 */

#define    GA_NEXT		(GA_Dummy + 0x0020)
	 /* not implemented */

#define    GA_DRAWINFO		(GA_Dummy + 0x0021)
	/* some fancy gadgets need to see a DrawInfo
	 * when created or for layout
	 */

/* You should use at most ONE of GA_TEXT, GA_INTUITEXT, and GA_LABELIMAGE */
#define GA_INTUITEXT		(GA_Dummy + 0x0022)
	/* ti_Data is (struct IntuiText	*) */

#define GA_LABELIMAGE		(GA_Dummy + 0x0023)
	/* ti_Data is an image (object), used in place of
	 * GadgetText
	 */

/* PROPGCLASS attributes */

#define PGA_Dummy	(TAG_USER + 0x31000)
#define PGA_FREEDOM	(PGA_Dummy + 0x0001)
	/* only one of FREEVERT or FREEHORIZ */
#define PGA_BORDERLESS	(PGA_Dummy + 0x0002)
#define PGA_HORIZPOT	(PGA_Dummy + 0x0003)
#define PGA_HORIZBODY	(PGA_Dummy + 0x0004)
#define PGA_VERTPOT	(PGA_Dummy + 0x0005)
#define PGA_VERTBODY	(PGA_Dummy + 0x0006)
#define PGA_TOTAL	(PGA_Dummy + 0x0007)
#define PGA_VISIBLE	(PGA_Dummy + 0x0008)
#define PGA_TOP		(PGA_Dummy + 0x0009)

/* STRGCLASS attributes	*/

#define STRINGA_Dummy			(TAG_USER      +0x32000)
#define STRINGA_MaxChars	(STRINGA_Dummy + 0x0001)
#define STRINGA_Buffer		(STRINGA_Dummy + 0x0002)
#define STRINGA_UndoBuffer	(STRINGA_Dummy + 0x0003)
#define STRINGA_WorkBuffer	(STRINGA_Dummy + 0x0004)
#define STRINGA_BufferPos	(STRINGA_Dummy + 0x0005)
#define STRINGA_DispPos		(STRINGA_Dummy + 0x0006)
#define STRINGA_AltKeyMap	(STRINGA_Dummy + 0x0007)
#define STRINGA_Font		(STRINGA_Dummy + 0x0008)
#define STRINGA_Pens		(STRINGA_Dummy + 0x0009)
#define STRINGA_ActivePens	(STRINGA_Dummy + 0x000A)
#define STRINGA_EditHook	(STRINGA_Dummy + 0x000B)
#define STRINGA_EditModes	(STRINGA_Dummy + 0x000C)

/* booleans */
#define STRINGA_ReplaceMode	(STRINGA_Dummy + 0x000D)
#define STRINGA_FixedFieldMode	(STRINGA_Dummy + 0x000E)
#define STRINGA_NoFilterMode	(STRINGA_Dummy + 0x000F)

#define STRINGA_Justification	(STRINGA_Dummy + 0x0010)
	/* STRINGCENTER, STRINGLEFT, STRINGRIGHT */
#define STRINGA_LongVal		(STRINGA_Dummy + 0x0011)
#define STRINGA_TextVal		(STRINGA_Dummy + 0x0012)

#define SG_DEFAULTMAXCHARS	(128)

/* Gadget Layout related attributes	*/

/* not used by anything yet	*/
#define	LAYOUTA_Dummy		(TAG_USER  + 0x38000)
#define LAYOUTA_LAYOUTOBJ	(LAYOUTA_Dummy + 0x0001)
#define LAYOUTA_SPACING		(LAYOUTA_Dummy + 0x0002)
#define LAYOUTA_ORIENTATION	(LAYOUTA_Dummy + 0x0003)

/* orientation values	*/
#define LORIENT_NONE	0
#define LORIENT_HORIZ	1
#define LORIENT_VERT	2


/* Gadget Method ID's	*/

#define GM_Dummy	(-1)	/* not used for anything		*/
#define GM_HITTEST	(0)	/* return GMR_GADGETHIT if you are clicked on
			 	 * (whether or not you are disabled).
				 */
#define GM_RENDER	(1)	/* draw yourself, in the appropriate state */
#define GM_GOACTIVE	(2)	/* you are now going to be fed input	*/
#define GM_HANDLEINPUT	(3)	/* handle that input			*/
#define GM_GOINACTIVE	(4)	/* whether or not by choice, you are done  */

/* Parameter "Messages" passed to gadget class methods	*/

/* GM_HITTEST	*/
struct gpHitTest {
    ULONG		MethodID;
    struct GadgetInfo	*gpht_GInfo;
    struct {
	WORD	X;
	WORD	Y;
    }			gpht_Mouse;
};
/* GM_HITTEST return value */
#define GMR_GADGETHIT	(0x00000004)	/* if no hit, return 0 */

/* GM_RENDER	*/
struct gpRender {
    ULONG		MethodID;
    struct GadgetInfo	*gpr_GInfo;	/* gadget context		*/
    struct RastPort	*gpr_RPort;	/* all ready for use		*/
    LONG		gpr_Redraw;	/* might be a "highlight pass"	*/
};

/* values of gpr_Redraw	*/
#define GREDRAW_UPDATE	(2)	/* incremental update, e.g. prop slider	*/
#define GREDRAW_REDRAW	(1)	/* redraw gadget	*/
#define GREDRAW_TOGGLE	(0)	/* toggle highlight, if applicable	*/

/* GM_GOACTIVE, GM_HANDLEINPUT	*/
struct gpInput {
    ULONG		MethodID;
    struct GadgetInfo	*gpi_GInfo;
    struct InputEvent	*gpi_IEvent;
    LONG		*gpi_Termination;
    struct {
	WORD	X;
	WORD	Y;
    }			gpi_Mouse;
};

struct gpGoInactive {
    ULONG		MethodID;
    struct GadgetInfo	*gpgi_GInfo;
};

/* GM_HANDLEINPUT and GM_GOACTIVE  return code flags	*/
/* return GHR_MEACTIVE (0) alone if you want more input.
 * Otherwise, return ONE of GHR_NOREUSE and GHR_REUSE, and optionally
 * GHR_VERIFY.
 */
#define GMR_MEACTIVE	(0)
#define GMR_NOREUSE	(1 << 1)
#define GMR_REUSE	(1 << 2)
#define GMR_VERIFY	(1 << 3)	/* you MUST set cgp_Termination */


#endif
