require "StandardMouseButton"
require "CDialog"

-- reserve constructor
Book_TutorialIntroDialog = 
{
	name = "Book_TutorialIntroDialog"
}

function Book_TutorialIntroDialog:Create(  )
	
	-- The main screen container
	local instance = root.dialogs[ self.name ];
	instance:SetPosition( 139, 99 )
	CDialog:Attach( instance )

	-- The ok button
	local okButton = instance.button

	-- Handle keyboard input for the dialog
	function instance:CharDown( i_Key )
		log( "On Key Down" .. i_Key )
	end

	function instance:OnUpdate( )
		self:OnUpdateDialog()
	end
	
	function instance:Loaded( )
		log(" loaded " )
	end
	
	function instance:OnMouseEnter( )
		log("enter I")
	end
	
	function instance:OnMouseLeave( )
		log("leave I")
	end

	-- The ok button
	function okButton:Init( )
		function okButton:Pressed()
			instance:CloseAndSave( )
			log (" clicking button ")
		end
		self:AddAsGlobalHandler()
		function okButton:OnKeyDown( i_Key )
			-- press ok on pressing return button
			if ( i_Key == 13 ) then
				okButton:Pressed()
			end
		end
	end
	
	-- The main init function
	--function instance:Init( )
		StandardMouseButton( okButton )
		okButton:Init( )
		log("button init complete")
	--end
end

Book_TutorialIntroDialog:Create( )
