/* $Revision Header *** Header built automatically - do not edit! ***********
 *
 *	(C) Copyright 1992 by Torsten Jürgeleit
 *
 *	Name .....: library_test.c
 *	Created ..: Sunday 19-Jul-92 14:28:01
 *	Revision .: 0
 *
 *	Date        Author                 Comment
 *	=========   ====================   ====================
 *	19-Jul-92   Torsten Jürgeleit      Created this file!
 *
 ****************************************************************************
 *
 *	Test for IntuiSup library to demonstrate the use of more than one
 *	gadget lists per window
 *
 * $Revision Header ********************************************************/

	/* Includes */

#include <exec/types.h>
#include <exec/memory.h>
#include <graphics/gfxbase.h>
#include <graphics/text.h>
#include <intuition/intuition.h>
#ifdef AZTEC_C
#include <functions.h>   /* needed for Aztec C - prototypes and pragmas for all Amiga system functions */
#endif
#include "intuisup.h"

	/* Defines */

#define WINDOW_WIDTH		600
#define WINDOW_HEIGHT		180
#define WINDOW_IDCMP		(CLOSEWINDOW | GADGET_IDCMP_FLAGS_ALL | MENUPICK)
#define WINDOW_FLAGS		(WINDOWCLOSE | WINDOWDRAG | WINDOWDEPTH | SMART_REFRESH | NOCAREREFRESH | ACTIVATE)
#define WINDOW_TITLE		(UBYTE *)" Library test "

#define RENDER_INFO_FLAGS	(USHORT)(RENDER_INFO_FLAG_INNER_WINDOW | RENDER_INFO_FLAG_BACK_FILL)
#define OPEN_WINDOW_FLAGS	(USHORT)OPEN_WINDOW_FLAG_CENTER_SCREEN

#define MESSAGE_LEFT_EDGE	0
#define MESSAGE_TOP_EDGE	(WINDOW_HEIGHT - MESSAGE_HEIGHT - 10)
#define MESSAGE_WIDTH		WINDOW_WIDTH
#define MESSAGE_HEIGHT		8
#define MESSAGE_TEXT1		"Object %d text \"%s\""
#define MESSAGE_TEXT2		"Object %d value %ld"
#define MESSAGE_TEXT3		"Menu no. %d menu item no. %d sub item no. %d selected"
#define MESSAGE_TEXT_ATTR	&topaz80_attr

	/* Globals */

struct IntuitionBase  *IntuitionBase;
struct Library        *IntuiSupBase;

	/* Statics */

STATIC struct NewWindow  test_new_window = {
   0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, 0, 1, WINDOW_IDCMP, WINDOW_FLAGS,
   NULL, NULL, WINDOW_TITLE, NULL, NULL, 0, 0, 0, 0, WBENCHSCREEN
};
STATIC struct TextAttr  topaz60_attr = { (STRPTR)"topaz.font", TOPAZ_SIXTY,
						   FS_NORMAL, FPF_ROMFONT },
			topaz80_attr = { (STRPTR)"topaz.font", TOPAZ_EIGHTY,
						   FS_NORMAL, FPF_ROMFONT };
	/* Defines for select list */

#define SELECT_ENTRY_BUTTON		0
#define SELECT_ENTRY_BUTTON_IMAGE	1
#define SELECT_ENTRY_CHECK		2
#define SELECT_ENTRY_MX			3
#define SELECT_ENTRY_STRING		4
#define SELECT_ENTRY_INTEGER		5
#define SELECT_ENTRY_SLIDER		6
#define SELECT_ENTRY_SCROLLER		7
#define SELECT_ENTRY_CYCLE		8
#define SELECT_ENTRY_COUNT		9
#define SELECT_ENTRY_LISTVIEW		10
#define SELECT_ENTRY_PALETTE		11
#define SELECT_ENTRY_AUTO_REQUESTER	12
#define SELECT_ENTRY_REQUESTER		13

	/* Defines for select gadgets */

#define SELECT_GADGET_LIST		0
#define SELECT_GADGET_DISABLED		1
#define SELECT_GADGET_NO_BORDER		2
#define SELECT_GADGET_HIGH_COMP		3
#define SELECT_GADGET_TEXT_COLOR2	4

#define SELECT_FLAG_DISABLED		(1 << 0)
#define SELECT_FLAG_NO_BORDER		(1 << 1)
#define SELECT_FLAG_HIGH_COMP		(1 << 2)
#define SELECT_FLAG_TEXT_COLOR2		(1 << 3)
#define SELECT_FLAG_CREATE_GADGETS	(1 << 4)

#define SELECT_GADGET1_TYPE		GADGET_DATA_TYPE_LISTVIEW
#define SELECT_GADGET1_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_LISTVIEW_SHOW_SELECTED)
#define SELECT_GADGET1_LEFT_EDGE	20
#define SELECT_GADGET1_TOP_EDGE		22
#define SELECT_GADGET1_WIDTH		200
#define SELECT_GADGET1_HEIGHT		(8 * 8 + 4)
#define SELECT_GADGET1_TEXT		"ISUP _objects"
#define SELECT_GADGET1_TEXT_ATTR	&topaz80_attr
#define SELECT_GADGET1_SPACING		0
#define SELECT_GADGET1_TOP		0
#define SELECT_GADGET1_LIST		(BYTE *)&select_list

#define SELECT_GADGET2_TYPE		GADGET_DATA_TYPE_CHECK
#define SELECT_GADGET2_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_TEXT_RIGHT)
#define SELECT_GADGET2_LEFT_EDGE	SELECT_GADGET1_LEFT_EDGE
#define SELECT_GADGET2_TOP_EDGE		(SELECT_GADGET1_TOP_EDGE + SELECT_GADGET1_HEIGHT + 10)
#define SELECT_GADGET2_WIDTH		22
#define SELECT_GADGET2_HEIGHT		11
#define SELECT_GADGET2_TEXT		"_Disabled"
#define SELECT_GADGET2_TEXT_ATTR	&topaz60_attr
#define SELECT_GADGET2_CHECK_STATE	0

#define SELECT_GADGET3_TYPE		GADGET_DATA_TYPE_CHECK
#define SELECT_GADGET3_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_TEXT_RIGHT)
#define SELECT_GADGET3_LEFT_EDGE	SELECT_GADGET1_LEFT_EDGE
#define SELECT_GADGET3_TOP_EDGE		(SELECT_GADGET2_TOP_EDGE + SELECT_GADGET2_HEIGHT + 5)
#define SELECT_GADGET3_WIDTH		22
#define SELECT_GADGET3_HEIGHT		11
#define SELECT_GADGET3_TEXT		"No _border"
#define SELECT_GADGET3_TEXT_ATTR	&topaz60_attr
#define SELECT_GADGET3_CHECK_STATE	0

#define SELECT_GADGET4_TYPE		GADGET_DATA_TYPE_CHECK
#define SELECT_GADGET4_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_TEXT_RIGHT)
#define SELECT_GADGET4_LEFT_EDGE	SELECT_GADGET1_LEFT_EDGE
#define SELECT_GADGET4_TOP_EDGE		(SELECT_GADGET3_TOP_EDGE + SELECT_GADGET3_HEIGHT + 5)
#define SELECT_GADGET4_WIDTH		22
#define SELECT_GADGET4_HEIGHT		11
#define SELECT_GADGET4_TEXT		"_Highcomp"
#define SELECT_GADGET4_TEXT_ATTR	&topaz60_attr
#define SELECT_GADGET4_CHECK_STATE	0

#define SELECT_GADGET5_TYPE		GADGET_DATA_TYPE_CHECK
#define SELECT_GADGET5_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_TEXT_RIGHT)
#define SELECT_GADGET5_LEFT_EDGE	SELECT_GADGET1_LEFT_EDGE
#define SELECT_GADGET5_TOP_EDGE		(SELECT_GADGET4_TOP_EDGE + SELECT_GADGET4_HEIGHT + 5)
#define SELECT_GADGET5_WIDTH		22
#define SELECT_GADGET5_HEIGHT		11
#define SELECT_GADGET5_TEXT		"_Text color 2"
#define SELECT_GADGET5_TEXT_ATTR	&topaz60_attr
#define SELECT_GADGET5_CHECK_STATE	0

	/* Statics for select gadgets */

