-- 
-- Please see the readme.txt file included with this distribution for 
-- attribution and copyright information.
--

skillstatenode = nil;

function update()
	if activesetnode then
		if window.isInSet(activesetnode.getValue()) then
			setIcon("indicator_checkon");
		else
			setIcon("indicator_checkoff");
		end
	end
end

function toggle()
	if activesetnode then
		local newstate = not window.isInSet(activesetnode.getValue());
		window.setInSet(activesetnode.getValue(), newstate);
	end
end

function isClassSkill()
	if activesetnode and window.isInSet(activesetnode.getValue()) then
		return true;
	end

	return false;
end

function onClickDown(button, x, y)
	toggle();
end

function onInit()
	-- Set selection
	activesetnode = NodeManager.createSafeChild(window.windowlist.window.getDatabaseNode(), "activeskillset", "number");
end
