/*
**	GadTools layout toolkit
**
**	Copyright © 1993-1995 by Olaf `Olsen' Barthel
**	Freely distributable.
*/

#ifndef _GTLAYOUT_H
#define _GTLAYOUT_H


/*****************************************************************************/


#if !defined(_GTLAYOUT_GLOBAL_H) && !defined(SHARED_LIB) && !defined(LINK_LIB)
#define SHARED_LIB 1
#endif

#ifdef _DCC
#ifndef __stdargs
#define __stdargs __stkargs
#endif	/* __stdargs */
#ifndef __asm
#define __asm __regargs
#endif	/* __asm */
#endif	/* _DCC */

#ifdef _GTLAYOUT_GLOBAL_H
#define REG(x)	register __ ## x
#define LIBENT	__asm __saveds
#endif	/* _GTLAYOUT_GLOBAL_H */

#ifdef SHARED_LIB
#define REG(x)
#define LIBENT
#endif	/* SHARED_LIB */

#ifdef LINK_LIB
#define REG(x)
#define LIBENT	__regargs
#endif	/* LINK_LIB */


/*****************************************************************************/


#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

#ifndef INTUITION_GADGETCLASS_H
#include <intuition/gadgetclass.h>
#endif

#ifndef LIBRARIES_GADTOOLS_H
#include <libraries/gadtools.h>
#endif


/*****************************************************************************/


/* Where to place a gadget label */
typedef enum PlacementTypes
{
	PLACE_LEFT,
	PLACE_RIGHT,
	PLACE_ABOVE,
	PLACE_IN,
	PLACE_BELOW
} PlacementTypes;

/* How to align text lines in BOX_KIND gadgets */
typedef enum AlignmentTypes
{
	ALIGNTEXT_LEFT,
	ALIGNTEXT_CENTERED,
	ALIGNTEXT_RIGHT,
	ALIGNTEXT_PAD
} AlignmentTypes;

/* The button images available for TAPEDECK_KIND gadgets. */
typedef enum TapeDeckButtonTypes
{
	TDBT_BACKWARD,
	TDBT_FORWARD,
	TDBT_PREVIOUS,
	TDBT_NEXT,
	TDBT_STOP,
	TDBT_PAUSE,
	TDBT_RECORD,
	TDBT_REWIND,
	TDBT_EJECT,
	TDBT_PLAY,

	TDBTLAST
} TapeDeckButtonTypes;

/* How to align the window opened by LT_Build() on the screen. */
#define ALIGNF_RIGHT		(1 << 0)
#define ALIGNF_LEFT		(1 << 1)
#define ALIGNF_TOP		(1 << 2)
#define ALIGNF_BOTTOM		(1 << 3)
#define ALIGNF_EXTRA_RIGHT	(1 << 4)
#define ALIGNF_EXTRA_LEFT	(1 << 5)
#define ALIGNF_EXTRA_TOP	(1 << 6)
#define ALIGNF_EXTRA_BOTTOM	(1 << 7)

/* Handy for LT_LevelWidth and LT_NewLevelWidth */
typedef LONG (* __stdargs DISPFUNC)(struct Gadget *gad,WORD value);


/*****************************************************************************/


/* Generic tags, applicable for several object types */
#define LA_Chars		TAG_USER+2
#define LA_LabelPlace		TAG_USER+3
#define LA_ExtraSpace		TAG_USER+4
#define LA_NoKey		TAG_USER+30
#define LA_HighLabel		TAG_USER+31
#define LA_LabelText		TAG_USER+37
#define LA_LabelID		TAG_USER+38
#define LA_ID			TAG_USER+39
#define LA_Type			TAG_USER+40
#define LA_PageSelector		TAG_USER+79
#define LA_LabelChars		TAG_USER+107

/* Storage type tags */
#define LA_BYTE			TAG_USER+63
#define LA_UBYTE		TAG_USER+64
#define LA_WORD			TAG_USER+65
#define LA_BOOL			TAG_USER+65
#define LA_UWORD		TAG_USER+66
#define LA_LONG			TAG_USER+67
#define LA_ULONG		TAG_USER+68
#define LA_STRPTR		TAG_USER+69
#define LA_FRACTION		TAG_USER+68

/* for use with LT_GetAttributes() only */
#define LA_Left			TAG_USER+16
#define LA_Top			TAG_USER+17
#define LA_Width		TAG_USER+18
#define LA_Height		TAG_USER+19
#define LA_LabelLeft		TAG_USER+114
#define LA_LabelTop		TAG_USER+115