STATIC BYTE *select_list_entries[] = {
	"Button",
	"Button with image",
	"Checkmark",
	"Mutual exclude gadget",
	"String gadget",
	"Integer gadget",
	"Slider",
	"Scroller",
	"Cycle gadget",
	"Count gadget",
	"Listview",
	"Palette",
	"Auto requester",
	"Requester",
	NULL
};
STATIC struct List  select_list;
STATIC struct GadgetData  select_gadget_data[] = {
   {
	SELECT_GADGET1_TYPE,		/* gd_Type */
	SELECT_GADGET1_FLAGS,		/* gd_Flags */
	SELECT_GADGET1_LEFT_EDGE,	/* gd_LeftEdge */
	SELECT_GADGET1_TOP_EDGE,	/* gd_TopEdge */
	SELECT_GADGET1_WIDTH,		/* gd_Width */
	SELECT_GADGET1_HEIGHT,		/* gd_Height */
	SELECT_GADGET1_TEXT,		/* *gd_Text */
	SELECT_GADGET1_TEXT_ATTR,	/* *gd_TextAttr */
	{
	SELECT_GADGET1_SPACING,		/* gd_ListViewSpacing */
	SELECT_GADGET1_TOP,		/* gd_ListViewTop */
	SELECT_GADGET1_LIST		/* gd_ListViewList */
	}
   }, {
	SELECT_GADGET2_TYPE,		/* gd_Type */
	SELECT_GADGET2_FLAGS,		/* gd_Flags */
	SELECT_GADGET2_LEFT_EDGE,	/* gd_LeftEdge */
	SELECT_GADGET2_TOP_EDGE,	/* gd_TopEdge */
	SELECT_GADGET2_WIDTH,		/* gd_Width */
	SELECT_GADGET2_HEIGHT,		/* gd_Height */
	SELECT_GADGET2_TEXT,		/* *gd_Text */
	SELECT_GADGET2_TEXT_ATTR,	/* *gd_TextAttr */
	{
	SELECT_GADGET2_CHECK_STATE,	/* gd_CheckState */
	0, 0 }
   }, {
	SELECT_GADGET3_TYPE,		/* gd_Type */
	SELECT_GADGET3_FLAGS,		/* gd_Flags */
	SELECT_GADGET3_LEFT_EDGE,	/* gd_LeftEdge */
	SELECT_GADGET3_TOP_EDGE,	/* gd_TopEdge */
	SELECT_GADGET3_WIDTH,		/* gd_Width */
	SELECT_GADGET3_HEIGHT,		/* gd_Height */
	SELECT_GADGET3_TEXT,		/* *gd_Text */
	SELECT_GADGET3_TEXT_ATTR,	/* *gd_TextAttr */
	{
	SELECT_GADGET3_CHECK_STATE,	/* gd_CheckState */
	0, 0 }
   }, {
	SELECT_GADGET4_TYPE,		/* gd_Type */
	SELECT_GADGET4_FLAGS,		/* gd_Flags */
	SELECT_GADGET4_LEFT_EDGE,	/* gd_LeftEdge */
	SELECT_GADGET4_TOP_EDGE,	/* gd_TopEdge */
	SELECT_GADGET4_WIDTH,		/* gd_Width */
	SELECT_GADGET4_HEIGHT,		/* gd_Height */
	SELECT_GADGET4_TEXT,		/* *gd_Text */
	SELECT_GADGET4_TEXT_ATTR,	/* *gd_TextAttr */
	{
	SELECT_GADGET4_CHECK_STATE,	/* gd_CheckState */
	0, 0 }
   }, {
	SELECT_GADGET5_TYPE,		/* gd_Type */
	SELECT_GADGET5_FLAGS,		/* gd_Flags */
	SELECT_GADGET5_LEFT_EDGE,	/* gd_LeftEdge */
	SELECT_GADGET5_TOP_EDGE,	/* gd_TopEdge */
	SELECT_GADGET5_WIDTH,		/* gd_Width */
	SELECT_GADGET5_HEIGHT,		/* gd_Height */
	SELECT_GADGET5_TEXT,		/* *gd_Text */
	SELECT_GADGET5_TEXT_ATTR,	/* *gd_TextAttr */
	{
	SELECT_GADGET5_CHECK_STATE,	/* gd_CheckState */
	0, 0 }
   }, {
	INTUISUP_DATA_END		/* end of gadget data array */
   }
};

	/* Defines for test gadgets */

#define TEST_AREA_LEFT_EDGE	(SELECT_GADGET1_LEFT_EDGE + SELECT_GADGET1_WIDTH + 20)
#define TEST_AREA_TOP_EDGE	0
#define TEST_AREA_WIDTH		(WINDOW_WIDTH - TEST_AREA_LEFT_EDGE)
#define TEST_AREA_HEIGHT	(WINDOW_HEIGHT - 28)

#define TEST0_GADGET1_TYPE		GADGET_DATA_TYPE_BUTTON
#define TEST0_GADGET1_FLAGS		GADGET_DATA_FLAG_HOTKEY
#define TEST0_GADGET1_LEFT_EDGE		(TEST_AREA_LEFT_EDGE + (TEST_AREA_WIDTH - TEST0_GADGET1_WIDTH) / 2)
#define TEST0_GADGET1_TOP_EDGE		(TEST_AREA_TOP_EDGE + (TEST_AREA_HEIGHT - TEST0_GADGET1_HEIGHT) / 2)
#define TEST0_GADGET1_WIDTH		((6 + 2) * 10)
#define TEST0_GADGET1_HEIGHT		19
#define TEST0_GADGET1_TEXT		"B_utton"
#define TEST0_GADGET1_TEXT_ATTR		&topaz60_attr

#define TEST1_GADGET1_TYPE		GADGET_DATA_TYPE_BUTTON
#define TEST1_GADGET1_FLAGS		(GADGET_DATA_FLAG_BUTTON_TOGGLE | GADGET_DATA_FLAG_BUTTON_IMAGE | GADGET_DATA_FLAG_NO_BORDER | GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_TEXT_RIGHT)
#define TEST1_GADGET1_LEFT_EDGE		(TEST_AREA_LEFT_EDGE + 80)
#define TEST1_GADGET1_TOP_EDGE		(TEST_AREA_TOP_EDGE + (TEST_AREA_HEIGHT - TEST1_GADGET1_HEIGHT) / 2)
#define TEST1_GADGET1_WIDTH		16
#define TEST1_GADGET1_HEIGHT		8
#define TEST1_GADGET1_TEXT		"B_utton with image"
#define TEST1_GADGET1_TEXT_ATTR		&topaz60_attr
#define TEST1_GADGET1_NORMAL_RENDER	NULL	/* (LONG)&image1 */
#define TEST1_GADGET1_SELECT_RENDER	(BYTE *)&image2

#define TEST2_GADGET1_TYPE		GADGET_DATA_TYPE_CHECK
#define TEST2_GADGET1_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_TEXT_RIGHT | GADGET_DATA_FLAG_NO_BORDER | GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_TEXT_RIGHT)
#define TEST2_GADGET1_LEFT_EDGE		(TEST_AREA_LEFT_EDGE + 100)
#define TEST2_GADGET1_TOP_EDGE		(TEST_AREA_TOP_EDGE + (TEST_AREA_HEIGHT - TEST2_GADGET1_HEIGHT) / 2)
#define TEST2_GADGET1_WIDTH		22
#define TEST2_GADGET1_HEIGHT		11
#define TEST2_GADGET1_TEXT		"_Check gadget"
#define TEST2_GADGET1_TEXT_ATTR		&topaz60_attr
#define TEST2_GADGET1_CHECK_STATE	1

#define TEST3_GADGET1_TYPE		GADGET_DATA_TYPE_MX
#define TEST3_GADGET1_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_TEXT_LEFT)
#define TEST3_GADGET1_LEFT_EDGE		(TEST_AREA_LEFT_EDGE + (TEST_AREA_WIDTH - TEST3_GADGET1_WIDTH) / 2)
#define TEST3_GADGET1_TOP_EDGE		(TEST_AREA_TOP_EDGE + (TEST_AREA_HEIGHT - TEST3_GADGET1_HEIGHT) / 2)
#define TEST3_GADGET1_WIDTH		220
#define TEST3_GADGET1_HEIGHT		40
#define TEST3_GADGET1_TEXT		"Mutual e_xclude gadget"
#define TEST3_GADGET1_TEXT_ATTR		&topaz60_attr
#define TEST3_GADGET1_SPACING		2
#define TEST3_GADGET1_ACTIVE		1
#define TEST3_GADGET1_TEXT_ARRAY	&mx_array[0]

