Show pfUI's dropdowns and menus with ClassicAPI's menu system

pfUIDropdownTemplate (a DropdownButton) replaces CreateDropDownButton in
the config GUI, addon profiles, the trigger editor and the icon picker
filter. The equipment set gear menu and the tracking menu open
MenuUtil context menus. pfUIMenuStyleMixin draws pfUI's backdrop behind
them, and the skin module makes it the default style and draws the
checkboxes and radios as pfUI boxes.
This commit is contained in:
Brues
2026-10-30 19:33:40 -05:00
parent f37ea00226
commit af9edb215d
7 changed files with 292 additions and 444 deletions
+56
View File
@@ -35,6 +35,62 @@ pfUI:RegisterModule("skin", function ()
CreateBackdropShadow(_G["DropDownList"..i.."Backdrop"])
end
-- ClassicAPI menus that don't name a style of their own take pfUI's
function MenuVariants.GetDefaultMenuMixin() return pfUIMenuStyleMixin end
function MenuVariants.GetDefaultContextMenuMixin() return pfUIMenuStyleMixin end
-- ClassicAPI menus draw their checkboxes and radios with these. Both get a
-- pfUI box: a checked box holds a check, a selected radio a filled square.
local function CreateSelectionBox(frame, text)
local _, border = GetBorderSize()
local box = frame:AttachTexture()
frame.leftTexture1 = box
box:SetDrawLayer("BORDER")
box:SetPoint("LEFT")
box:SetSize(12, 12)
box:SetColorTexture(GetStringColorObject(C.appearance.border.color):GetRGBA())
local inside = frame:AttachTexture()
inside:SetDrawLayer("ARTWORK")
inside:SetPoint("TOPLEFT", box, "TOPLEFT", border, -border)
inside:SetPoint("BOTTOMRIGHT", box, "BOTTOMRIGHT", -border, border)
local r, g, b = GetStringColorObject(C.appearance.border.background):GetRGB()
inside:SetColorTexture(r, g, b, 1)
local fontString = frame:AttachFontString()
frame.fontString = fontString
fontString:SetPoint("LEFT", box, "RIGHT", 6, 0)
fontString:SetHeight(20)
fontString:SetTextToFit(text)
return box
end
function MenuVariants.CreateCheckbox(text, frame, isSelected, data)
local box = CreateSelectionBox(frame, text)
if isSelected(data) then
local check = frame:AttachTexture()
check:SetDrawLayer("OVERLAY")
check:SetPoint("CENTER", box)
check:SetSize(16, 16)
check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check")
end
return box
end
function MenuVariants.CreateRadio(text, frame, isSelected, data)
local box = CreateSelectionBox(frame, text)
if isSelected(data) then
local dot = frame:AttachTexture()
dot:SetDrawLayer("OVERLAY")
dot:SetPoint("TOPLEFT", box, "TOPLEFT", 3, -3)
dot:SetPoint("BOTTOMRIGHT", box, "BOTTOMRIGHT", -3, 3)
dot:SetColorTexture(.2, 1, .8, 1)
end
return box
end
if C.global.errors_limit == "1" then
UIErrorsFrame:SetHeight(25)
end