/* BOOPSI_KIND */
#define LABO_TagCurrent		TAG_USER+119
#define LABO_TagTextAttr	TAG_USER+120
#define LABO_TagDrawInfo	TAG_USER+121
#define LABO_TagLink		TAG_USER+129
#define LABO_TagScreen		TAG_USER+132
#define LABO_Link		LALV_Link
#define LABO_ClassInstance	TAG_USER+122
#define LABO_ClassName		TAG_USER+123
#define LABO_ClassLibraryName	TAG_USER+124
#define LABO_ExactWidth		TAG_USER+127
#define LABO_ExactHeight	TAG_USER+128
#define LABO_RelFontHeight	TAG_USER+131
#define LABO_Object		TAG_USER+133
#define LABO_FullWidth		TAG_USER+135
#define LABO_FullHeight		TAG_USER+136
#define LABO_ActivateHook	TAG_USER+141

/* BOX_KIND */
#define LABX_Labels		TAG_USER+12
#define LABX_Lines		TAG_USER+13
#define LABX_Rows		TAG_USER+1
#define LABX_Index		TAG_USER+14
#define LABX_Text		TAG_USER+15
#define LABX_AlignText		TAG_USER+27
#define LABX_DrawBox		TAG_USER+11
#define LABX_FirstLabel		TAG_USER+44
#define LABX_LastLabel		TAG_USER+45
#define LABX_ReserveSpace	TAG_USER+72
#define LABX_LabelTable		TAG_USER+98

/* BUTTON_KIND */
#define LABT_ReturnKey		TAG_USER+34
#define LABT_DefaultButton	TAG_USER+34
#define LABT_EscKey		TAG_USER+56
#define LABT_ExtraFat		TAG_USER+29
#define LABT_Lines		TAG_USER+140
#define LABT_FirstLine		TAG_USER+44
#define LABT_LastLine		TAG_USER+45
#define LABT_DefaultCorrection	TAG_USER+145
#define LABT_Smaller		TAG_USER+147

/* CYCLE_KIND */
#define LACY_FirstLabel		TAG_USER+44
#define LACY_LastLabel		TAG_USER+45
#define LACY_LabelTable		TAG_USER+98
#define LACY_AutoPageID		TAG_USER+103
#define LACY_TabKey		TAG_USER+118

/* FRACTION_KIND */
#define LAFC_MaxChars		TAG_USER+20
#define LAFC_Number		TAG_USER+21
#define LAFC_LastGadget		TAG_USER+28
#define LAFC_Min		TAG_USER+23
#define LAFC_Max		TAG_USER+24
#define LAFC_HistoryLines	TAG_USER+59
#define LAFC_HistoryHook	TAG_USER+80
#define LAFC_Activate		TAG_USER+148

/* FRAME_KIND */
#define LAFR_InnerWidth		TAG_USER+9
#define LAFR_InnerHeight	TAG_USER+10
#define LAFR_DrawBox		TAG_USER+11
#define LAFR_RefreshHook	TAG_USER+117

/* GAUGE_KIND */
#define LAGA_Percent		TAG_USER+36
#define LAGA_InfoLength		TAG_USER+70
#define LAGA_InfoText		TAG_USER+71
#define LAGA_NoTicks		TAG_USER+143
#define LAGA_Discrete		TAG_USER+144
#define LAGA_Tenth		TAG_USER+144

/* INTEGER_KIND */
#define LAIN_LastGadget		TAG_USER+28
#define LAIN_Min		TAG_USER+23
#define LAIN_Max		TAG_USER+24
#define LAIN_UseIncrementers	TAG_USER+57
#define LAIN_Incrementers	TAG_USER+57
#define LAIN_HistoryLines	TAG_USER+59
#define LAIN_HistoryHook	TAG_USER+80
#define LAIN_IncrementerHook	TAG_USER+85
#define LAIN_Activate		TAG_USER+148

/* LISTVIEW_KIND */
#define LALV_ExtraLabels	TAG_USER+26
#define LALV_Labels		TAG_USER+33
#define LALV_CursorKey		TAG_USER+35
#define LALV_Columns		TAG_USER+2
#define LALV_Lines		TAG_USER+1
#define LALV_Link		TAG_USER+7
#define LALV_FirstLabel		TAG_USER+44
#define LALV_LastLabel		TAG_USER+45
#define LALV_MaxGrowX		TAG_USER+77
#define LALV_MaxGrowY		TAG_USER+78
#define LALV_LabelTable		TAG_USER+98
#define LALV_LockSize		TAG_USER+106
#define LALV_ResizeX		TAG_USER+109
#define LALV_ResizeY		TAG_USER+110
#define LALV_MinChars		TAG_USER+111
#define LALV_MinLines		TAG_USER+112
#define LALV_FlushLabelLeft	TAG_USER+113
#define LALV_TextAttr		TAG_USER+138
#define LALV_AutoPageID		TAG_USER+103