#define TEST4_GADGET1_TYPE		GADGET_DATA_TYPE_STRING
#define TEST4_GADGET1_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_INPUT_AUTO_ACTIVATE | GADGET_DATA_FLAG_TEXT_LEFT)
#define TEST4_GADGET1_LEFT_EDGE		(TEST_AREA_LEFT_EDGE + 140)
#define TEST4_GADGET1_TOP_EDGE		(TEST_AREA_TOP_EDGE + (TEST_AREA_HEIGHT - TEST4_GADGET1_HEIGHT - 10 - TEST4_GADGET2_HEIGHT) / 2)
#define TEST4_GADGET1_WIDTH		(6 * 8 + 2 * 6)
#define TEST4_GADGET1_HEIGHT		(8 + 2 * 3)
#define TEST4_GADGET1_TEXT		"String gadget _1"
#define TEST4_GADGET1_TEXT_ATTR		&topaz80_attr
#define TEST4_GADGET1_INPUT_LEN		10
#define TEST4_GADGET1_AUTO_ACTIVATE	INPUT_AUTO_ACTIVATE(1,1)
#define TEST4_GADGET1_INPUT_DEFAULT	"Test 1"

#define TEST4_GADGET2_TYPE		GADGET_DATA_TYPE_STRING
#define TEST4_GADGET2_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_INPUT_AUTO_ACTIVATE | GADGET_DATA_FLAG_TEXT_RIGHT)
#define TEST4_GADGET2_LEFT_EDGE		TEST4_GADGET1_LEFT_EDGE
#define TEST4_GADGET2_TOP_EDGE		(TEST4_GADGET1_TOP_EDGE + TEST4_GADGET1_HEIGHT + 10)
#define TEST4_GADGET2_WIDTH		TEST4_GADGET1_WIDTH
#define TEST4_GADGET2_HEIGHT		TEST4_GADGET1_HEIGHT
#define TEST4_GADGET2_TEXT		"String gadget _2"
#define TEST4_GADGET2_TEXT_ATTR		TEST4_GADGET1_TEXT_ATTR
#define TEST4_GADGET2_INPUT_LEN		TEST4_GADGET1_INPUT_LEN
#define TEST4_GADGET2_AUTO_ACTIVATE	INPUT_AUTO_ACTIVATE(0,0)
#define TEST4_GADGET2_INPUT_DEFAULT	"Test 2"

#define TEST5_GADGET1_TYPE		GADGET_DATA_TYPE_INTEGER
#define TEST5_GADGET1_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_INPUT_AUTO_ACTIVATE | GADGET_DATA_FLAG_TEXT_LEFT)
#define TEST5_GADGET1_LEFT_EDGE		(TEST_AREA_LEFT_EDGE + 140)
#define TEST5_GADGET1_TOP_EDGE		(TEST_AREA_TOP_EDGE + (TEST_AREA_HEIGHT - TEST4_GADGET1_HEIGHT - 10 - TEST4_GADGET2_HEIGHT) / 2)
#define TEST5_GADGET1_WIDTH		(6 * 8 + 2 * 6)
#define TEST5_GADGET1_HEIGHT		(8 + 2 * 3)
#define TEST5_GADGET1_TEXT		"Integer gadget _1"
#define TEST5_GADGET1_TEXT_ATTR		&topaz80_attr
#define TEST5_GADGET1_INPUT_LEN		10
#define TEST5_GADGET1_AUTO_ACTIVATE	INPUT_AUTO_ACTIVATE(1,1)
#define TEST5_GADGET1_INPUT_DEFAULT	(VOID *)1L

#define TEST5_GADGET2_TYPE		GADGET_DATA_TYPE_INTEGER
#define TEST5_GADGET2_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_INPUT_AUTO_ACTIVATE | GADGET_DATA_FLAG_TEXT_RIGHT)
#define TEST5_GADGET2_LEFT_EDGE		TEST5_GADGET1_LEFT_EDGE
#define TEST5_GADGET2_TOP_EDGE		(TEST5_GADGET1_TOP_EDGE + TEST5_GADGET1_HEIGHT + 10)
#define TEST5_GADGET2_WIDTH		TEST5_GADGET1_WIDTH
#define TEST5_GADGET2_HEIGHT		TEST5_GADGET1_HEIGHT
#define TEST5_GADGET2_TEXT		"Integer gadget _2"
#define TEST5_GADGET2_TEXT_ATTR		TEST5_GADGET1_TEXT_ATTR
#define TEST5_GADGET2_INPUT_LEN		TEST5_GADGET1_INPUT_LEN
#define TEST5_GADGET2_AUTO_ACTIVATE	INPUT_AUTO_ACTIVATE(0,0)
#define TEST5_GADGET2_INPUT_DEFAULT	(VOID *)2L

#define TEST6_GADGET1_TYPE		GADGET_DATA_TYPE_SLIDER
#define TEST6_GADGET1_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_TEXT_RIGHT)
#define TEST6_GADGET1_LEFT_EDGE		(TEST_AREA_LEFT_EDGE + 40)
#define TEST6_GADGET1_TOP_EDGE		(TEST_AREA_TOP_EDGE + 120)
#define TEST6_GADGET1_WIDTH		100
#define TEST6_GADGET1_HEIGHT		9
#define TEST6_GADGET1_TEXT		"_Slider gadget 1"
#define TEST6_GADGET1_TEXT_ATTR		&topaz60_attr
#define TEST6_GADGET1_MIN		-10
#define TEST6_GADGET1_MAX		10
#define TEST6_GADGET1_LEVEL		0

#define TEST6_GADGET2_TYPE		GADGET_DATA_TYPE_SLIDER
#define TEST6_GADGET2_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_ORIENTATION_VERT | GADGET_DATA_FLAG_TEXT_ABOVE)
#define TEST6_GADGET2_LEFT_EDGE		(TEST_AREA_LEFT_EDGE + 180)
#define TEST6_GADGET2_TOP_EDGE		(TEST_AREA_TOP_EDGE + 50)
#define TEST6_GADGET2_WIDTH		18
#define TEST6_GADGET2_HEIGHT		50
#define TEST6_GADGET2_TEXT		"S_lider gadget 2"
#define TEST6_GADGET2_TEXT_ATTR		&topaz60_attr
#define TEST6_GADGET2_MIN		-10
#define TEST6_GADGET2_MAX		10
#define TEST6_GADGET2_LEVEL		0

#define TEST7_GADGET1_TYPE		GADGET_DATA_TYPE_SCROLLER
#define TEST7_GADGET1_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_TEXT_LEFT)
#define TEST7_GADGET1_LEFT_EDGE		(TEST_AREA_LEFT_EDGE + 200)
#define TEST7_GADGET1_TOP_EDGE		(TEST_AREA_TOP_EDGE + 120)
#define TEST7_GADGET1_WIDTH		100
#define TEST7_GADGET1_HEIGHT		0
#define TEST7_GADGET1_TEXT		"_Scroller gadget 1"
#define TEST7_GADGET1_TEXT_ATTR		&topaz60_attr
#define TEST7_GADGET1_VISIBLE		4
#define TEST7_GADGET1_TOTAL		20
#define TEST7_GADGET1_TOP		(BYTE *)10

#define TEST7_GADGET2_TYPE		GADGET_DATA_TYPE_SCROLLER
#define TEST7_GADGET2_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_ORIENTATION_VERT | GADGET_DATA_FLAG_TEXT_ABOVE)
#define TEST7_GADGET2_LEFT_EDGE		(TEST_AREA_LEFT_EDGE + 180)
#define TEST7_GADGET2_TOP_EDGE		(TEST_AREA_TOP_EDGE + 50)
#define TEST7_GADGET2_WIDTH		0
#define TEST7_GADGET2_HEIGHT		50
#define TEST7_GADGET2_TEXT		"S_croller gadget 2"
#define TEST7_GADGET2_TEXT_ATTR		&topaz60_attr
#define TEST7_GADGET2_VISIBLE		4
#define TEST7_GADGET2_TOTAL		20
#define TEST7_GADGET2_TOP		(BYTE *)10

#define TEST8_GADGET1_TYPE		GADGET_DATA_TYPE_CYCLE
#define TEST8_GADGET1_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_TEXT_ABOVE)
#define TEST8_GADGET1_LEFT_EDGE		(TEST_AREA_LEFT_EDGE + (TEST_AREA_WIDTH - TEST8_GADGET1_WIDTH) / 2)
#define TEST8_GADGET1_TOP_EDGE		(TEST_AREA_TOP_EDGE + (TEST_AREA_HEIGHT - TEST8_GADGET1_HEIGHT) / 2)
#define TEST8_GADGET1_WIDTH		160
#define TEST8_GADGET1_HEIGHT		15
#define TEST8_GADGET1_TEXT		"_Cycle gadget"
#define TEST8_GADGET1_TEXT_ATTR		&topaz60_attr
#define TEST8_GADGET1_SPACING		1
#define TEST8_GADGET1_ACTIVE		2
#define TEST8_GADGET1_TEXT_ARRAY	&cycle_text_array[0]

