function IconController.setGameTheme(q)IconController.gameTheme=q local X=IconController.getIcons()for X,M in pairs(X)do M:setTheme(q)end end function IconController.setDisplayOrder(q)q=tonumber(q)or TopbarPlusGui.DisplayOrder TopbarPlusGui.DisplayOrder=q end IconController.setDisplayOrder(10)function IconController.getIcons()local q={}for X,M in pairs(topbarIcons)do table.insert(q,X)end return q end function IconController.getIcon(q)for X,M in pairs(topbarIcons)do if X.name==q then return X end end return false end function IconController.disableHealthbar(q)local X=q==nil or q IconController.healthbarDisabled=X IconController.healthbarDisabledSignal:Fire(X)end function IconController.disableControllerOption(q)local X=q==nil or q disableControllerOption=X if IconController.getIcon("\095\084\111\112\098\097\114\067\111\110\116\114\111\108\108\101\114\079\112\116\105\111\110")then IconController._determineControllerDisplay()end end function IconController.canShowIconOnTopbar(q)if(q.enabled==true or q.accountForWhenDisabled)and q.presentOnTopbar then return true end return false end function IconController.getMenuOffset(q)local X=q:get("\097\108\105\103\110\109\101\110\116")local M=IconController[X.."\071\097\112"]local C=0 local V=0 local h=0 if q.menuOpen then local X=q:get("\109\101\110\117\083\105\122\101")local w=X.X.Offset local B=q:_getMenuDirection()if B=="\114\105\103\104\116"then V+=w+M/6 elseif B=="\108\101\102\116"then C=w+4 V+=M/3 h=w end end return C,V,h 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.disableHealthbar(bool)
	local finalBool = (bool == nil or bool)
	IconController.healthbarDisabled = finalBool
	IconController.healthbarDisabledSignal:Fire(finalBool)
end

function IconController.disableControllerOption(bool)
	local finalBool = (bool == nil or bool)
	disableControllerOption = finalBool
	if IconController.getIcon("_TopbarControllerOption") then
		IconController._determineControllerDisplay()
	end
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 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
