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

void GadgetSelect(w,gl,gad,type,comp)
struct Window *w;	/* controlling window */
struct GadList *gl;	/* 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,gl->GadgetList[0],gl->GadCount);
	for(c = 0;c < gl->GadCount;c++)
	{
		gl->GadgetList[c]->Flags = type;
		gl->GadgetList[c]->Activation = RELVERIFY+GADGIMMEDIATE;
	}
	gl->GadgetList[gad]->Flags = type+comp+SELECTED;
	gl->GadgetList[gad]->Activation = RELVERIFY+GADGIMMEDIATE+TOGGLESELECT;
	apos = AddGList(w,gl->GadgetList[0],pos,gl->GadCount,NULL);
	RefreshGList(gl->GadgetList[0],w,NULL,gl->GadCount);
}
/* end of file */