#define TEST9_GADGET1_TYPE		GADGET_DATA_TYPE_COUNT
#define TEST9_GADGET1_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_TEXT_LEFT)
#define TEST9_GADGET1_LEFT_EDGE		(TEST_AREA_LEFT_EDGE + 200)
#define TEST9_GADGET1_TOP_EDGE		(TEST_AREA_TOP_EDGE + (TEST_AREA_HEIGHT - TEST9_GADGET1_HEIGHT) / 2)
#define TEST9_GADGET1_WIDTH		80
#define TEST9_GADGET1_HEIGHT		12
#define TEST9_GADGET1_TEXT		"_Count gadget"
#define TEST9_GADGET1_TEXT_ATTR		&topaz80_attr
#define TEST9_GADGET1_MIN		100
#define TEST9_GADGET1_MAX		1000
#define TEST9_GADGET1_VALUE		(BYTE *)600

#define TEST10_GADGET1_TYPE		GADGET_DATA_TYPE_LISTVIEW
#define TEST10_GADGET1_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_LISTVIEW_SHOW_SELECTED)
#define TEST10_GADGET1_LEFT_EDGE	(TEST_AREA_LEFT_EDGE + (TEST_AREA_WIDTH - TEST10_GADGET1_WIDTH) / 2)
#define TEST10_GADGET1_TOP_EDGE		(TEST_AREA_TOP_EDGE + (TEST_AREA_HEIGHT - TEST10_GADGET1_HEIGHT) / 2)
#define TEST10_GADGET1_WIDTH		160
#define TEST10_GADGET1_HEIGHT		(4 * 9 + 2 * 4)
#define TEST10_GADGET1_TEXT		"_List view gadget"
#define TEST10_GADGET1_TEXT_ATTR	&topaz60_attr
#define TEST10_GADGET1_SPACING		0
#define TEST10_GADGET1_TOP		1
#define TEST10_GADGET1_LIST		(BYTE *)&test_list

#define TEST11_GADGET1_TYPE		GADGET_DATA_TYPE_PALETTE
#define TEST11_GADGET1_FLAGS		GADGET_DATA_FLAG_HOTKEY
#define TEST11_GADGET1_LEFT_EDGE	(TEST_AREA_LEFT_EDGE + (TEST_AREA_WIDTH - TEST11_GADGET1_WIDTH) / 2)
#define TEST11_GADGET1_TOP_EDGE		(TEST_AREA_TOP_EDGE + 30)
#define TEST11_GADGET1_WIDTH		160
#define TEST11_GADGET1_HEIGHT		20
#define TEST11_GADGET1_TEXT		"_Palette gadget"
#define TEST11_GADGET1_TEXT_ATTR	&topaz60_attr
#define TEST11_GADGET1_DEPTH		2
#define TEST11_GADGET1_COLOR_OFFSET	0
#define TEST11_GADGET1_ACTIVE_COLOR	(BYTE *)0

#define TEST11_GADGET2_TYPE		GADGET_DATA_TYPE_PALETTE
#define TEST11_GADGET2_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_PALETTE_INDICATOR_TOP)
#define TEST11_GADGET2_LEFT_EDGE	(TEST_AREA_LEFT_EDGE + (TEST_AREA_WIDTH - TEST11_GADGET2_WIDTH) / 2)
#define TEST11_GADGET2_TOP_EDGE		(TEST_AREA_TOP_EDGE + 70)
#define TEST11_GADGET2_WIDTH		40
#define TEST11_GADGET2_HEIGHT		80
#define TEST11_GADGET2_TEXT		"P_alette gadget"
#define TEST11_GADGET2_TEXT_ATTR	&topaz60_attr
#define TEST11_GADGET2_DEPTH		2
#define TEST11_GADGET2_COLOR_OFFSET	0
#define TEST11_GADGET2_ACTIVE_COLOR	(BYTE *)0

	/* Statics for test gadgets */

