
#ifndef INTUITION_SGHOOKS_H
#define INTUITION_SGHOOKS_H TRUE

/*** sghooks.h ****************************************************************
 *
 *  sghooks.h	string gadget extensions and hooks
 *
 *  $Header: /home/amiga/V36/src/kickstart/intuition/RCS/sghooks.h,v 1.4 89/09/19 21:38:58 jimm Exp $
 *
 *  Confidential Information: Commodore-Amiga Computer, Inc.
 *  Copyright (c) Commodore-Amiga Computer, Inc.
 *
 ****************************************************************************
 * CONFIDENTIAL and PROPRIETARY
 * Copyright (C) 1985, COMMODORE-AMIGA, INC.
 * All Rights Reserved
 ****************************************************************************/

struct StringExtend {
    /* display specifications	*/
    struct TextFont *Font;	/* must be an open Font (not TextAttr)	*/
    UBYTE	Pens[2];	/* color of text/backgroun		*/
    UBYTE	ActivePens[2];	/* colors when gadget is active		*/

    /* edit specifications	*/
    ULONG	InitialModes;	/* inital mode flags, below		*/
    struct Hook *EditHook;	/* if non-NULL, must supply WorkBuffer	*/
    UBYTE	*WorkBuffer;	/* must be as large as StringInfo.Buffer*/

    ULONG	Reserved[4];	/* set to 0				*/
};

struct SGWork	{
    /* set up when gadget is first activated	*/
    struct Gadget	*Gadget;	/* the contestant itself	*/
    struct StringInfo	*StringInfo;	/* easy access to sinfo		*/
    UBYTE		*WorkBuffer;	/* intuition's planned result	*/
    UBYTE		*PrevBuffer;	/* what was there before	*/
    ULONG		Modes;		/* current mode			*/

    /* modified for each input event	*/
    struct InputEvent	*IEvent;	/* actual event: do not change	*/
    UWORD		Code;		/* character code, if one byte	*/
    SHORT		BufferPos;	/* cursor position		*/
    SHORT		NumChars;	
    ULONG		Actions;	/* what Intuition will do	*/
    LONG		LongInt;	/* temp storage for longint	*/
    /* ZZZ: selected range	*/
};

/* Mode Flags definitions (ONLY first group allowed as InitialModes)	*/
#define SGM_REPLACE	(1L << 0)	/* replace mode			*/
/* please initiate StringInfo with in-range value of BufferPos 
 * if you are using SGM_REPLACE mode.
 */

#define SGM_FIXEDFIELD	(1L << 1)	/* fixed length buffer		*/
					/* not implemented yet		*/
#define SGM_NOFILTER	(1L << 2)	/* don't filter control chars	*/
/* These Mode Flags are for internal use only				*/
#define SGM_NOCHANGE	(1L << 3)	/* no edit changes yet		*/
#define SGM_NOWORKB	(1L << 4)	/* Buffer == PrevBuffer		*/
#define SGM_CONTROL	(1L << 5)	/* control char escape mode	*/
#define SGM_LONGINT	(1L << 6)	/* an intuition longint gadget	*/

/* String Gadget Action Flags (put in SGWork.Actions by EditHook)	*/
#define SGA_USE		(0x1L)	/* use contents of SGWork		*/
#define SGA_END		(0x2L)	/* terminate gadget, code in Code field	*/
#define SGA_BEEP 	(0x4L)	/* flash the screen for the user	*/
#define SGA_REUSE 	(0x8L)	/* reuse input event			*/
#define SGA_REDISPLAY 	(0x10L)	/* gadget visuals changed		*/

/* function id for only existing custom string gadget edit hook	*/

#define SGH_KEY		(1)	/* process editing keystroke		*/

#endif
