/*************************************************************************
*
*		file name:	gadsel.c
*		author:		Thomas C. DeVeau
*		creation date:	8-5-90
*		purpose:	Gadget Selection function
*
**************************************************************************/
#include "gadsel.h"   

void GadgetSelect(w,gp,gad,type,comp)
struct Window *w;	/* controlling window */
struct GadList *gp;	/* Gadgt list */
SHORT gad;		/* gadget to select */
USHORT type,comp;	/* type = GADGIMAGE or NULL, comp = Complement type
			   (i.e GADGHCOMP, GADGHIMAGE, GADGHNONE) */
{
	SHORT c,pos,apos;

	pos = RemoveGList(w,gp->GadgetList[0],gp->GadCount);
	for(c = 0;c < gp->GadCount;c++)
	{
		gp->GadgetList[c]->Flags = type;
		gp->GadgetList[c]->Activation = RELVERIFY+GADGIMMEDIATE;
	}
	gp->GadgetList[gad]->Flags = GADGIMAGE+comp+SELECTED;
	gp->GadgetList[gad]->Activation = RELVERIFY+GADGIMMEDIATE+TOGGLESELECT;
	apos = AddGList(w,gp->GadgetList[0],pos,gp->GadCount,NULL);
	RefreshGList(gp->GadgetList[0],w,NULL,gp->GadCount);
}
/* end of file */