STATIC struct GadgetData  test0_gadget_data[] = {
   {
	TEST0_GADGET1_TYPE,		/* gd_Type */
	TEST0_GADGET1_FLAGS,		/* gd_Flags */
	TEST0_GADGET1_LEFT_EDGE,	/* gd_LeftEdge */
	TEST0_GADGET1_TOP_EDGE,		/* gd_TopEdge */
	TEST0_GADGET1_WIDTH,		/* gd_Width */
	TEST0_GADGET1_HEIGHT,		/* gd_Height */
	TEST0_GADGET1_TEXT,		/* *gd_Text */
	TEST0_GADGET1_TEXT_ATTR,	/* *gd_TextAttr */
	{ 0, 0, 0 }
   }, {
	INTUISUP_DATA_END		/* end of gadget data array */
   }
};
STATIC UWORD image1_data[] = {
	0xffff, 0x8000, 0xbff0, 0xa00c, 0xa00c, 0xbff0, 0x8000, 0x8000,
	0x0000, 0x0001, 0x0005, 0x1ff1, 0x1ff1, 0x0005, 0x0001, 0x7fff
};
STATIC struct Image  image1 = { 0, 0, 16, 8, 2, &image1_data[0], 3, 0, NULL };
STATIC UWORD image2_data[] = {
	0x0000, 0x000f, 0x3fff, 0x23fd, 0x3fcd, 0x7ff1, 0x7001, 0x7fff,
	0xffff, 0x800e, 0x807e, 0x9ff8, 0x9ff0, 0xfe04, 0xf000, 0x8000
};
STATIC struct Image  image2 = { 0, 0, 16, 8, 2, &image2_data[0], 3, 0, NULL };
STATIC struct GadgetData  test1_gadget_data[] = {
   {
	TEST1_GADGET1_TYPE,		/* gd_Type */
	TEST1_GADGET1_FLAGS,		/* gd_Flags */
	TEST1_GADGET1_LEFT_EDGE,	/* gd_LeftEdge */
	TEST1_GADGET1_TOP_EDGE,		/* gd_TopEdge */
	TEST1_GADGET1_WIDTH,		/* gd_Width */
	TEST1_GADGET1_HEIGHT,		/* gd_Height */
	TEST1_GADGET1_TEXT,		/* *gd_Text */
	TEST1_GADGET1_TEXT_ATTR,	/* *gd_TextAttr */
	{ 0,
	TEST1_GADGET1_NORMAL_RENDER,	/* gd_ButtonNormalRender */
	TEST1_GADGET1_SELECT_RENDER	/* gd_ButtonSelectRender */
	}
   }, {
	INTUISUP_DATA_END		/* end of gadget data array */
   }
};
STATIC struct GadgetData  test2_gadget_data[] = {
   {
	TEST2_GADGET1_TYPE,		/* gd_Type */
	TEST2_GADGET1_FLAGS,		/* gd_Flags */
	TEST2_GADGET1_LEFT_EDGE,	/* gd_LeftEdge */
	TEST2_GADGET1_TOP_EDGE,		/* gd_TopEdge */
	TEST2_GADGET1_WIDTH,		/* gd_Width */
	TEST2_GADGET1_HEIGHT,		/* gd_Height */
	TEST2_GADGET1_TEXT,		/* *gd_Text */
	TEST2_GADGET1_TEXT_ATTR,	/* *gd_TextAttr */
	{
	TEST2_GADGET1_CHECK_STATE,	/* gd_CheckState */
	0, 0 }
   }, {
	INTUISUP_DATA_END		/* end of gadget data array */
   }
};
STATIC BYTE *mx_array[] = {
	"Fast File System", "Old File System", "Custom File System", NULL
};
STATIC struct GadgetData  test3_gadget_data[] = {
   {
	TEST3_GADGET1_TYPE,		/* gd_Type */
	TEST3_GADGET1_FLAGS,		/* gd_Flags */
	TEST3_GADGET1_LEFT_EDGE,	/* gd_LeftEdge */
	TEST3_GADGET1_TOP_EDGE,		/* gd_TopEdge */
	TEST3_GADGET1_WIDTH,		/* gd_Width */
	TEST3_GADGET1_HEIGHT,		/* gd_Height */
	TEST3_GADGET1_TEXT,		/* *gd_Text */
	TEST3_GADGET1_TEXT_ATTR,	/* *gd_TextAttr */
	{
	TEST3_GADGET1_SPACING,		/* gd_MXSpacing */
	TEST3_GADGET1_ACTIVE,		/* gd_MXActiveEntry */
	TEST3_GADGET1_TEXT_ARRAY	/* gd_MXTextArray */
	}
   }, {
	INTUISUP_DATA_END		/* end of gadget data array */
   }
};
STATIC struct GadgetData  test4_gadget_data[] = {
   {
	TEST4_GADGET1_TYPE,		/* gd_Type */
	TEST4_GADGET1_FLAGS,		/* gd_Flags */
	TEST4_GADGET1_LEFT_EDGE,	/* gd_LeftEdge */
	TEST4_GADGET1_TOP_EDGE,		/* gd_TopEdge */
	TEST4_GADGET1_WIDTH,		/* gd_Width */
	TEST4_GADGET1_HEIGHT,		/* gd_Height */
	TEST4_GADGET1_TEXT,		/* *gd_Text */
	TEST4_GADGET1_TEXT_ATTR,	/* *gd_TextAttr */
	{
	TEST4_GADGET1_INPUT_LEN,	/* gd_InputLen */
	TEST4_GADGET1_AUTO_ACTIVATE,	/* gd_InputActivatePrev/Next */
	TEST4_GADGET1_INPUT_DEFAULT	/* gd_InputDefault */
	}
   }, {
	TEST4_GADGET2_TYPE,		/* gd_Type */
	TEST4_GADGET2_FLAGS,		/* gd_Flags */
	TEST4_GADGET2_LEFT_EDGE,	/* gd_LeftEdge */
	TEST4_GADGET2_TOP_EDGE,		/* gd_TopEdge */
	TEST4_GADGET2_WIDTH,		/* gd_Width */
	TEST4_GADGET2_HEIGHT,		/* gd_Height */
	TEST4_GADGET2_TEXT,		/* *gd_Text */
	TEST4_GADGET2_TEXT_ATTR,	/* *gd_TextAttr */
	{
	TEST4_GADGET2_INPUT_LEN,	/* gd_InputLen */
	TEST4_GADGET2_AUTO_ACTIVATE,	/* gd_InputActivatePrev/Next */
	TEST4_GADGET2_INPUT_DEFAULT	/* gd_InputDefault */
	}
   }, {
	INTUISUP_DATA_END		/* end of gadget data array */
   }
};
STATIC struct GadgetData  test5_gadget_data[] = {
   {
	TEST5_GADGET1_TYPE,		/* gd_Type */
	TEST5_GADGET1_FLAGS,		/* gd_Flags */
	TEST5_GADGET1_LEFT_EDGE,	/* gd_LeftEdge */
	TEST5_GADGET1_TOP_EDGE,		/* gd_TopEdge */
	TEST5_GADGET1_WIDTH,		/* gd_Width */
	TEST5_GADGET1_HEIGHT,		/* gd_Height */
	TEST5_GADGET1_TEXT,		/* *gd_Text */
	TEST5_GADGET1_TEXT_ATTR,	/* *gd_TextAttr */
	{
	TEST5_GADGET1_INPUT_LEN,	/* gd_InputLen */
	TEST5_GADGET1_AUTO_ACTIVATE,	/* gd_InputActivatePrev/Next */
	TEST5_GADGET1_INPUT_DEFAULT	/* gd_InputDefault */
	}
   }, {
	TEST5_GADGET2_TYPE,		/* gd_Type */
	TEST5_GADGET2_FLAGS,		/* gd_Flags */
	TEST5_GADGET2_LEFT_EDGE,	/* gd_LeftEdge */
	TEST5_GADGET2_TOP_EDGE,		/* gd_TopEdge */
	TEST5_GADGET2_WIDTH,		/* gd_Width */
	TEST5_GADGET2_HEIGHT,		/* gd_Height */
	TEST5_GADGET2_TEXT,		/* *gd_Text */
	TEST5_GADGET2_TEXT_ATTR,	/* *gd_TextAttr */
	{
	TEST5_GADGET2_INPUT_LEN,	/* gd_InputLen */
	TEST5_GADGET2_AUTO_ACTIVATE,	/* gd_InputActivatePrev/Next */
	TEST5_GADGET2_INPUT_DEFAULT	/* gd_InputDefault */
	}
   }, {
	INTUISUP_DATA_END		/* end of gadget data array */
   }
};
STATIC struct GadgetData  test6_gadget_data[] = {
   {
	TEST6_GADGET1_TYPE,		/* gd_Type */
	TEST6_GADGET1_FLAGS,		/* gd_Flags */
	TEST6_GADGET1_LEFT_EDGE,	/* gd_LeftEdge */
	TEST6_GADGET1_TOP_EDGE,		/* gd_TopEdge */
	TEST6_GADGET1_WIDTH,		/* gd_Width */
	TEST6_GADGET1_HEIGHT,		/* gd_Height */
	TEST6_GADGET1_TEXT,		/* *gd_Text */
	TEST6_GADGET1_TEXT_ATTR,	/* *gd_TextAttr */
	{
	TEST6_GADGET1_MIN,		/* gd_SliderMin */
	TEST6_GADGET1_MAX,		/* gd_SliderMax */
	TEST6_GADGET1_LEVEL		/* gd_SliderLevel */
	}
   }, {
	TEST6_GADGET2_TYPE,		/* gd_Type */
	TEST6_GADGET2_FLAGS,		/* gd_Flags */
	TEST6_GADGET2_LEFT_EDGE,	/* gd_LeftEdge */
	TEST6_GADGET2_TOP_EDGE,		/* gd_TopEdge */
	TEST6_GADGET2_WIDTH,		/* gd_Width */
	TEST6_GADGET2_HEIGHT,		/* gd_Height */
	TEST6_GADGET2_TEXT,		/* *gd_Text */
	TEST6_GADGET2_TEXT_ATTR,	/* *gd_TextAttr */
	{
	TEST6_GADGET2_MIN,		/* gd_SliderMin */
	TEST6_GADGET2_MAX,		/* gd_SliderMax */
	TEST6_GADGET2_LEVEL		/* gd_SliderLevel */
	}
   }, {
	INTUISUP_DATA_END		/* end of gadget data array */
   }
};
STATIC struct GadgetData  test7_gadget_data[] = {
   {
	TEST7_GADGET1_TYPE,		/* gd_Type */
	TEST7_GADGET1_FLAGS,		/* gd_Flags */
	TEST7_GADGET1_LEFT_EDGE,	/* gd_LeftEdge */
	TEST7_GADGET1_TOP_EDGE,		/* gd_TopEdge */
	TEST7_GADGET1_WIDTH,		/* gd_Width */
	TEST7_GADGET1_HEIGHT,		/* gd_Height */
	TEST7_GADGET1_TEXT,		/* *gd_Text */
	TEST7_GADGET1_TEXT_ATTR,	/* *gd_TextAttr */
	{
	TEST7_GADGET1_VISIBLE,		/* gd_ScrollerVisible */
	TEST7_GADGET1_TOTAL,		/* gd_ScrollerTotal */
	TEST7_GADGET1_TOP		/* gd_ScrollerTop */
	}
   }, {
	TEST7_GADGET2_TYPE,		/* gd_Type */
	TEST7_GADGET2_FLAGS,		/* gd_Flags */
	TEST7_GADGET2_LEFT_EDGE,	/* gd_LeftEdge */
	TEST7_GADGET2_TOP_EDGE,		/* gd_TopEdge */
	TEST7_GADGET2_WIDTH,		/* gd_Width */
	TEST7_GADGET2_HEIGHT,		/* gd_Height */
	TEST7_GADGET2_TEXT,		/* *gd_Text */
	TEST7_GADGET2_TEXT_ATTR,	/* *gd_TextAttr */
	{
	TEST7_GADGET2_VISIBLE,		/* gd_ScrollerVisible */
	TEST7_GADGET2_TOTAL,		/* gd_ScrollerTotal */
	TEST7_GADGET2_TOP		/* gd_ScrollerTop */
	}
   }, {
	INTUISUP_DATA_END		/* end of gadget data array */
   }
};
STATIC BYTE *cycle_text_array[] = {
	"Amiga", "Workbench", "AmigaDOS", "Multitasking", "CLI", "ARexx",
	"TeX", "Unix", NULL
};
STATIC struct GadgetData  test8_gadget_data[] = {
   {
	TEST8_GADGET1_TYPE,		/* gd_Type */
	TEST8_GADGET1_FLAGS,		/* gd_Flags */
	TEST8_GADGET1_LEFT_EDGE,	/* gd_LeftEdge */
	TEST8_GADGET1_TOP_EDGE,		/* gd_TopEdge */
	TEST8_GADGET1_WIDTH,		/* gd_Width */
	TEST8_GADGET1_HEIGHT,		/* gd_Height */
	TEST8_GADGET1_TEXT,		/* *gd_Text */
	TEST8_GADGET1_TEXT_ATTR,	/* *gd_TextAttr */
	{
	TEST8_GADGET1_SPACING,		/* gd_CycleSpacing */
	TEST8_GADGET1_ACTIVE,		/* gd_CycleActive */
	TEST8_GADGET1_TEXT_ARRAY	/* gd_CycleTextArray */
	}
   }, {
	INTUISUP_DATA_END		/* end of gadget data array */
   }
};
STATIC struct GadgetData  test9_gadget_data[] = {
   {
	TEST9_GADGET1_TYPE,		/* gd_Type */
	TEST9_GADGET1_FLAGS,		/* gd_Flags */
	TEST9_GADGET1_LEFT_EDGE,	/* gd_LeftEdge */
	TEST9_GADGET1_TOP_EDGE,		/* gd_TopEdge */
	TEST9_GADGET1_WIDTH,		/* gd_Width */
	TEST9_GADGET1_HEIGHT,		/* gd_Height */
	TEST9_GADGET1_TEXT,		/* *gd_Text */
	TEST9_GADGET1_TEXT_ATTR,	/* *gd_TextAttr */
	{
	TEST9_GADGET1_MIN,		/* gd_CountMin */
	TEST9_GADGET1_MAX,		/* gd_CountMax */
	TEST9_GADGET1_VALUE		/* gd_CountValue */
	}
   }, {
	INTUISUP_DATA_END		/* end of gadget data array */
   }
};
STATIC struct List  test_list;
STATIC struct GadgetData  test10_gadget_data[] = {
   {
	TEST10_GADGET1_TYPE,		/* gd_Type */
	TEST10_GADGET1_FLAGS,		/* gd_Flags */
	TEST10_GADGET1_LEFT_EDGE,	/* gd_LeftEdge */
	TEST10_GADGET1_TOP_EDGE,	/* gd_TopEdge */
	TEST10_GADGET1_WIDTH,		/* gd_Width */
	TEST10_GADGET1_HEIGHT,		/* gd_Height */
	TEST10_GADGET1_TEXT,		/* *gd_Text */
	TEST10_GADGET1_TEXT_ATTR,	/* *gd_TextAttr */
	{
	TEST10_GADGET1_SPACING,		/* gd_ListViewSpacing */
	TEST10_GADGET1_TOP,		/* gd_ListViewTop */
	TEST10_GADGET1_LIST		/* gd_ListViewList */
	}
   }, {
	INTUISUP_DATA_END		/* end of gadget data array */
   }
};
STATIC struct GadgetData  test11_gadget_data[] = {
   {
	TEST11_GADGET1_TYPE,		/* gd_Type */
	TEST11_GADGET1_FLAGS,		/* gd_Flags */
	TEST11_GADGET1_LEFT_EDGE,	/* gd_LeftEdge */
	TEST11_GADGET1_TOP_EDGE,	/* gd_TopEdge */
	TEST11_GADGET1_WIDTH,		/* gd_Width */
	TEST11_GADGET1_HEIGHT,		/* gd_Height */
	TEST11_GADGET1_TEXT,		/* *gd_Text */
	TEST11_GADGET1_TEXT_ATTR,	/* *gd_TextAttr */
	{
	TEST11_GADGET1_DEPTH,		/* gd_PaletteDepth */
	TEST11_GADGET1_COLOR_OFFSET,	/* gd_PaletteColorOffset */
	TEST11_GADGET1_ACTIVE_COLOR	/* gd_PaletteActiveColor */
	}
   }, {
	TEST11_GADGET2_TYPE,		/* gd_Type */
	TEST11_GADGET2_FLAGS,		/* gd_Flags */
	TEST11_GADGET2_LEFT_EDGE,	/* gd_LeftEdge */
	TEST11_GADGET2_TOP_EDGE,	/* gd_TopEdge */
	TEST11_GADGET2_WIDTH,		/* gd_Width */
	TEST11_GADGET2_HEIGHT,		/* gd_Height */
	TEST11_GADGET2_TEXT,		/* *gd_Text */
	TEST11_GADGET2_TEXT_ATTR,	/* *gd_TextAttr */
	{
	TEST11_GADGET2_DEPTH,		/* gd_PaletteDepth */
	TEST11_GADGET2_COLOR_OFFSET,	/* gd_PaletteColorOffset */
	TEST11_GADGET2_ACTIVE_COLOR	/* gd_PaletteActiveColor */
	}
   }, {
	INTUISUP_DATA_END		/* end of gadget data array */
   }
};
STATIC struct GadgetData  *test_gadget_array[] = {
	&test0_gadget_data[0],
	&test1_gadget_data[0],
	&test2_gadget_data[0],
	&test3_gadget_data[0],
	&test4_gadget_data[0],
	&test5_gadget_data[0],
	&test6_gadget_data[0],
	&test7_gadget_data[0],
	&test8_gadget_data[0],
	&test9_gadget_data[0],
	&test10_gadget_data[0],
	&test11_gadget_data[0],
	NULL,
	NULL
};
	/* Defines for auto request */

