/* This file includes many useful macros to generate OpalPaint
 * style gadgets.
 */



#define OPBLACK		0L	/* OpalPaint colours */
#define OPGREY		1L
#define OPBLUE		2L
#define OPWHITE		3L

	/* White Text */

#define MakeWText(Name,x,y,Text) \
struct IntuiText Name = { OPWHITE, OPGREY, JAM1, x,y, &Font, (UBYTE *)Text, NULL}


	/* Blue Text */

#define MakeBText(Name,x,y,Text) \
struct IntuiText Name = { OPBLUE, OPGREY, JAM1, x,y, &Font, (UBYTE *)Text, NULL}


	/* White on Blue Text for headings */

#define MakeDoubleText(Name,x,y,Text,Next) \
struct IntuiText Name[] =\
	{ { OPBLUE, OPGREY, JAM1, x,y, &Font, (UBYTE *)Text, &Name[1]},\
	  { OPWHITE, OPGREY, JAM1, x,y-2, &Font, (UBYTE *)Text, Next}  }


/* Make a button (BoolGadget) */

#define MakeButton(GadName,Next,x,y,w,h,Text,Border,SelBorder,GadID) \
struct Gadget GadName = {  \
	Next,x,y,w,h,GADGHIMAGE,\
	RELVERIFY,BOOLGADGET|REQGADGET,\
	(APTR)&Border,(APTR)&SelBorder,\
	&Text,NULL,NULL,GadID,NULL\
}



/* NOTE: Toggle select gadgets have mutual exclusion */

	/* Small Toggle select gadget */

#define MakeGad1(GadName,Next,x,y,w,h,ExtraFlags,Text,Border,SelBorder,Exclude,GadID) \
struct Gadget GadName = {  \
	Next,x,y,w,h,GADGHIMAGE|ExtraFlags,\
	RELVERIFY|TOGGLESELECT,BOOLGADGET|REQGADGET,\
	(APTR)&Border,(APTR)&SelBorder,\
	&Text,Exclude,NULL,GadID,NULL\
}


	/* Make 3D borders */

#define MakeBorder(Name,Vec,x,y,w,h)\
SHORT Vec[4][6] =\
		{ {x+w,y, x,y, x,y+h},\
		  {x+w-1,y+1, x+1,y+1, x+1,y+h-1},\
		  {x+w,y+1, x+w,y+h, x,y+h},\
		  {x+w-1,y+2, x+w-1,y+h-1, x+1,y+h-1} };\
struct Border Name[4] =\
	{ { 0,0, OPWHITE,0, JAM1, 3,Vec[0], &Name[1] },\
	  { 0,0, OPWHITE,0, JAM1, 3,Vec[1], &Name[2] },\
	  { 0,0, OPBLUE,0, JAM1, 3,Vec[2], &Name[3] },\
	  { 0,0, OPBLUE,0, JAM1, 3,Vec[3], NULL } }


	/* Make an Inverse 3D border */

#define MakeIBorder(Name,Vec,x,y,w,h)\
SHORT Vec[4][6] =\
		{ {x+w,y, x,y, x,y+h},\
		  {x+w-1,y+1, x+1,y+1, x+1,y+h-1},\
		  {x+w,y+1, x+w,y+h, x,y+h},\
		  {x+w-1,y+2, x+w-1,y+h-1, x+1,y+h-1} };\
struct Border Name[4] =\
	{ { 0,0, OPBLUE,0, JAM1, 3,Vec[0], &Name[1] },\
	  { 0,0, OPBLUE,0, JAM1, 3,Vec[1], &Name[2] },\
	  { 0,0, OPWHITE,0, JAM1, 3,Vec[2], &Name[3] },\
	  { 0,0, OPWHITE,0, JAM1, 3,Vec[3], NULL } }


	/* Make inverse border using supplied vectors */

#define MakeIBorder2(Name,Vec,x,y,w,h)\
struct Border Name[4] =\
	{ { 0,0, OPBLUE,0, JAM1, 3,Vec[0], &Name[1] },\
	  { 0,0, OPBLUE,0, JAM1, 3,Vec[1], &Name[2] },\
	  { 0,0, OPWHITE,0, JAM1, 3,Vec[2], &Name[3] },\
	  { 0,0, OPWHITE,0, JAM1, 3,Vec[3], NULL } }


	/* Cycle Gadgets */

