
/*
 * x.tpl.c
 *
 * MACHINE GENERATED
 */

#ifndef NO_GAD_HEADERS
#include <exec/types.h>
#include <exec/lists.h>
#include <intuition/intuition.h>
#include <intuition/screens.h>
#include <intuition/gadgetclass.h>
#include <libraries/gadtools.h>
#include <clib/gadtools_protos.h>
#endif

#define NG_B3 (NGAry + 0)
#define NG_B4 (NGAry + 1)
#define NG_r1 (NGAry + 2)
#define NG_S1 (NGAry + 3)
#define NG_B1 (NGAry + 4)
#define NG_B2 (NGAry + 5)
#define GAD_B3 0
#define GAD_B4 1
#define GAD_r1 2
#define GAD_S1 3
#define GAD_B1 4
#define GAD_B2 5

struct NewGadget NGAry[6] = {
    { 42,107,145,15,"L3",(void *)0L,GAD_B3,0x0000,(void *)0L },
    { 41,152,146,14,"L4",(void *)0L,GAD_B4,0x0000,(void *)0L },
    { 72,182,83,16,"hello",(void *)0L,GAD_r1,0x0008,(void *)0L },
    { 42,23,127,61,"SEL",(void *)0L,GAD_S1,0x0008,(void *)0L },
    { 31,221,55,40,"BUT1",(void *)0L,GAD_B1,0x0010,(void *)0L },
    { 117,221,62,40,"BUT2",(void *)0L,GAD_B2,0x0010,(void *)0L }
};

#define WIN_LEFT   0
#define WIN_TOP    186
#define WIN_WIDTH  228
#define WIN_HEIGHT 289

struct Gadget *Gad_B3;
char *Buf_B3;
char *DefText_B3 = "D3";
struct Gadget *Gad_B4;
char *Buf_B4;
char *DefText_B4 = "D4";
struct Gadget *Gad_r1;
char *StatAry_r1[] = { "a", "b", "c", "d", (void *)0 };
char **Ary_r1 = StatAry_r1;
long SelNo_r1 = 2;
struct Gadget *Gad_S1;
extern struct MinList List_S1;
long SelNo_S1 = 2;
struct Node NodeAry_S1[10] = {
    { NodeAry_S1 + 1, (struct Node *)&List_S1.mlh_Head, 0, 0, "a" },
    { NodeAry_S1 + 2, NodeAry_S1 + 0, 0, 0, "b" },
    { NodeAry_S1 + 3, NodeAry_S1 + 1, 0, 0, "c" },
    { NodeAry_S1 + 4, NodeAry_S1 + 2, 0, 0, "d" },
    { NodeAry_S1 + 5, NodeAry_S1 + 3, 0, 0, "e" },
    { NodeAry_S1 + 6, NodeAry_S1 + 4, 0, 0, "f" },
    { NodeAry_S1 + 7, NodeAry_S1 + 5, 0, 0, "g" },
    { NodeAry_S1 + 8, NodeAry_S1 + 6, 0, 0, "h" },
    { NodeAry_S1 + 9, NodeAry_S1 + 7, 0, 0, "i" },
    { (struct Node *)&List_S1.mlh_Tail, NodeAry_S1 + 8, 0, 0, "j" }
};

struct MinList List_S1 = { &NodeAry_S1[0], (void *)0L, &NodeAry_S1[9] };
struct Gadget *Gad_B1;
struct Gadget *Gad_B2;


struct Gadget *GList;
struct VisualInfo *VisInfo;



struct Gadget *
InitGads(scr)
struct Screen *scr;
{
    struct Gadget *gad;
    short i;

    GList = (void *)0;
    if ((VisInfo = GetVisualInfo(scr, TAG_END)) == NULL)
	return((void *)0L);

    {
	struct NewGadget *ng;
	for (i = 0, ng = NGAry; i < sizeof(NGAry)/sizeof(NGAry[0]); ++i, ++ng) {
	    ng->ng_VisualInfo = VisInfo;
	    ng->ng_TextAttr = scr->Font;
	}
    }
    if ((gad = CreateContext(&GList)) == NULL)
	return((void *)0L);
    Gad_B3 = gad = CreateGadget(STRING_KIND, gad, NGAry + 0,
	GTST_MaxChars, 16,
	GTST_String, DefText_B3,
	TAG_END
    );
    if (gad == NULL)
	return(NULL);
    Buf_B3 = ((struct StringInfo *)gad->SpecialInfo)->Buffer;

    Gad_B4 = gad = CreateGadget(STRING_KIND, gad, NGAry + 1,
	GTST_MaxChars, 8,
	GTST_String, DefText_B4,
	TAG_END
    );
    if (gad == NULL)
	return(NULL);
    Buf_B4 = ((struct StringInfo *)gad->SpecialInfo)->Buffer;

    Gad_r1 = gad = CreateGadget(CYCLE_KIND, gad, NGAry + 2,
	GTCY_Labels, Ary_r1,
	GTCY_Active, SelNo_r1,
	TAG_END
    );
    if (gad == NULL)
	return(NULL);

    Gad_S1 = gad = CreateGadget(LISTVIEW_KIND, gad, NGAry + 3,
	GTLV_Labels, &List_S1,
	GTLV_Selected, SelNo_S1,
	TAG_END
    );
    if (gad == NULL)
	return(NULL);

    Gad_B1 = gad = CreateGadget(BUTTON_KIND, gad, NGAry + 4,
	TAG_END
    );
    if (gad == NULL)
	return(NULL);

    Gad_B2 = gad = CreateGadget(BUTTON_KIND, gad, NGAry + 5,
	TAG_END
    );
    if (gad == NULL)
	return(NULL);

    return(GList);
}



void
FreeGads(void)
{
    FreeGadgets(GList);
    if (VisInfo)
        FreeVisualInfo(VisInfo);
    VisInfo = NULL;
    GList = NULL;
}