/* LEVEL_KIND */
#define LAVL_Min		GTSL_Min
#define LAVL_Max		GTSL_Max
#define LAVL_Level		GTSL_Level
#define LAVL_LevelFormat	GTSL_LevelFormat
#define LAVL_LevelPlace		GTSL_LevelPlace
#define LAVL_DispFunc		GTSL_DispFunc
#define LAVL_FullCheck		LASL_FullCheck

/* MX_KIND */
#define LAMX_FirstLabel		TAG_USER+44
#define LAMX_LastLabel		TAG_USER+45
#define LAMX_LabelTable		TAG_USER+98
#define LAMX_TabKey		TAG_USER+118
#define LAMX_AutoPageID		TAG_USER+103

/* PALETTE_KIND */
#define LAPA_SmallPalette	TAG_USER+32
#define LAPA_Lines		LA_Lines
#define LAPA_UsePicker		TAG_USER+137
#define LAPA_Picker		TAG_USER+137

/* PASSWORD_KIND */
#define LAPW_String             GTST_String
#define LAPW_LastGadget		TAG_USER+28
#define LAPW_HistoryLines	TAG_USER+59
#define LAPW_HistoryHook	TAG_USER+80
#define LAPW_Activate		TAG_USER+148

/* POPUP_KIND */
#define LAPU_FirstLabel		TAG_USER+44
#define LAPU_LastLabel		TAG_USER+45
#define LAPU_LabelTable		TAG_USER+98
#define LAPU_AutoPageID		TAG_USER+103
#define LAPU_TabKey		TAG_USER+118
#define LAPU_Labels		GTCY_Labels
#define LAPU_Active		GTCY_Active

/* SLIDER_KIND */
#define LASL_FullCheck		TAG_USER+22

/* SCROLLER_KIND */
#define LASC_Thin		TAG_USER+62

/* STRING_KIND */
#define LAST_LastGadget		TAG_USER+28
#define LAST_Link		TAG_USER+7
#define LAST_Picker		TAG_USER+5
#define LAST_UsePicker		TAG_USER+5
#define LAST_HistoryLines	TAG_USER+59
#define LAST_HistoryHook	TAG_USER+80
#define LAST_CursorPosition	TAG_USER+105
#define LAST_Activate		TAG_USER+148

/* TAB_KIND */
#define LATB_FirstLabel		TAG_USER+44
#define LATB_LastLabel		TAG_USER+45
#define LATB_LabelTable		TAG_USER+98
#define LATB_AutoPageID		TAG_USER+103
#define LATB_TabKey		TAG_USER+118
#define LATB_Labels		GTCY_Labels
#define LATB_Active		GTCY_Active
#define LATB_FullWidth		TAG_USER+149
#define LATB_FullSize		TAG_USER+149

/* TAPEDECK_KIND */
#define LATD_ButtonType		TAG_USER+86
#define LATD_Toggle		TAG_USER+87
#define LATD_Pressed		TAG_USER+88
#define LATD_Smaller		TAG_USER+89
#define LATD_Tick		TAG_USER+139

/* TEXT_KIND */
#define LATX_Picker		TAG_USER+5
#define LATX_UsePicker		TAG_USER+5
#define LATX_LockSize		TAG_USER+106

/* VERTICAL_KIND, HORIZONTAL_KIND */
#define LAGR_Spread		TAG_USER+6
#define LAGR_SameSize		TAG_USER+8
#define LAGR_LastAttributes	TAG_USER+46
#define LAGR_ActivePage		TAG_USER+58
#define LAGR_Frame		TAG_USER+104
#define LAGR_IndentX		TAG_USER+130
#define LAGR_IndentY		TAG_USER+134
#define LAGR_NoIndent		TAG_USER+146

/* XBAR_KIND */
#define LAXB_FullSize		TAG_USER+50
#define LAXB_FullWidth		TAG_USER+50

/* Applicable for layout handle only */
#define LAHN_Font		TAG_USER+41
#define LAHN_AutoActivate	TAG_USER+42
#define LAHN_LocaleHook		TAG_USER+4
#define LAHN_CloningPermitted	TAG_USER+61
#define LAHN_EditHook		TAG_USER+74
#define LAHN_ExactClone		TAG_USER+75
#define LAHN_MenuGlyphs		TAG_USER+76
#define LAHN_Parent		TAG_USER+83
#define LAHN_BlockParent	TAG_USER+84
#define LAHN_SimpleClone	TAG_USER+90
#define LAHN_ExitFlush		TAG_USER+108
#define LAHN_UserData		TAG_USER+116
#define LAHN_RawKeyFilter	TAG_USER+142

