Full-width class name header, per-class Hide/Show buttons

- Class name in the Classes tab is now a centered full-width heading
  flanked by thin lines, matching the Character Override tab's
  profile heading style, instead of a plain left-aligned label.
- Add "Hide This Class" / "Show This Class" buttons below the frame
  checkboxes, scoped to whichever class tab is currently selected
  (the existing Hide All/Show All at the top still act on every
  class). Both buttons grey out alongside the checkboxes when the
  logged-in character's own class has its profile override enabled.
This commit is contained in:
2026-07-08 00:35:26 +02:00
parent 65dcb96c1d
commit 8c8362f75e
+91 -5
View File
@@ -101,11 +101,32 @@ local classContent = CreateFrame("Frame", nil, contentBox)
classContent:SetPoint("TOPLEFT", contentBox, "TOPLEFT", 12, -4)
classContent:SetPoint("BOTTOMRIGHT", contentBox, "BOTTOMRIGHT", -12, 4)
local classLabel = classContent:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
classLabel:SetPoint("TOPLEFT", classContent, "TOPLEFT", 16, -12)
local classLabelHeader = CreateFrame("Frame", nil, classContent)
classLabelHeader:SetPoint("TOPLEFT", classContent, "TOPLEFT", 0, -4)
classLabelHeader:SetPoint("TOPRIGHT", classContent, "TOPRIGHT", 0, -4)
classLabelHeader:SetHeight(18)
local classLabel = classLabelHeader:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
classLabel:SetPoint("TOP")
classLabel:SetPoint("BOTTOM")
classLabel:SetJustifyH("CENTER")
local classLabelLeft = classLabelHeader:CreateTexture(nil, "ARTWORK")
classLabelLeft:SetHeight(8)
classLabelLeft:SetPoint("LEFT", 0, 0)
classLabelLeft:SetPoint("RIGHT", classLabel, "LEFT", -5, 0)
classLabelLeft:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
classLabelLeft:SetTexCoord(0.81, 0.94, 0.5, 1)
local classLabelRight = classLabelHeader:CreateTexture(nil, "ARTWORK")
classLabelRight:SetHeight(8)
classLabelRight:SetPoint("RIGHT", 0, 0)
classLabelRight:SetPoint("LEFT", classLabel, "RIGHT", 5, 0)
classLabelRight:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
classLabelRight:SetTexCoord(0.81, 0.94, 0.5, 1)
local overrideNoticeText = classContent:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
overrideNoticeText:SetPoint("TOPLEFT", classLabel, "BOTTOMLEFT", 0, -8)
overrideNoticeText:SetPoint("TOPLEFT", classLabelHeader, "BOTTOMLEFT", 16, -8)
overrideNoticeText:SetTextColor(1, 0.35, 0.35)
overrideNoticeText:SetText("These settings are currently overridden")
overrideNoticeText:Hide()
@@ -113,13 +134,14 @@ overrideNoticeText:Hide()
local checks = {}
local selectedClass = nil
local previousAnchor = classLabel
local previousAnchor = classLabelHeader
local previousSpacing = -34
local previousXOffset = 16
for _, frameName in ipairs(HideCoA.FRAMES) do
local check = CreateFrame("CheckButton", "HideCoAClassCheck" .. frameName, classContent, "InterfaceOptionsCheckButtonTemplate")
check:SetPoint("TOPLEFT", previousAnchor, "BOTTOMLEFT", 0, previousSpacing)
check:SetPoint("TOPLEFT", previousAnchor, "BOTTOMLEFT", previousXOffset, previousSpacing)
_G[check:GetName() .. "Text"]:SetText("Hide " .. frameName)
@@ -145,12 +167,15 @@ for _, frameName in ipairs(HideCoA.FRAMES) do
checks[frameName] = check
previousAnchor = check
previousSpacing = -8
previousXOffset = 0
end
local tabButtons = {}
local TAB_HEIGHT = 18
local hideClassButton, showClassButton
local function SelectClass(class)
selectedClass = class
@@ -188,6 +213,14 @@ local function SelectClass(class)
end
if overridden then
hideClassButton:Disable()
showClassButton:Disable()
else
hideClassButton:Enable()
showClassButton:Enable()
end
for tabClass, button in pairs(tabButtons) do
if tabClass == class then
button.selectedTexture:Show()
@@ -198,6 +231,59 @@ local function SelectClass(class)
end
hideClassButton = CreateFrame("Button", "HideCoAHideClassButton", classContent, "UIPanelButtonTemplate")
hideClassButton:SetPoint("TOPLEFT", previousAnchor, "BOTTOMLEFT", 0, -16)
hideClassButton:SetSize(140, 22)
hideClassButton:SetText("Hide This Class")
showClassButton = CreateFrame("Button", "HideCoAShowClassButton", classContent, "UIPanelButtonTemplate")
showClassButton:SetPoint("LEFT", hideClassButton, "RIGHT", 8, 0)
showClassButton:SetSize(140, 22)
showClassButton:SetText("Show This Class")
if ElvSkins then
ElvSkins:HandleButton(hideClassButton)
ElvSkins:HandleButton(showClassButton)
end
hideClassButton:SetScript("OnClick", function()
if not selectedClass then
return
end
local classSettings = HideCoA.GetActiveClassSettings()[selectedClass]
for _, frameName in ipairs(HideCoA.FRAMES) do
classSettings[frameName] = true
end
HideCoA.ApplySetting()
SelectClass(selectedClass)
end)
AddClickSound(hideClassButton)
showClassButton:SetScript("OnClick", function()
if not selectedClass then
return
end
local classSettings = HideCoA.GetActiveClassSettings()[selectedClass]
for _, frameName in ipairs(HideCoA.FRAMES) do
classSettings[frameName] = false
end
HideCoA.ApplySetting()
SelectClass(selectedClass)
end)
AddClickSound(showClassButton)
for index, class in ipairs(HideCoA.CUSTOM_CLASSES) do
local button = CreateFrame("Button", "HideCoAClassTab" .. class, classSidebar)