dofile ( "Scripts/guielement.lua" )

--
-- Clickable
--

Clickable = {}
ClickableMT = { __index = Clickable }

-- inherit GUIElement
setmetatable ( Clickable, { __index = GUIElement } )

function Clickable:Create ( x, y, z, width, height )

	local clickable = {}
	setmetatable ( clickable, ClickableMT )

	clickable.x = x
	clickable.y = y
	clickable.z = z
	clickable.width = width
	clickable.height = height

	clickable.down = false

	clickable.destroyed = false

	return clickable

end

function Clickable:Destroy ( )
	self.destroyed = true
end

function Clickable:OnPress ( button )

end

function Clickable:OnRelease ( button )

end

function Clickable:MouseRelease ( button, x, y )
	if self.destroyed == true then
		return
	end
	self.down = false
	self:OnRelease ( button, x, y )
end

function Clickable:MousePress ( button, x, y )
	if self.destroyed == true then
		return
	end
	self.down = true
	self:OnPress ( button, x, y )
end
