-- Extended context menu

ContextMenuEx = {}
ContextMenuEx_mt = { __index = ContextMenuEx }

function ContextMenuEx.Create()
	local contextMenuEx = {}
	setmetatable(contextMenuEx, ContextMenuEx_mt)

	contextMenuEx.menu = intruder.GContextMenuEx()
	contextMenuEx.itemCount = 0
	contextMenuEx.items= {}

	return contextMenuEx
end

function ContextMenuEx:SelectAt(pos, data)
	local result = self.menu:SelectAt(pos)

	--if result ~= 0 then
	--	self.items[result].lambda(data)
	--end
	return result;
end

function ContextMenuEx:AddItem(cmdId, name, lambda)
	self.items[self.itemCount] = {["name"]=name, ["lambda"]=lambda}
	self.itemCount = self.itemCount  + 1

	self.menu:AddItem(cmdId, name)
end

function ContextMenuEx:AddMenu(subMenu, name)
	self.menu:AddMenu(subMenu, name)
end
