require( "scripts/style.lua" );

NewNameTextFont = {
  oldsansblackFont,
  40,
  BlackColor
};

MakeDialog
{
	name="newnamewindow",
	FaderWindow
	{   
		wait=0,
		duration=100,
		fit = true,
		Bitmap
		{
			image = "backgrounds/back",
			fit=true,
			Bitmap
			{
				image = "gui/inputname/edit_name_background",
				x=272,
				y=259,
				fit=true,
				name="newname",
				
				Text
				{
					x = 93,
					y = 14,
					w = 221,
					h = 29,
					font = {
						oldsansblackFont,
						27,
						RedTextColor
					},
					label = "enteraname",
					flags = kHAlignCenter + kVAlignCenter;
				},
				SetStyle( MenuButtonStyle ),
				Button
				{
					name = "ok",
					x=78,
					y=191,
					w=133,
					h=25,
					default = true,
					graphics = MediumButton1Graphics,
					MenuButtonLabel(0,0,143,32, "ok", oldsansblackFont, 20, Color(135,32,33,255), Color(44,76,60,255), Color(83,119,101,255)),
					--close = true,
					command=
						function()
							if CreateProfile(GetLabel("nameedit")) then
								PopModal("newnamewindow");
								PopModal("profilemanagerwindow");
								SwapToModal("scripts/map.lua");
							end
						end
				},
				Button
				{
					name = "clear",
					x=243,
					y=191,
					w=133,
					h=25,
					graphics = MediumButton1Graphics,
						MenuButtonLabel(0,0,143,32, "clear", oldsansblackFont, 20, Color(135,32,33,255), Color(44,76,60,255), Color(83,119,101,255)),
					close = true,
					command=
						function()
							EnableWindow("profilemanagerwindow", true);
						end
				},
				TextEdit
				{
					font = NewNameTextFont,
					name = "nameedit",
					clearinitial = true,
					enablewindow = "ok",
					label= GetString("yourname"),
					x=96,
					y=98,
					w=280,
					h=50,
					length=9,
					ignore = kIllegalNameChars,
					flags = kHAlignCenter + kVAlignCenter,
					command=
						function()
						end
				};
			},
		},		
	},
} -- MakeDialog

SetFocus( "nameedit" );

EnableWindow("profilemanagerwindow", false);