require "scripts/style"
require "scripts/widgets/shade"

kButtonSpacing = 45;	-- Put our buttons 60 pixels apart
kButtonY = kCenter-105;	-- Three buttons means center 60 pixels above the center

-- When this dialog is popped up, we're entering pause state, so
-- let's just notify TGameState now.
SetState( kPause, true );
SetState( kMute, true);
SetSound();

PlaySound("POPUP-IN");
MakeDialog
{
	-- Name the modal dialog
	MakeShade(),
	name="pausemenu",
	PopBitmap
	{
		image="backgrounds/dialog",
		x=kCenter,
		y=kCenter,

		SetStyle(LongButtonStyle),
		Button
		{
			x=kCenter,
			y=kButtonY,
			name="resumebutton",
			label="resume",
			close = true,	-- Just close this window
			--cancel=true,
			command=
				function()
          SetState( kMute, false);
 	        SetSound();
          PlaySound("POPUP-OUT");
 	        SetState( kPause, false );
 	        
				end;

		},

		Button
		{
			x=kCenter,
			y=kButtonY + (kButtonSpacing * 1),
			name="optionsbutton",
			label="optionsbutton",
			command=
				function()
					-- Pop up an options screen
					DoModal("scripts/options.lua");
				end
		},


	Button
		{
			x=kCenter,
			y=kButtonY + (kButtonSpacing * 2),
			name="help",
			label="help",
			command=
				function()
					-- Pop up an options screen
          ShowPopup("help01");						
				end
		},

		Button
		{
			x=kCenter,
			y=kButtonY + (kButtonSpacing * 3),
			label="quit",
			command=
				function()
				PlaySound("POPUP-OUT");
					PopModal('pausemenu');
					gDialogTable.oklabel = "quit";					
					-- Our game processes this message--it's not
					-- handled by Playground
					SetState( kMute, false);
	        SetSound();
          SendGameMessage( "quit" );
	        SetState( kPause, false );
	        
				end
		},
		
		SetStyle(LongTallButtonStyle),
		Button
		{
			x=kCenter,
			y=kButtonY + (kButtonSpacing * 4) + 15,
			label="returntoplan",
			command=
				function()
          PlaySound("POPUP-OUT");
					PopModal('pausemenu');					
					-- Our game processes this message--it's not
					-- handled by Playground
					SetState( kMute, false);
	        SetSound();
          SendGameMessage( "returntoplan" );
	        SetState( kPause, false );
	        
				end
		},
		
		
	},
}

	