function IconController.setGameTheme(m)IconController.gameTheme=m local O=IconController.getIcons()for O,n in pairs(O)do n:setTheme(m)end end function IconController.setDisplayOrder(m)m=tonumber(m)or TopbarPlusGui.DisplayOrder TopbarPlusGui.DisplayOrder=m end IconController.setDisplayOrder(10)function IconController.getIcons()local m={}for O,n in pairs(topbarIcons)do table.insert(m,O)end return m end function IconController.getIcon(m)for O,n in pairs(topbarIcons)do if O.name==m then return O end end return false end function IconController.canShowIconOnTopbar(m)if(m.enabled==true or m.accountForWhenDisabled)and m.presentOnTopbar then return true end return false end function IconController.getMenuOffset(m)local O=m:get("\097\108\105\103\110\109\101\110\116")local n=IconController[O.."\071\097\112"]local P=m:get("\105\099\111\110\083\105\122\101")or UDim2.new(0,32,0,32)local g=P.X.Offset local x=g+n local L=0 local D=0 local v=0 if m.menuOpen then local O=m:get("\109\101\110\117\083\105\122\101")local P=O.X.Offset local g=m:_getMenuDirection()if g=="\114\105\103\104\116"then D+=P+n/6 elseif g=="\108\101\102\116"then L=P+4 D+=n/3 v=P end end return L,D,v end

function IconController.setGameTheme(theme)
	IconController.gameTheme = theme
	local icons = IconController.getIcons()
	for _, icon in pairs(icons) do
		icon:setTheme(theme)
	end
end

function IconController.setDisplayOrder(value)
	value = tonumber(value) or TopbarPlusGui.DisplayOrder
	TopbarPlusGui.DisplayOrder = value
end
IconController.setDisplayOrder(10)

function IconController.getIcons()
	local allIcons = {}
	for otherIcon, _ in pairs(topbarIcons) do
		table.insert(allIcons, otherIcon)
	end
	return allIcons
end

function IconController.getIcon(name)
	for otherIcon, _ in pairs(topbarIcons) do
		if otherIcon.name == name then
			return otherIcon
		end
	end
	return false
end

function IconController.canShowIconOnTopbar(icon)
	if (icon.enabled == true or icon.accountForWhenDisabled) and icon.presentOnTopbar then
		return true
	end
	return false
end

function IconController.getMenuOffset(icon)
	local alignment = icon:get("alignment")
	local alignmentGap = IconController[alignment.."Gap"]
	local iconSize = icon:get("iconSize") or UDim2.new(0, 32, 0, 32)
	local sizeX = iconSize.X.Offset
	local iconWidthAndGap = (sizeX + alignmentGap)
	local extendLeft = 0
	local extendRight = 0
	local additionalRight = 0
	if icon.menuOpen then
		local menuSize = icon:get("menuSize")
		local menuSizeXOffset = menuSize.X.Offset
		local direction = icon:_getMenuDirection()
		if direction == "right" then
			extendRight += menuSizeXOffset + alignmentGap/6--2
		elseif direction == "left" then
			extendLeft = menuSizeXOffset + 4
			extendRight += alignmentGap/3--4
			additionalRight = menuSizeXOffset
		end
	end
	return extendLeft, extendRight, additionalRight
end