#define TEST_AUTO_REQ_TITLE		" Auto Request "
#define TEST_AUTO_REQ_BODY_TEXT		"Test line 1\\n\\nTest line 2\\nTest line 3\\n\\nTest line 4"
#define TEST_AUTO_REQ_POS_TEXT		"_Positive"
#define TEST_AUTO_REQ_NEG_TEXT		"_Negative"
#define TEST_AUTO_REQ_FLAGS		(AUTO_REQ_FLAG_BACK_FILL | AUTO_REQ_FLAG_TEXT_CENTER | AUTO_REQ_FLAG_TEXT_COLOR2 | AUTO_REQ_FLAG_HOTKEY | AUTO_REQ_FLAG_CENTER_MOUSE | AUTO_REQ_FLAG_DRAW_RASTER)

	/* Defines for requester */

#define TEST_REQ_WIDTH		200
#define TEST_REQ_HEIGHT		100
#define TEST_REQ_FLAGS		(REQ_DATA_FLAG_BACK_FILL | REQ_DATA_FLAG_CENTER_WINDOW | REQ_DATA_FLAG_INNER_WINDOW)
#define TEST_REQ_TITLE		" Requester "

#define TEST_REQ_TEXT1_TYPE		TEXT_DATA_TYPE_TEXT
#define TEST_REQ_TEXT1_FLAGS		(TEXT_DATA_FLAG_CENTER | TEXT_DATA_FLAG_BOLD)
#define TEST_REQ_TEXT1_LEFT_EDGE	0
#define TEST_REQ_TEXT1_TOP_EDGE		20
#define TEST_REQ_TEXT1_TEXT		"Text Line 1"
#define TEST_REQ_TEXT1_TEXT_ATTR	&topaz60_attr

#define TEST_REQ_TEXT2_TYPE		TEXT_DATA_TYPE_TEXT
#define TEST_REQ_TEXT2_FLAGS		(TEXT_DATA_FLAG_CENTER | TEXT_DATA_FLAG_ITALIC | TEXT_DATA_FLAG_COLOR2)
#define TEST_REQ_TEXT2_LEFT_EDGE	0
#define TEST_REQ_TEXT2_TOP_EDGE		(TEST_REQ_TEXT1_TOP_EDGE + 10)
#define TEST_REQ_TEXT2_TEXT		"Text Line 2"
#define TEST_REQ_TEXT2_TEXT_ATTR	&topaz80_attr

#define TEST_REQ_TEXT3_TYPE		TEXT_DATA_TYPE_TEXT
#define TEST_REQ_TEXT3_FLAGS		(TEXT_DATA_FLAG_CENTER | TEXT_DATA_FLAG_UNDERLINED)
#define TEST_REQ_TEXT3_LEFT_EDGE	0
#define TEST_REQ_TEXT3_TOP_EDGE		(TEST_REQ_TEXT2_TOP_EDGE + 10)
#define TEST_REQ_TEXT3_TEXT		"Text Line 3"
#define TEST_REQ_TEXT3_TEXT_ATTR	&topaz80_attr

#define TEST_REQ_BORDER1_TYPE		BORDER_DATA_TYPE_BOX2_OUT
#define TEST_REQ_BORDER1_LEFT_EDGE	20
#define TEST_REQ_BORDER1_TOP_EDGE	10
#define TEST_REQ_BORDER1_WIDTH		(TEST_REQ_WIDTH - 2 * TEST_REQ_BORDER1_LEFT_EDGE)
#define TEST_REQ_BORDER1_HEIGHT		(TEST_REQ_HEIGHT - (3 * TEST_REQ_BORDER1_TOP_EDGE + TEST_REQ_GADGET1_HEIGHT))

#define TEST_REQ_GADGET1_TYPE		GADGET_DATA_TYPE_BUTTON
#define TEST_REQ_GADGET1_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_MOVE_POINTER)
#define TEST_REQ_GADGET1_LEFT_EDGE	((TEST_REQ_WIDTH - TEST_REQ_GADGET1_WIDTH) / 2)
#define TEST_REQ_GADGET1_TOP_EDGE	(TEST_REQ_HEIGHT - (TEST_REQ_GADGET1_HEIGHT + 10))
#define TEST_REQ_GADGET1_WIDTH		((8 + 2) * 10)
#define TEST_REQ_GADGET1_HEIGHT		19
#define TEST_REQ_GADGET1_TEXT		"_Continue"
#define TEST_REQ_GADGET1_TEXT_ATTR	&topaz60_attr

	/* Statics for test borders */