/* Applicable for menus only. */
#define LAMN_FirstLabel		LABX_FirstLabel
#define LAMN_LastLabel		LABX_LastLabel
#define LAMN_LabelTable		TAG_USER+98
#define LAMN_TitleText		(TAG_USER + 17000)
#define LAMN_TitleID		(TAG_USER + 17001)
#define LAMN_ItemText		(TAG_USER + 17002)
#define LAMN_ItemID		(TAG_USER + 17003)
#define LAMN_SubText		(TAG_USER + 17004)
#define LAMN_SubID		(TAG_USER + 17005)
#define LAMN_KeyText		(TAG_USER + 17006)
#define LAMN_KeyID		(TAG_USER + 17007)
#define LAMN_CommandText	(TAG_USER + 17008)
#define LAMN_CommandID		(TAG_USER + 17009)
#define LAMN_MutualExclude	(TAG_USER + 17010)
#define LAMN_UserData		(TAG_USER + 17011)
#define LAMN_Disabled		(TAG_USER + 17012)
#define LAMN_CheckIt		(TAG_USER + 17013)
#define LAMN_Checked		(TAG_USER + 17014)
#define LAMN_Toggle		(TAG_USER + 17015)
#define LAMN_Code		(TAG_USER + 17016)
#define LAMN_Qualifier		(TAG_USER + 17017)
#define LAMN_Char		(TAG_USER + 17018)
#define LAMN_ID			(TAG_USER + 17019)
#define LAMN_AmigaGlyph		(TAG_USER + 17020)
#define LAMN_CheckmarkGlyph	(TAG_USER + 17021)
#define LAMN_Error		(TAG_USER + 17022)
#define LAMN_Screen		(TAG_USER + 17023)
#define LAMN_TextAttr		(TAG_USER + 17024)
#define LAMN_LayoutHandle	(TAG_USER + 17025)
#define LAMN_Handle		(TAG_USER + 17025)
#define LAMN_ExtraSpace		(TAG_USER + 17026)

/* Applicable for window only */
#define LAWN_Menu		TAG_USER+25
#define LAWN_UserPort		TAG_USER+47
#define LAWN_Left		TAG_USER+48
#define LAWN_Top		TAG_USER+49
#define LAWN_Zoom		TAG_USER+50
#define LAWN_MaxPen		TAG_USER+52
#define LAWN_BelowMouse		TAG_USER+53
#define LAWN_MoveToWindow	TAG_USER+54
#define LAWN_AutoRefresh	TAG_USER+55
#define LAWN_HelpHook		TAG_USER+73
#define LAWN_Parent		TAG_USER+81
#define LAWN_BlockParent	TAG_USER+82
#define LAWN_SmartZoom		TAG_USER+91
#define LAWN_Title		TAG_USER+92
#define LAWN_TitleText		TAG_USER+92
#define LAWN_Bounds		TAG_USER+93
#define LAWN_ExtraWidth		TAG_USER+94
#define LAWN_ExtraHeight	TAG_USER+95
#define LAWN_IDCMP		TAG_USER+96
#define LAWN_AlignWindow	TAG_USER+97
#define LAWN_TitleID		TAG_USER+99
#define LAWN_FlushLeft		TAG_USER+14000	/* NOTEZ-BIEN: TAG_USER+99 = WA_Dummy and can clash */
#define LAWN_FlushTop		TAG_USER+14001	/*             with Intuition!                      */
#define LAWN_Show		TAG_USER+14002
#define LAWN_MenuTemplate	TAG_USER+14003
#define LAWN_MenuTags		TAG_USER+14004

/* Private tags; do not use, or you'll run into trouble! */
#define LA_Private1		TAG_USER+100
#define LA_Private2		TAG_USER+101

/* Last tag item value used */
#define LAST_TAG		TAG_USER+149


/*****************************************************************************/


/* Identifies the absence of a link for a listview or a string gadget */
#define NIL_LINK		-2


/*****************************************************************************/


	/* String gadget type history hook support: you will either get
	 * the following value passed as the message parameter to your
	 * hook function, or a pointer to a null-terminated string you should
	 * copy and create a Node from, which you should then add to the tail
	 * of your history list. Place a pointer to your history list in the
	 * Hook.h_Data entry.
	 */

#define HISTORYHOOK_DISCARD_OLDEST	0	/* Discard oldest entry */


/*****************************************************************************/


	/* Refresh hook support: you will get the following structure
	 * passed as the message and a pointer to the LayoutHandle as
	 * the object.
	 */

typedef struct RefreshMsg
{
	LONG	ID;
	WORD	Left,
		Top,
		Width,
		Height;
} RefreshMsg;

