class UMenuPulldownMenu expands UWindowPulldownMenu;


#exec TEXTURE IMPORT NAME=BMenuArea FILE=Textures\MenuArea.bmp GROUP="Icons" FLAGS=2 MIPS=OFF
#exec TEXTURE IMPORT NAME=BMenuTL FILE=Textures\MenuTL.bmp GROUP="Icons" FLAGS=2 MIPS=OFF
#exec TEXTURE IMPORT NAME=BMenuT FILE=Textures\MenuT.bmp GROUP="Icons" FLAGS=2 MIPS=OFF
#exec TEXTURE IMPORT NAME=BMenuTR FILE=Textures\MenuTR.bmp GROUP="Icons" FLAGS=2 MIPS=OFF
#exec TEXTURE IMPORT NAME=BMenuL FILE=Textures\MenuL.bmp GROUP="Icons" FLAGS=2 MIPS=OFF
#exec TEXTURE IMPORT NAME=BMenuR FILE=Textures\MenuR.bmp GROUP="Icons" FLAGS=2 MIPS=OFF
#exec TEXTURE IMPORT NAME=BMenuBL FILE=Textures\MenuBL.bmp GROUP="Icons" FLAGS=2 MIPS=OFF
#exec TEXTURE IMPORT NAME=BMenuB FILE=Textures\MenuB.bmp GROUP="Icons" FLAGS=2 MIPS=OFF
#exec TEXTURE IMPORT NAME=BMenuBR FILE=Textures\MenuBR.bmp GROUP="Icons" FLAGS=2 MIPS=OFF
#exec TEXTURE IMPORT NAME=BMenuHL FILE=Textures\MenuHL.bmp GROUP="Icons" FLAGS=2 MIPS=OFF
#exec TEXTURE IMPORT NAME=BMenuHM FILE=Textures\MenuHM.bmp GROUP="Icons" FLAGS=2 MIPS=OFF
#exec TEXTURE IMPORT NAME=BMenuHR FILE=Textures\MenuHR.bmp GROUP="Icons" FLAGS=2 MIPS=OFF
#exec TEXTURE IMPORT NAME=MenuLine FILE=Textures\MenuLine.bmp GROUP="Icons" FLAGS=2 MIPS=OFF


function Created()
{
	Super.Created();
	ItemHeight=16;
	VBorder = 4;
	HBorder = 3;
}

function DrawMenuBackground(Canvas C)
{
	DrawClippedTexture(C, 0, 0, Texture'UMenu.BMenuTL');
	DrawStretchedTexture(C, 4, 0, WinWidth-8, 4, Texture'UMenu.BMenuT');
	DrawClippedTexture(C, WinWidth-4, 0, Texture'UMenu.BMenuTR');


	DrawClippedTexture(C, 0, WinHeight-4, Texture'UMenu.BMenuBL');
	DrawStretchedTexture(C, 4, WinHeight-4, WinWidth-8, 4, Texture'UMenu.BMenuB');
	DrawClippedTexture(C, WinWidth-4, WinHeight-4, Texture'UMenu.BMenuBR');

	DrawStretchedTexture(C, 0, 4, 4, WinHeight-8, Texture'UMenu.BMenuL');
	DrawStretchedTexture(C, WinWidth-4, 4, 4, WinHeight-8, Texture'UMenu.BMenuR');

	DrawStretchedTexture(C, 4, 4, WinWidth-8, WinHeight-8, Texture'UMenu.BMenuArea');
}



function DrawItem(Canvas C, UWindowList Item, float X, float Y, float W, float H)
{
	local string[240] Text;
	local string[240] Underline;

	C.DrawColor.R = 255;
	C.DrawColor.G = 255;
	C.DrawColor.B = 255;

	UWindowPulldownMenuItem(Item).ItemTop = Y + WinTop;

	if(UWindowPulldownMenuItem(Item).Caption == "-")
	{
		C.DrawColor.R = 255;
		C.DrawColor.G = 255;
		C.DrawColor.B = 255;
		DrawStretchedTexture(C, X, Y+5, W, 2, Texture'UMenu.MenuLine');
		return;
	}

	C.Font = Root.TahomaFont;
	ParseAmpersand(UWindowPulldownMenuItem(Item).Caption, Text, Underline, True);

	if(Selected == Item)
	{
		DrawClippedTexture(C, X, Y, Texture'UMenu.BMenuHL');
		DrawStretchedTexture(C, X + 4, Y, W - 8, 16, Texture'UMenu.BMenuHM');
		DrawClippedTexture(C, X + W - 4, Y, Texture'UMenu.BMenuHR');
		C.DrawColor.R = 0;
		C.DrawColor.G = 0;
		C.DrawColor.B = 0;
	}
	else
	{

		if(UWindowPulldownMenuItem(Item).bDisabled) 
		{


			// Black Shadow
			/*C.DrawColor.R = 0;
			C.DrawColor.G = 0;
			C.DrawColor.B = 0;
			ClipText(C, X + TextBorder + 3, Y + 4, Text);*/

			C.DrawColor.R = 96;
			C.DrawColor.G = 96;
			C.DrawColor.B = 96;
		}
		else
		{
			C.DrawColor.R = 0;
			C.DrawColor.G = 0;
			C.DrawColor.B = 0;
		}
	}
	


	// DrawColor will render the tick black white or gray.
	if(UWindowPulldownMenuItem(Item).bChecked)
	{
		C.Style = ERenderStyle.STY_Masked;
		DrawClippedTexture(C, X + 1, Y + 3, Texture'MenuTick');
		C.Style = ERenderStyle.STY_Normal;
	}


	if(UWindowPulldownMenuItem(Item).SubMenu != None)
	{
		C.Style = ERenderStyle.STY_Masked;
		DrawClippedTexture(C, X + W - 9, Y + 3, Texture'MenuSubArrow');
		C.Style = ERenderStyle.STY_Normal;
	}

	ClipText(C, X + TextBorder + 2, Y + 3, Text);
	ClipText(C, X + TextBorder + 2, Y + 5, Underline);
	
}