STATIC struct TextData  test_req_text_data[] = {
   {
	TEST_REQ_TEXT1_TYPE,		/* td_Type */
	TEST_REQ_TEXT1_FLAGS,		/* td_Flags */
	TEST_REQ_TEXT1_LEFT_EDGE,	/* td_LeftEdge */
	TEST_REQ_TEXT1_TOP_EDGE,	/* td_TopEdge */
	TEST_REQ_TEXT1_TEXT,		/* *td_Text */
	TEST_REQ_TEXT1_TEXT_ATTR	/* *td_TextAttr */
   }, {
	TEST_REQ_TEXT2_TYPE,		/* td_Type */
	TEST_REQ_TEXT2_FLAGS,		/* td_Flags */
	TEST_REQ_TEXT2_LEFT_EDGE,	/* td_LeftEdge */
	TEST_REQ_TEXT2_TOP_EDGE,	/* td_TopEdge */
	TEST_REQ_TEXT2_TEXT,		/* *td_Text */
	TEST_REQ_TEXT2_TEXT_ATTR	/* *td_TextAttr */
   }, {
	TEST_REQ_TEXT3_TYPE,		/* td_Type */
	TEST_REQ_TEXT3_FLAGS,		/* td_Flags */
	TEST_REQ_TEXT3_LEFT_EDGE,	/* td_LeftEdge */
	TEST_REQ_TEXT3_TOP_EDGE,	/* td_TopEdge */
	TEST_REQ_TEXT3_TEXT,		/* *td_Text */
	TEST_REQ_TEXT3_TEXT_ATTR	/* *td_TextAttr */
   }, {
	INTUISUP_DATA_END		/* mark end of border data array */
   }
};
STATIC struct BorderData  test_req_border_data[] = {
   {
	TEST_REQ_BORDER1_TYPE,		/* bd_Type */
	TEST_REQ_BORDER1_LEFT_EDGE,	/* bd_LeftEdge */
	TEST_REQ_BORDER1_TOP_EDGE,	/* bd_TopEdge */
	TEST_REQ_BORDER1_WIDTH,		/* bd_Width */
	TEST_REQ_BORDER1_HEIGHT		/* bd_Height */
   }, {
	INTUISUP_DATA_END		/* mark end of border data array */
   }
};
STATIC struct GadgetData  test_req_gadget_data[] = {
   {
	TEST_REQ_GADGET1_TYPE,		/* gd_Type */
	TEST_REQ_GADGET1_FLAGS,		/* gd_Flags */
	TEST_REQ_GADGET1_LEFT_EDGE,	/* gd_LeftEdge */
	TEST_REQ_GADGET1_TOP_EDGE,	/* gd_TopEdge */
	TEST_REQ_GADGET1_WIDTH,		/* gd_Width */
	TEST_REQ_GADGET1_HEIGHT,	/* gd_Height */
	TEST_REQ_GADGET1_TEXT,		/* *gd_Text */
	TEST_REQ_GADGET1_TEXT_ATTR,	/* *gd_TextAttr */
	{ 0, 0, 0 }
   }, {
	INTUISUP_DATA_END		/* mark end of border data array */
   }
};
STATIC struct RequesterData  test_requester_data = {
	0,				/* rd_LeftEdge */
	0,				/* rd_TopEdge */
	TEST_REQ_WIDTH,			/* rd_Width */
	TEST_REQ_HEIGHT,		/* rd_Height */
	TEST_REQ_FLAGS,			/* rd_Flags */
	TEST_REQ_TITLE,			/* *rd_Title */
	&test_req_text_data[0],		/* *rd_Texts */
	&test_req_border_data[0],	/* *rd_Borders */
	&test_req_gadget_data[0]	/* *rd_Gadgets */
};
	/* Defines for test menus */

#define TEST_MENU_TEXT_ATTR	&topaz60_attr

	/* Statics for test menus */

STATIC struct MenuData  test_menu_data[] = {
   {
	MENU_DATA_TYPE_TITLE, 0, "Menu 0", NULL, 0
   }, {
	   MENU_DATA_TYPE_ITEM, MENU_DATA_FLAG_ATTRIBUTE | MENU_DATA_FLAG_SELECTED, "Item 0.0", "0", ~(1L << 0)
   }, {
	   MENU_DATA_TYPE_ITEM, MENU_DATA_FLAG_ATTRIBUTE, "Item 0.1", "1", ~(1L << 1)
   }, {
	   MENU_DATA_TYPE_ITEM, MENU_DATA_FLAG_HIGH_BOX, "Item 0.2", NULL, 0
   }, {
	      MENU_DATA_TYPE_SUBITEM, 0, "Item 0.2.0", "A", 0
   }, {
	      MENU_DATA_TYPE_SUBITEM, 0, "Item 0.2.1", "B", 0
   }, {
	   MENU_DATA_TYPE_ITEM, 0, "Item 0.3", NULL, 0
   }, {
	MENU_DATA_TYPE_TITLE,  0, "Menu 1", NULL, 0
   }, {
	   MENU_DATA_TYPE_ITEM, MENU_DATA_FLAG_HIGH_BOX, "Item 1.0", "C", 0
   }, {
	   MENU_DATA_TYPE_ITEM, MENU_DATA_FLAG_EMPTY_LINE, "Item 1.1", "D", 0
   }, {
	   MENU_DATA_TYPE_ITEM, 0, "Item 1.2", NULL, 0
   }, {
	      MENU_DATA_TYPE_SUBITEM, 0, "Item 1.2.0", "E", 0
   }, {
	      MENU_DATA_TYPE_SUBITEM, 0, "Item 1.2.1", "F", 0
   }, {
	   MENU_DATA_TYPE_ITEM, 0, "Item 1.3", NULL, 0
   }, {
	      MENU_DATA_TYPE_SUBITEM, 0, "Item 1.3.0", "G", 0
   }, {
	      MENU_DATA_TYPE_SUBITEM, MENU_DATA_FLAG_EMPTY_LINE, "Item 1.3.1", "H", 0
   }, {
	   MENU_DATA_TYPE_ITEM, 0, "Item 1.4", "I", 0
   }, {
	INTUISUP_DATA_END		/* mark end of menu data */
   }
};
	/* Prototypes */

VOID test_action(APTR ri, struct Window  *win, APTR gl, APTR ml);
BOOL build_list(struct List  *list, BYTE **list_entry);
VOID free_list(struct List  *list);

	/* Pragmas */

#pragma regcall(test_action(a0,a1,a2,a3))
#pragma regcall(build_list(a0,a1))
#pragma regcall(free_list(a0))

	/* Library test */

   LONG
main(VOID)
{
   struct Window  *win;
   APTR ri, gl, ml;

   if (IntuitionBase = OpenLibrary("intuition.library", 0L)) {
      if (IntuiSupBase = OpenLibrary(IntuiSupName, IntuiSupVersion)) {
	 if (build_list(&select_list, &select_list_entries[0]) == TRUE) {
	    if (build_list(&test_list, &cycle_text_array[0]) == TRUE) {
	       if (ri = IGetRenderInfo(NULL, RENDER_INFO_FLAGS)) {
		  if (win = IOpenWindow(ri, &test_new_window,
						       OPEN_WINDOW_FLAGS)) {
		     if (gl = ICreateGadgets(ri, &select_gadget_data[0], 0,
								 0, NULL)) {
			if (ml = ICreateMenu(ri, win, &test_menu_data[0],
					       TEST_MENU_TEXT_ATTR, NULL)) {
			   IDisplayGadgets(win, gl);
			   IAttachMenu(win, ml);
			   test1_gadget_data[0].gd_SpecialData.gd_ButtonData.
					    gd_ButtonNormalRender = &image1;
			   test_action(ri, win, gl, ml);
			   IRemoveMenu(ml);
			   IRemoveGadgets(gl);
			   IFreeMenu(ml);
			}
			IFreeGadgets(gl);
		     }
		     ICloseWindow(win, FALSE);
		  }
		  IFreeRenderInfo(ri);
	       }
	       free_list(&test_list);
	    }
	    free_list(&select_list);
	 }
	 CloseLibrary(IntuiSupBase);
      }
      CloseLibrary(IntuitionBase);
   }
   return(0L);
}
	/* Perform IDCMP action */

   VOID