/*****************************************************************************/


	/* Incrementer hook support: you will get the current value
	 * passed as the object and one of the following values as
	 * the message. Return the number to be used.
	 */

typedef enum IncrementerMsgTypes
{
	INCREMENTERMSG_DECREMENT = -1,	/* Decrement value */
	INCREMENTERMSG_INITIAL   =  0,	/* Initial value passed upon gadget creation */
	INCREMENTERMSG_INCREMENT =  1	/* Increment value */
} IncrementerMsgTypes;


/*****************************************************************************/

	/* Help key hook support: the hook will be called with a "struct IBox *"
	 * as the object and a "struct HelpMsg *". The IBox describes the object
	 * the mouse was positioned over, such as a button, a listview, etc.
	 * The "ObjectID" will indicate the ID of the object the mouse was
	 * positioned over. The ID will be -1 if no object was to be found.
	 */

typedef struct HelpMsg
{
	struct LayoutHandle	*Handle;	/* Window layout handle */
	LONG			 ObjectID;	/* ID of the object, -1 for full window */
} HelpMsg;


/*****************************************************************************/


/* Obsolete tags, don't use in new code */
#define LA_Lines		LABX_Rows
#define LA_Spread		LAGR_Spread
#define LA_SameSize		LAGR_SameSize
#define LA_FullCheck		LASL_FullCheck
#define LA_ExtraLabels		LALV_ExtraLabels
#define LA_LastGadget		LAFC_LastGadget
#define LA_SmallPalette		LAPA_SmallPalette
#define LA_Labels		LALV_Labels
#define LA_Picker		LATX_Picker
#define LA_DrawBox		LAFR_DrawBox
#define LA_FirstLabel		LABX_FirstLabel
#define LA_LastLabel		LABX_LastLabel
#define LA_LabelTable		LABX_LabelTable
#define LA_Min			LAFC_Min
#define LA_Max			LAFC_Max
#define LA_Link			LALV_Link
#define LA_Menu			LAWN_Menu
#define LA_HistoryLines		LAST_HistoryLines
#define LA_HistoryHook		LAST_HistoryHook
#define LA_ReturnKey		LABT_ReturnKey
#define LA_ExtraFat		LABT_ExtraFat
#define LA_CursorKey		LALV_CursorKey
#define STORE_BYTE		TAG_USER+63
#define STORE_UBYTE		TAG_USER+64
#define STORE_WORD		TAG_USER+65
#define STORE_BOOL		TAG_USER+65
#define STORE_UWORD		TAG_USER+66
#define STORE_LONG		TAG_USER+67
#define STORE_ULONG		TAG_USER+68
#define STORE_STRPTR		TAG_USER+69
#define STORE_FRACTION		TAG_USER+68
#define LH_Font			TAG_USER+41
#define LH_AutoActivate		TAG_USER+42
#define LH_LocaleHook		TAG_USER+4
#define LH_CloningPermitted	TAG_USER+61
#define LH_EditHook		TAG_USER+74
#define LH_ExactClone		TAG_USER+75
#define LH_MenuGlyphs		TAG_USER+76
#define LH_Parent		TAG_USER+83
#define LH_BlockParent		TAG_USER+84
#define LH_SimpleClone		TAG_USER+90
#define LH_ExitFlush		TAG_USER+108
#define LH_UserData		TAG_USER+116
#define LH_RawKeyFilter		TAG_USER+142


/*****************************************************************************/


/* kinds of objects supported in addition to the normal GadTools kinds */
#define HORIZONTAL_KIND		45
#define VERTICAL_KIND		46
#define END_KIND		47
#define FRAME_KIND		48
#define BOX_KIND		49
#define FRACTION_KIND		50
#define XBAR_KIND		51
#define YBAR_KIND		52
#define PASSWORD_KIND		53
#define GAUGE_KIND		54
#define TAPEDECK_KIND		55
#define LEVEL_KIND		56
#define BOOPSI_KIND		57
#define POPUP_KIND		58
#define TAB_KIND		59


/*****************************************************************************/


/* in support of FRACTION_KIND gadgets */

typedef ULONG			FIXED;
#define FIXED_UNITY		10000

#define TO_FIXED(l,r)		(FIXED_UNITY * (l) + (r))
#define FIXED_LEFT(f)		((f) / FIXED_UNITY)
#define FIXED_RIGHT(f)		((f) % FIXED_UNITY)


/*****************************************************************************/


#ifndef _GTLAYOUT_GLOBAL_H
typedef struct LayoutHandle
{
	struct Screen		*Screen;
	struct DrawInfo		*DrawInfo;
	struct Window		*Window;
	APTR			 VisualInfo;
	struct Image		*AmigaGlyph,
				*CheckGlyph;
	APTR			 UserData;	/* Requires gtlayout.library v9 */
	struct Menu		*Menu;		/* Requires gtlayout.library v13 */
	/* private fields follow.... */
} LayoutHandle;
#endif	/* _GTLAYOUT_GLOBAL_H */


