--
-- Pannello Comandi
--
-- @author  Fabyte
-- @date  	11/04/14
--
--

pannello = {};

function pannello.prerequisitesPresent(specializations)
    return true;
end;

function pannello:load(xmlFile)

	-- pannello
	self.detachPosition = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.Panel#detachPosition"));
	self.controlPanel = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.Panel#index"));
	pannello.attacherVehicleCopy = nil;

end;
function pannello:delete()
end;
function pannello:mouseEvent(posX, posY, isDown, isUp, button)
end;
function pannello:keyEvent(unicode, sym, modifier, isDown)
end;
function pannello:update(dt)
end;
function pannello:updateTick(dt)
end;
function pannello:draw()	
end;

function pannello:onAttach(attacherVehicle)
	pannello.attacherVehicleCopy = attacherVehicle;
	if attacherVehicle.addControlPanel ~= nil then
		local wasSuccessful = attacherVehicle:addControlPanel(self);
	else
		setVisibility(self.controlPanel, false);
	end;
end;

function pannello:onDetach()
	if pannello.attacherVehicleCopy.removeControlPanel ~= nil then
		local wasSuccessful = pannello.attacherVehicleCopy:removeControlPanel(self);
	else
		setVisibility(self.controlPanel, true);
	end;
	pannello.attacherVehicleCopy = nil;
end;
