function IconController.setGameTheme(v)IconController.gameTheme=v local f=IconController.getIcons()for f,N in pairs(f)do N:setTheme(v)end end function IconController.setDisplayOrder(v)v=tonumber(v)or TopbarPlusGui.DisplayOrder TopbarPlusGui.DisplayOrder=v end IconController.setDisplayOrder(10)function IconController.getIcons()local v={}for f,N in pairs(topbarIcons)do table.insert(v,f)end return v end function IconController.getIcon(v)for f,N in pairs(topbarIcons)do if f.name==v then return f end end return false end function IconController.canShowIconOnTopbar(v)if(v.enabled==true or v.accountForWhenDisabled)and v.presentOnTopbar then return true end return false end function IconController.getMenuOffset(v)local f=v:get("\097\108\105\103\110\109\101\110\116")local N=IconController[f.."\071\097\112"]local D=v:get("\105\099\111\110\083\105\122\101")or UDim2.new(0,32,0,32)local i=D.X.Offset local u=i+N local V=0 local J=0 local p=0 if v.menuOpen then local f=v:get("\109\101\110\117\083\105\122\101")local D=f.X.Offset local i=v:_getMenuDirection()if i=="\114\105\103\104\116"then J+=D+N/6 elseif i=="\108\101\102\116"then V=D+4 J+=N/3 p=D end end return V,J,p end
-- METHODS
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
