Skip to content

Commit

Permalink
fix(ui): use new settings icon in retail for menu button
Browse files Browse the repository at this point in the history
  • Loading branch information
exochron committed Jul 28, 2024
1 parent 24971e0 commit 628835c
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions UI/SettingsDropDown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -166,51 +166,50 @@ local function BuildWheelButton()
template = "UIMenuButtonStretchTemplate"
end

local button = CreateFrame("Button", nil, MountJournal, template)
local button = CreateFrame(MenuUtil and "DropdownButton" or "Button", nil, MountJournal, template)

button:SetWidth(24)
button:SetHeight(24)
button:SetPoint("RIGHT", CollectionsJournal.CloseButton, "LEFT", 0, 0)
button:SetFrameLevel(555)

local tex = button:CreateTexture(nil, "ARTWORK")
tex:SetPoint("TOPLEFT", 4, -4)
tex:SetPoint("BOTTOMRIGHT", -4, 4)
if GetFileIDFromPath("interface/cursor/crosshair/engineerskin") then
tex:SetTexture(4675627) -- wrench cursor
local icon = button:CreateTexture(nil, "ARTWORK")
icon:SetPoint("TOPLEFT", 4, -4)
icon:SetPoint("BOTTOMRIGHT", -4, 4)
if GetFileIDFromPath("Interface/QuestFrame/QuestlogFrame") then
icon:SetAtlas("QuestLog-icon-setting")
else
tex:SetTexture(235498) -- wrench cursor
icon:SetTexture(235498) -- wrench cursor
icon:SetDesaturated(true)
end
tex:SetDesaturated(true)
button.Icon = icon

button:SetHighlightAtlas("mechagon-projects", "ADD")
tex = button:GetHighlightTexture()
tex:SetPoint("TOPLEFT", button, "TOPLEFT", 3, -3)
tex:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -3, 3)
tex:SetAlpha(0.35)
tex:SetBlendMode("ADD")
local highlight = button:GetHighlightTexture()
highlight:SetAtlas("QuestLog-icon-setting")
highlight:SetAlpha(0.4)
highlight:SetBlendMode("ADD")
highlight:SetAllPoints(icon)

return button
end

ADDON.Events:RegisterCallback("loadUI", function()
ADDON.UI.SettingsButton = BuildWheelButton()

local menu
ADDON.UI.SettingsButton:HookScript("OnClick", function(self)
if MenuUtil then
local anchor = CreateAnchor("TOPLEFT", self, "CENTER", -3, 5)
ADDON.UI.OpenContextMenu(self, anchor, CreateSettingsMenu)
else
if ADDON.UI.SettingsButton.SetupMenu then
ADDON.UI.SettingsButton:SetupMenu(CreateSettingsMenu)
else
local menu
ADDON.UI.SettingsButton:HookScript("OnClick", function(self)
PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON)
if menu == nil then
menu = CreateFrame("Frame", ADDON_NAME .. "SettingsMenu", MountJournal, "UIDropDownMenuTemplate")
UIDropDownMenu_Initialize(menu, InitializeUIDDM, "MENU")
end

ToggleDropDownMenu(1, nil, menu, self, 0, 0)
end
end)
end)
end
end, "settings wheel")

ADDON.UI:RegisterUIOverhaulCallback(function(frame)
Expand Down

0 comments on commit 628835c

Please sign in to comment.