test_action(APTR ri, struct Window  *win, APTR sgl, APTR ml)
{
   struct MsgPort  *up = win->UserPort;
   APTR   tgl = NULL;
   USHORT entry = 0, flags = SELECT_FLAG_CREATE_GADGETS;
   BOOL   keepon = TRUE;

   /* Waiting for close window event */
   do {
      struct IntuiMessage  *msg;

      /* Check if test gadget must be changed */
      if (flags & SELECT_FLAG_CREATE_GADGETS) {
	 struct GadgetData  *gd_ptr;

	 /* Release old test gadgets */
	 if (tgl) {
	    IRemoveGadgets(tgl);
	    IFreeGadgets(tgl);
	    tgl = NULL;
	 }

	 /* Clear display areas */
	 IClearWindow(ri, win, TEST_AREA_LEFT_EDGE, TEST_AREA_TOP_EDGE,
				  TEST_AREA_LEFT_EDGE + TEST_AREA_WIDTH - 1,
			      TEST_AREA_TOP_EDGE + TEST_AREA_HEIGHT - 1, 0);
	 IClearWindow(ri, win, MESSAGE_LEFT_EDGE, MESSAGE_TOP_EDGE,
				      MESSAGE_LEFT_EDGE + MESSAGE_WIDTH - 1,
				  MESSAGE_TOP_EDGE + MESSAGE_HEIGHT - 1, 0);
	 /* Check if test gadgets exists */
	 if (gd_ptr = test_gadget_array[entry]) {
	    struct GadgetData  *gd;

	    /* Init gadget data according to select flags */
	    for (gd = gd_ptr; gd->gd_Type != INTUISUP_DATA_END; gd++) {
	       ULONG gflags = gd->gd_Flags;

	       if (flags & SELECT_FLAG_DISABLED) {
		  gflags |= GADGET_DATA_FLAG_DISABLED;
	       } else {
		  gflags &= ~GADGET_DATA_FLAG_DISABLED;
	       }
	       if (flags & SELECT_FLAG_NO_BORDER) {
		  gflags |= GADGET_DATA_FLAG_NO_BORDER;
	       } else {
		  gflags &= ~GADGET_DATA_FLAG_NO_BORDER;
	       }
	       if (flags & SELECT_FLAG_HIGH_COMP) {
		  gflags |= GADGET_DATA_FLAG_HIGH_COMP;
	       } else {
		  gflags &= ~GADGET_DATA_FLAG_HIGH_COMP;
	       }
	       if (flags & SELECT_FLAG_TEXT_COLOR2) {
		  gflags |= GADGET_DATA_FLAG_TEXT_COLOR2;
	       } else {
		  gflags &= ~GADGET_DATA_FLAG_TEXT_COLOR2;
	       }
	       gd->gd_Flags = gflags;
	    }

	    /* Create and display new test gadgets */
	    if (tgl = ICreateGadgets(ri, gd_ptr, 0, 0, NULL)) {
	       IDisplayGadgets(win, tgl);
	    }
	 }
	 flags &= ~SELECT_FLAG_CREATE_GADGETS;
      }

      /* Wait for IDCMP events */
      WaitPort(up);
      while (msg = IGetMsg(up)) {
	 APTR   gl;
	 ULONG  class, value;
	 USHORT code;

	 /* Get data from Intuition message and reply it */
	 class = msg->Class;
	 code  = msg->Code;
	 value = (ULONG)msg->IAddress;
	 gl    = (APTR)msg->SpecialLink;
	 IReplyMsg(msg);

	 /* Perform action according to message class */
	 switch (class) {
	    case CLOSEWINDOW :
	       keepon = FALSE;
	       break;

	    case ISUP_ID :
	       if (gl == sgl) {
		  APTR rl;

		  /* Perform action according to select gadgets */
		  switch (code) {
		     case SELECT_GADGET_LIST :

			/* Perform action according to selected ISUP object */
			switch (entry = value) {
			   case SELECT_ENTRY_AUTO_REQUESTER :
			      IAutoRequest(win, TEST_AUTO_REQ_TITLE,
						    TEST_AUTO_REQ_BODY_TEXT,
						     TEST_AUTO_REQ_POS_TEXT,
					     TEST_AUTO_REQ_NEG_TEXT, 0L, 0L,
						 TEST_AUTO_REQ_FLAGS, NULL);
			      break;

			   case SELECT_ENTRY_REQUESTER :
			      if (rl = IDisplayRequester(win,
					      &test_requester_data, NULL)) {
				 BOOL keepon2 = TRUE;

				 do {
				    WaitPort(up);
				    while (msg = IGetMsg(up)) {
				       if (msg->Class == ISUP_ID) {
					  keepon2 = FALSE;
				       }
				       IReplyMsg(msg);
				    }
				 } while (keepon2 == TRUE);
				 IRemoveRequester(rl);
			      }
			      break;
			}
			break;

		     case SELECT_GADGET_DISABLED :
			if (value) {
			   flags |= SELECT_FLAG_DISABLED;
			} else {
			   flags &= ~SELECT_FLAG_DISABLED;
			}
			break;

		     case SELECT_GADGET_NO_BORDER :
			if (value) {
			   flags |= SELECT_FLAG_NO_BORDER;
			} else {
			   flags &= ~SELECT_FLAG_NO_BORDER;
			}
			break;

		     case SELECT_GADGET_HIGH_COMP :
			if (value) {
			   flags |= SELECT_FLAG_HIGH_COMP;
			} else {
			   flags &= ~SELECT_FLAG_HIGH_COMP;
			}
			break;

		     case SELECT_GADGET_TEXT_COLOR2 :
			if (value) {
			   flags |= SELECT_FLAG_TEXT_COLOR2;
			} else {
			   flags &= ~SELECT_FLAG_TEXT_COLOR2;
			}
			break;
		  }
		  flags |= SELECT_FLAG_CREATE_GADGETS;
	       } else {
		  BYTE *format, buffer[80];

		  /* Perform action according to test gadgets */
		  if (entry == SELECT_ENTRY_STRING) {
		     format = MESSAGE_TEXT1;
		  } else {
		     format = MESSAGE_TEXT2;
		  }
		  sprintf(&buffer[0], format, entry, value);
		  IClearWindow(ri, win, MESSAGE_LEFT_EDGE, MESSAGE_TOP_EDGE,
				      MESSAGE_LEFT_EDGE + MESSAGE_WIDTH - 1,
				  MESSAGE_TOP_EDGE + MESSAGE_HEIGHT - 1, 0);
		  IPrintText(ri, win, &buffer[0], 0, MESSAGE_TOP_EDGE,
				TEXT_DATA_TYPE_TEXT, TEXT_DATA_FLAG_CENTER |
				  TEXT_DATA_FLAG_COLOR2, MESSAGE_TEXT_ATTR);
	       }
	       break;

	    case MENUPICK :
	       while (code != MENUNULL) {
		  BYTE buffer[80];

		  /* Print message with menu item num */
		  sprintf(&buffer[0], MESSAGE_TEXT3,
			      (MENUNUM(code) != NOMENU ? MENUNUM(code) : 0),
			      (ITEMNUM(code) != NOITEM ? ITEMNUM(code) : 0),
				(SUBNUM(code) != NOSUB ? SUBNUM(code) : 0));
		  IClearWindow(ri, win, MESSAGE_LEFT_EDGE, MESSAGE_TOP_EDGE,
				      MESSAGE_LEFT_EDGE + MESSAGE_WIDTH - 1,
				  MESSAGE_TOP_EDGE + MESSAGE_HEIGHT - 1, 0);
		  IPrintText(ri, win, &buffer[0], 0, MESSAGE_TOP_EDGE,
				TEXT_DATA_TYPE_TEXT, TEXT_DATA_FLAG_CENTER |
				  TEXT_DATA_FLAG_COLOR2, MESSAGE_TEXT_ATTR);
		  code = IMenuItemAddress(ml, code)->NextSelect;
	       }
	       break;
	 }
      }
   } while (keepon == TRUE);

   /* Release test gadgets */
   if (tgl) {
      IRemoveGadgets(tgl);
      IFreeGadgets(tgl);
   }
}
	/* Build list from given entry array */

   BOOL
build_list(struct List  *list, BYTE **list_entry)
{
   BYTE *text;
   BOOL success = TRUE;

   NewList(list);
   while (text = *list_entry++) {
      struct Node  *node;

      if (node = AllocMem((LONG)sizeof(struct Node),
					  (LONG)MEMF_PUBLIC | MEMF_CLEAR)) {
	 node->ln_Name = text;
	 AddTail(list, node);
      } else {
	 free_list(list);
	 success = FALSE;
	 break;
      }
   }
   return(success);
}
	/* Free given list */

   VOID
free_list(struct List  *list)
{
   struct Node  *node;

   while (node = RemHead(list)) {
      FreeMem(node, (LONG)sizeof(struct Node));
   }
}