/*****************************************************************************/


VOID LIBENT			LT_LevelWidth(REG(a0) struct LayoutHandle *handle,REG(a1) STRPTR levelFormat,REG(a2) DISPFUNC dispFunc,REG(d0) LONG min,REG(d1) LONG max,REG(a3) LONG *maxWidth,REG(a5) LONG *maxLen,REG(d2) BOOL fullCheck);
VOID LIBENT			LT_NewLevelWidth(REG(a0) struct LayoutHandle *handle,REG(a1) STRPTR levelFormat,REG(a2) DISPFUNC dispFunc,REG(d0) LONG min,REG(d1) LONG max,REG(a3) LONG *maxWidth,REG(d3) LONG *maxLen,REG(d2) BOOL fullCheck);
VOID LIBENT			LT_DeleteHandle(REG(a0) struct LayoutHandle *Handle);
struct LayoutHandle * LIBENT	LT_CreateHandle(REG(a0) struct Screen *Screen,REG(a1) struct TextAttr *Font);
struct LayoutHandle * LIBENT	LT_CreateHandleTagList(REG(a0) struct Screen *Screen,REG(a1) struct TagItem *TagList);
BOOL LIBENT			LT_RebuildTagList(REG(a0) struct LayoutHandle *handle,REG(d0) BOOL clear,REG(a1) struct TagItem *TagParams);
VOID LIBENT			LT_HandleInput(REG(a0) struct LayoutHandle *Handle,REG(d0) ULONG MsgQualifier,REG(a1) ULONG *MsgClass,REG(a2) UWORD *MsgCode,REG(a3) struct Gadget **MsgGadget);
VOID LIBENT			LT_BeginRefresh(REG(a0) struct LayoutHandle *handle);
VOID LIBENT			LT_EndRefresh(REG(a0) struct LayoutHandle *handle,REG(d0) BOOL complete);
LONG LIBENT			LT_GetAttributesA(REG(a0) struct LayoutHandle *Handle,REG(d0) LONG ID,REG(a1) struct TagItem *TagList);
VOID LIBENT			LT_SetAttributesA(REG(a0) struct LayoutHandle *handle,REG(d0) LONG id,REG(a1) struct TagItem *TagList);
VOID LIBENT			LT_NewA(REG(a0) struct LayoutHandle *handle,REG(a1) struct TagItem *tagList);
VOID LIBENT			LT_EndGroup(REG(a0) struct LayoutHandle *handle);
struct Window * LIBENT		LT_BuildA(REG(a0) struct LayoutHandle *Handle,REG(a1) struct TagItem *TagParams);
struct Menu * LIBENT		LT_LayoutMenusA(REG(a0) struct LayoutHandle *handle,REG(a1) struct NewMenu *menuTemplate,REG(a2) struct TagItem *TagParams);
VOID LIBENT			LT_Fixed2String(REG(d0) FIXED fixed,REG(d1) STRPTR buffer);
FIXED LIBENT			LT_String2Fixed(REG(a0) STRPTR buffer);
ULONG LIBENT			LT_FixedMult(REG(d0) FIXED fixed,REG(d1) ULONG factor);
LONG LIBENT			LT_LabelWidth(REG(a0) struct LayoutHandle *handle,REG(a1) STRPTR label);
LONG LIBENT			LT_LabelChars(REG(a0) struct LayoutHandle *handle,REG(a1) STRPTR label);
VOID LIBENT			LT_LockWindow(REG(a0) struct Window *window);
VOID LIBENT			LT_UnlockWindow(REG(a0) struct Window *window);
VOID LIBENT			LT_DeleteWindowLock(REG(a0) struct Window *window);
VOID LIBENT			LT_ShowWindow(REG(a0) struct LayoutHandle *handle,REG(a1) BOOL activate);
VOID LIBENT			LT_Activate(REG(a0) struct LayoutHandle *handle,REG(d0) LONG id);
VOID LIBENT			LT_PressButton(REG(a0) struct LayoutHandle *handle,REG(d0) LONG id);
WORD LIBENT			LT_GetCode(REG(d0) ULONG MsgQualifier,REG(d1) ULONG MsgClass,REG(d2) UWORD MsgCode,REG(a0) struct Gadget *MsgGadget);
struct IntuiMessage * LIBENT	LT_GetIMsg(REG(a0) struct LayoutHandle *Handle);
VOID LIBENT			LT_ReplyIMsg(REG(a0) struct IntuiMessage *Msg);
VOID LIBENT			LT_UpdateStrings(REG(a0) struct LayoutHandle *Handle);
VOID LIBENT			LT_DisposeMenu(REG(a0) struct Menu *Menu);
struct Menu * LIBENT		LT_NewMenuTemplate(REG(a0) struct Screen *Screen,REG(a1) struct TextAttr *TextAttr,REG(a2) struct Image *AmigaGlyph,REG(a3) struct Image *CheckGlyph,REG(d0) LONG *Error,REG(d1) struct NewMenu *MenuTemplate);
struct Menu * LIBENT		LT_NewMenuTagList(REG(a0) struct TagItem *TagList);
VOID LIBENT			LT_MenuControlTagList(REG(a0) struct Window *Window,REG(a1) struct Menu *IntuitionMenu,REG(a2) struct TagItem *Tags);
struct MenuItem * LIBENT	LT_GetMenuItem(REG(a0) struct Menu *Menu,REG(d0) ULONG ID);
struct MenuItem * LIBENT	LT_FindMenuCommand(REG(a0) struct Menu *Menu,REG(d0) UWORD MsgCode,REG(d1) UWORD MsgQualifier,REG(a1) struct Gadget *MsgGadget);


