/*
 *	Menus.c - Copyright © 1990 by S.R. & P.C.
 *
 *	Created:	16 Jun 1990
 *	Modified:	19 Aug 1991  20:23:05
 *
 *	Make>> make
 */

#include "ParMBase.h"

extern struct TextAttr MenuFont;


static struct IntuiText SubText2 = {
	3,2,JAM1,
	22,1,
	NULL,
	(UBYTE *)"Shell",
	NULL
};

static struct MenuItem SubItem2 = {
	NULL,
	104,10,
	72,10,
	CHECKIT+ITEMTEXT+ITEMENABLED+HIGHCOMP,
	1,
	NULL,
	NULL,
	NULL,
	NULL,
	MENUNULL
};

static struct IntuiText SubText1 = {
	3,2,JAM1,
	22,1,
	NULL,
	(UBYTE *)"Simple",
	NULL
};

struct MenuItem SubItem1 = {
	NULL,
	104,0,
	72,10,
	CHECKIT+ITEMTEXT+ITEMENABLED+HIGHCOMP+CHECKED,	/* Item flags */
	2,
	NULL,
	NULL,
	NULL,
	NULL,
	MENUNULL
};


struct Menu Menu1 = {
	NULL,
	0,0,
	44,0,
	MENUENABLED,
	"ParM",
	NULL
};

static struct {
	char *MenuName;
	char Command;
} MenuTab[] = {
	{"Open",	 'O'},
	{"UpDate",	 'U'},
	{"Std Cfg",	  0 },
	{"Cmd Mode",  0 },
	{"Command",	 'C'},
	{"Change Dir",0 },
	{"Quit",	  0 }
};

#define NUMBER_OF_ITEM 7

void CreateParMenu(short Color)
{
	struct MenuItem *mi, **miptr;
	struct IntuiText *it;
	struct Menu *ParM;
	short i;

	ParM = &Menu1;
	miptr = &ParM->FirstItem;
	for( i=0 ; i<NUMBER_OF_ITEM ; i++ ) {
		mi = ArpAlloc(sizeof(struct MenuItem));
		it = ArpAlloc(sizeof(struct IntuiText));
		mi->ItemFill = (APTR)it;
		mi->Flags = ITEMTEXT+ITEMENABLED+HIGHCOMP;
		if (MenuTab[i].Command) {
			mi->Command = MenuTab[i].Command;
			mi->Flags |= COMMSEQ;
		}
		it->IText = (UBYTE *)MenuTab[i].MenuName;
		it->FrontPen = Color;
		it->LeftEdge = it->TopEdge = 1;
		if (i == 3) {
			SubItem1.ItemFill = (APTR)&SubText1;
			SubText1.FrontPen = Color;
			SubItem1.NextItem = &SubItem2;
			SubItem2.ItemFill = (APTR)&SubText2;
			SubText2.FrontPen = Color;
			mi->SubItem = &SubItem1;
		}
		*miptr = mi;
		miptr = &mi->NextItem;
	}
	NewCleanUp(ParM, &MenuFont, 0);
}