#define MakeCycleBd(Name,Vec,w,h)\
SHORT Vec[13][6] =\
	{ { 0,h-1, 0,0, w,0 },		/* Rectangular border */\
	  { 1,h-2, 1,1, w-1,1 },\
	  { 1,h-1, w-1,h-1, w-1,2 },\
	  { 0,h, w,h, w,1},\
	  { 20,4, 20,h-4 },		/* Vertical seperator */\
	  { 21,4, 21,h-4 },\
	  { 14,7, 13,7 },		/* Arrow */\
	  { 13,8, 7,8, 7,1},\
	  { 6,7, 6,1 },\
	  { 7,0, 13,0, 13,5 },\
	  { 14,1, 14,5},\
	  { 11,3, 16,3},\
	  { 12,4, 15,4} };\
struct Border Name[13] =\
	{ { 0,0, OPWHITE,0, JAM1, 3,Vec[0], &Name[1] },\
	  { 0,0, OPWHITE,0, JAM1, 3,Vec[1], &Name[2] },\
	  { 0,0, OPBLUE,0, JAM1, 3,Vec[2], &Name[3] },\
	  { 0,0, OPBLUE,0, JAM1, 3,Vec[3], &Name[4] },\
	  { 0,0, OPBLUE,0, JAM1, 2,Vec[4], &Name[5] },\
	  { 0,0, OPWHITE,0, JAM1, 2,Vec[5], &Name[6] },\
	  { 0,((h-9)/2)+1, OPWHITE,0, JAM1, 2,Vec[6], &Name[7] },\
	  { 0,((h-9)/2)+1, OPWHITE,0, JAM1, 3,Vec[7], &Name[8] },\
	  { 0,((h-9)/2)+1, OPWHITE,0, JAM1, 2,Vec[8], &Name[9] },\
	  { 0,((h-9)/2)+1, OPWHITE,0, JAM1, 3,Vec[9], &Name[10] },\
	  { 0,((h-9)/2)+1, OPWHITE,0, JAM1, 2,Vec[10], &Name[11] },\
	  { 0,((h-9)/2)+1, OPWHITE,0, JAM1, 2,Vec[11], &Name[12] },\
	  { 0,((h-9)/2)+1, OPWHITE,0, JAM1, 2,Vec[12], NULL } }


#define MakeICycleBd(Name,Vec,w,h)\
struct Border Name[13] =\
	{ { 0,0, OPBLUE,0, JAM1, 3,Vec[0], &Name[1] },\
	  { 0,0, OPBLUE,0, JAM1, 3,Vec[1], &Name[2] },\
	  { 0,0, OPWHITE,0, JAM1, 3,Vec[2], &Name[3] },\
	  { 0,0, OPWHITE,0, JAM1, 3,Vec[3], &Name[4] },\
	  { 0,0, OPWHITE,0, JAM1, 2,Vec[4], &Name[5] },\
	  { 0,0, OPBLUE,0, JAM1, 2,Vec[5], &Name[6] },\
	  { 0,((h-9)/2)+1, OPBLUE,0, JAM1, 2,Vec[6], &Name[7] },\
	  { 0,((h-9)/2)+1, OPBLUE,0, JAM1, 3,Vec[7], &Name[8] },\
	  { 0,((h-9)/2)+1, OPBLUE,0, JAM1, 2,Vec[8], &Name[9] },\
	  { 0,((h-9)/2)+1, OPBLUE,0, JAM1, 3,Vec[9], &Name[10] },\
	  { 0,((h-9)/2)+1, OPBLUE,0, JAM1, 2,Vec[10], &Name[11] },\
	  { 0,((h-9)/2)+1, OPBLUE,0, JAM1, 2,Vec[11], &Name[12] },\
	  { 0,((h-9)/2)+1, OPBLUE,0, JAM1, 2,Vec[12], NULL } }



#define MakeCycle(GadName,Next,x,y,w,h,Text,Bd,IBd,GadID) \
struct Gadget GadName = {  \
	Next,x,y,w,h,GADGHIMAGE,\
	RELVERIFY,BOOLGADGET,\
	(APTR)&Bd,(APTR)&IBd,\
	&Text,NULL,NULL,GadID,NULL\
}