/*****************************************************************************/


/* For use as link library */

BOOL LIBENT			LT_Init(VOID);
VOID LIBENT			LT_Exit(VOID);

/* Available for library-internal use and as link library */

BOOL __stdargs			LT_RebuildTags(struct LayoutHandle *handle,BOOL clear,...);
struct LayoutHandle * __stdargs	LT_CreateHandleTags(struct Screen *Screen,...);
LONG __stdargs			LT_GetAttributes(struct LayoutHandle *Handle,LONG ID,...);
VOID __stdargs			LT_SetAttributes(struct LayoutHandle *handle,LONG id,...);
VOID __stdargs			LT_AddL(struct LayoutHandle *handle,UBYTE type,ULONG labelID,LONG id,...);
VOID __stdargs			LT_Add(struct LayoutHandle *Handle,UBYTE Type,STRPTR Label,LONG ID,...);
VOID __stdargs			LT_New(struct LayoutHandle *handle,...);
struct Window * __stdargs	LT_Build(struct LayoutHandle *Handle,...);
struct Window * __stdargs	LT_Layout(struct LayoutHandle *handle, STRPTR title,struct IBox *bounds,LONG extraWidth, LONG extraHeight,ULONG IDCMP, UBYTE align, ...);
struct Menu * __stdargs		LT_LayoutMenus(struct LayoutHandle *handle,struct NewMenu *menuTemplate,...);

struct Menu * __stdargs		LT_NewMenuTags(Tag FirstTag,...);
VOID __stdargs			LT_MenuControlTags(struct Window *Window,struct Menu *Menu,...);


/*****************************************************************************/


/* Useful macros */

#define LT_GetString(Handle,Code)	((STRPTR)LT_GetAttributes((Handle),(Code),TAG_DONE))

#define LAMN_Menu_UserData(m)		(*(APTR *)(((struct Menu *)(m)) + 1))
#define LAMN_Menu_ID(m)			(((ULONG *)(((struct Menu *)(m)) + 1))[1])

#define LAMN_Item_UserData(m)		(*(APTR *)(((struct MenuItem *)(m)) + 1))
#define LAMN_Item_ID(m)			(((ULONG *)(((struct MenuItem *)(m)) + 1))[1])


/*****************************************************************************/


/* Obsolete routines, do not use in new code. */

BOOL LIBENT				LT_Rebuild(REG(a0) struct LayoutHandle *handle,REG(a1) struct IBox *bounds,REG(a2) LONG extraWidth,REG(d0) LONG extraHeight,REG(d1) BOOL clear);
struct Window * LIBENT			LT_LayoutA(REG(a0) struct LayoutHandle *handle, REG(a1) STRPTR title,REG(a2) struct IBox *bounds,REG(d0) LONG extraWidth, REG(d1) LONG extraHeight,REG(d2) ULONG IDCMP, REG(d3) UBYTE align, REG(a3) struct TagItem *TagParams);
VOID LIBENT				LT_AddA(REG(a0) struct LayoutHandle *Handle,REG(d0) UBYTE Type,REG(d1) STRPTR Label,REG(d2) LONG ID,REG(a1) struct TagItem *TagList);

#define LT_GetDrawInfo(Handle)		(Handle) ? ((Handle) -> DrawInfo)	: NULL
#define LT_GetVisualInfo(Handle)	(Handle) ? ((Handle) -> VisualInfo)	: NULL
#define LT_GetScreen(Handle)		(Handle) ? ((Handle) -> Screen)		: NULL
#define LT_SetAutoActivate(Handle,Mode)	LT_SetAttributes(Handle,0,LH_AutoActivate,Mode,TAG_DONE)


