#ifndef INTUITION_GADGETCLASS_H
#define INTUITION_GADGETCLASS_H 1


/*** gadgetclass.h ********************************************************
 *
 *  Gadget class interface
 *
 *  $Header: /home/amiga/V36/src/kickstart/intuition/RCS/gadgetclass.h,v 1.6 90/04/06 22:24:39 jimm Exp $
 *
 *  Confidential Information: Commodore-Amiga Computer, Inc.
 *  Copyright (c) Commodore-Amiga Computer, Inc.
 ****************************************************************************/

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

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


/* Gadget Class attributes	*/

enum {	GA_Dummy = TAG_USER  + 0x30000,
	/* general gadgets */
    GA_LEFT,
    GA_RELRIGHT,
    GA_TOP,
    GA_RELBOTTOM,
    GA_WIDTH,
    GA_RELWIDTH,
    GA_HEIGHT,
    GA_RELHEIGHT,
    GA_TEXT,
    GA_IMAGE,
    GA_BORDER,
    GA_SELECTRENDER,
    GA_HIGHLIGHT,
    GA_DISABLED,
    GA_GZZGADGET,
    GA_ID,
    GA_USERDATA,
    GA_SPECIALINFO,
    GA_SELECTED,
    GA_ENDGADGET,
    GA_IMMEDIATE,
    GA_RELVERIFY,
    GA_FOLLOWMOUSE,
    GA_RIGHTBORDER,
    GA_LEFTBORDER,
    GA_TOPBORDER,
    GA_BOTTOMBORDER,
    GA_TOGGLESELECT,

    /* internal use only, until further notice, please */
    GA_SYSGADGET,	/* bool, sets SYSGADGET field in type	*/
    GA_SYSGTYPE,	/* e.g., WUPFRONT, ...	*/

    GA_PREVIOUS,  /* previous gadget (or (struct Gadget **)) in linked list */
    GA_NEXT,	  /* next gadget in list.  NOTE: NEITHER of these two can
		   * be used to link new gadgets into the gadget list of
		   * an open window or requester.  You must use AddGList().
		   */
};

/* PROPGCLASS attributes */

enum {	PGA_Dummy = TAG_USER  + 0x31000,
    PGA_FREEDOM,	/* either or both of FREEVERT and FREEHORIZ */
    PGA_BORDERLESS,
    PGA_HORIZPOT,
    PGA_HORIZBODY,
    PGA_VERTPOT,
    PGA_VERTBODY,

    /* These helpful attributes aren't implemented yet */
    PGA_TOTAL,
    PGA_VISIBLE,
    PGA_TOP,
};

/* STRGCLASS attributes 	*/

enum { STRINGA_Dummy = TAG_USER + 0x32000,
    STRINGA_MaxChars,
    STRINGA_Buffer,
    STRINGA_UndoBuffer,
    STRINGA_WorkBuffer,
    STRINGA_BufferPos,
    STRINGA_DispPos,
    STRINGA_AltKeyMap,
    STRINGA_Font,
    STRINGA_Pens,
    STRINGA_ActivePens,
    STRINGA_EditHook,
    STRINGA_EditModes,

    /* booleans */
    STRINGA_ReplaceMode,
    STRINGA_FixedFieldMode,
    STRINGA_NoFilterMode,

    STRINGA_Justification,	/* STRINGCENTER, STRINGLEFT, STRINGRIGHT */

    STRINGA_LongVal,
    STRINGA_TextVal,
};

#define SG_DEFAULTMAXCHARS	(128)

/* Gadget Layout related attributes	*/

enum {	LAYOUTA_Dummy = TAG_USER  + 0x38000,
    LAYOUTA_LAYOUTOBJ,		/* layout delegate			*/
    LAYOUTA_SPACING,		/* simple spacing			*/
    LAYOUTA_ORIENTATION,	/* values from below			*/
};

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


/* Gadget Method ID's	*/

enum {	GM_Dummy = -1,
    GM_HITTEST,		/* return GMR_GADGETHIT if you are clicked
			 * (whether or not  you want to go active). 	*/
    GM_RENDER,		/* draw yourself, in the appropriate state	*/
    GM_GOACTIVE,	/* you are now going to be fed input		*/
    GM_HANDLEINPUT,	/* handle that input				*/
    GM_GOINACTIVE,	/* whether or not by choice, you are done	*/
};

/* Parameters Bundles	*/

/* 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