/*****************************************************************************/


#if !defined(_GTLAYOUT_GLOBAL_H) && !defined(NO_PRAGMAS)
#pragma libcall GTLayoutBase LT_LevelWidth 1e 2DB10A9808
#pragma libcall GTLayoutBase LT_DeleteHandle 24 801
#pragma libcall GTLayoutBase LT_CreateHandle 2a 9802
#pragma libcall GTLayoutBase LT_CreateHandleTagList 30 9802
#pragma tagcall GTLayoutBase LT_CreateHandleTags 30 9802
#pragma libcall GTLayoutBase LT_Rebuild 36 10A9805
#pragma libcall GTLayoutBase LT_HandleInput 3c BA90805
#pragma libcall GTLayoutBase LT_BeginRefresh 42 801
#pragma libcall GTLayoutBase LT_EndRefresh 48 0802
#pragma libcall GTLayoutBase LT_GetAttributesA 4e 90803
#pragma tagcall GTLayoutBase LT_GetAttributes 4e 90803
#pragma libcall GTLayoutBase LT_SetAttributesA 54 90803
#pragma tagcall GTLayoutBase LT_SetAttributes 54 90803
#pragma libcall GTLayoutBase LT_AddA 5a 9210805
#pragma tagcall GTLayoutBase LT_Add 5a 9210805
#pragma libcall GTLayoutBase LT_NewA 60 9802
#pragma tagcall GTLayoutBase LT_New 60 9802
#pragma libcall GTLayoutBase LT_EndGroup 66 801
#pragma libcall GTLayoutBase LT_LayoutA 6c B3210A9808
#pragma tagcall GTLayoutBase LT_Layout 6c B3210A9808
#pragma libcall GTLayoutBase LT_LayoutMenusA 72 A9803
#pragma tagcall GTLayoutBase LT_LayoutMenus 72 A9803
#pragma libcall GTLayoutBase LT_Fixed2String 78 1002
#pragma libcall GTLayoutBase LT_String2Fixed 7e 801
#pragma libcall GTLayoutBase LT_FixedMult 84 1002
#pragma libcall GTLayoutBase LT_LabelWidth 8a 9802
#pragma libcall GTLayoutBase LT_LabelChars 90 9802
#pragma libcall GTLayoutBase LT_LockWindow 96 801
#pragma libcall GTLayoutBase LT_UnlockWindow 9c 801
#pragma libcall GTLayoutBase LT_DeleteWindowLock a2 801
#pragma libcall GTLayoutBase LT_ShowWindow a8 9802
#pragma libcall GTLayoutBase LT_Activate ae 0802
#pragma libcall GTLayoutBase LT_PressButton b4 0802
#pragma libcall GTLayoutBase LT_GetCode ba 821004
/*--- Added in v1.78 --------------------------------------------------*/
#pragma libcall GTLayoutBase LT_GetIMsg c0 801
#pragma libcall GTLayoutBase LT_ReplyIMsg c6 801
/*--- Added in v3.0 ---------------------------------------------------*/
#pragma libcall GTLayoutBase LT_BuildA cc 9802
#pragma tagcall GTLayoutBase LT_Build cc 9802
#pragma libcall GTLayoutBase LT_RebuildTagList d2 90803
#pragma tagcall GTLayoutBase LT_RebuildTags d2 90803
/*--- Added in v9.0 ---------------------------------------------------*/
#pragma libcall GTLayoutBase LT_UpdateStrings d8 801
/*--- Added in v11.0 ---------------------------------------------------*/
#pragma libcall GTLayoutBase LT_DisposeMenu de 801
#pragma libcall GTLayoutBase LT_NewMenuTemplate e4 10BA9806
#pragma libcall GTLayoutBase LT_NewMenuTagList ea 801
#pragma tagcall GTLayoutBase LT_NewMenuTags ea 801
#pragma libcall GTLayoutBase LT_MenuControlTagList f0 A9803
#pragma tagcall GTLayoutBase LT_MenuControlTags f0 A9803
#pragma libcall GTLayoutBase LT_GetMenuItem f6 0802
#pragma libcall GTLayoutBase LT_FindMenuCommand fc 910804
/*--- Added in v14.0 ---------------------------------------------------*/
#pragma libcall GTLayoutBase LT_NewLevelWidth 102 23B10A9808
#endif	/* !_GTLAYOUT_GLOBAL_H && !NO_PRAGMAS */


/*****************************************************************************/


#endif	/* _GTLAYOUT_H */
