Skin the Clear invalid slots button and grey the dead ones
A third button sits on the wardrobe model alongside Apply and Cancel and appears under the same condition: Clear invalid slots, shown with the warning that an appearance has not been unlocked yet. It was simply not in the list, so it kept its native green pill against the two now-flat buttons beside it. It is drawn from the same atlas as Apply -- the green variant of the gold file -- so Skin.RedButtonArt already matches it and the existing path covers it whole; probing its regions after the pass comes back nil for all of them. With three names the list is read in a loop rather than repeated call by call. Apply is disabled for as long as an invalid slot is pending, and with the pill gone nothing said so any more: the ElvUI panel is drawn the same either way, and the atlas was the only thing carrying the distinction. The label is greyed instead, the same yellow/grey pair the specialization menu's Activate button uses. There is no event for the state change -- clearing the invalid slots enables Apply on the spot -- so it is driven from the button's update and compared against the cached state, again as Activate does it, and the border goes with it: Apply comes alive under the very cursor that just clicked Clear invalid slots, and OnEnter has been and gone by then.
This commit is contained in:
+57
-20
@@ -13,23 +13,50 @@ local function SkinActionButtons()
|
|||||||
Skin:Button(_G[FRAME_NAME.."DisableSpellVisualsButton"])
|
Skin:Button(_G[FRAME_NAME.."DisableSpellVisualsButton"])
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Apply and Cancel only exist while a transmog change is pending, which is why
|
-- Apply, Cancel and Clear invalid slots only exist while a transmog change is
|
||||||
-- they were missed for so long -- but they exist from the start rather than
|
-- pending, which is why they were missed for so long -- but they exist from the
|
||||||
-- being created on the first change (probed: both are Buttons, hidden, with
|
-- start rather than being created on the first change (probed: they are
|
||||||
-- nothing pending), so the normal skin pass reaches them.
|
-- Buttons, hidden, with nothing pending), so the normal skin pass reaches them.
|
||||||
--
|
--
|
||||||
-- Same widget as the talent frame's Activate button: the pill is drawn across
|
-- Same widget as the talent frame's Activate button: the pill is drawn across
|
||||||
-- plain regions, with no Normal/Pushed texture for HandleButton to clear
|
-- plain regions, with no Normal/Pushed texture for HandleButton to clear
|
||||||
-- (probed: both come back nil). Apply takes the green variant of the gold
|
-- (probed: they come back nil). Apply and Clear invalid slots take the green
|
||||||
-- atlas, Cancel is drawn from the red file instead -- Skin.RedButtonArt matches
|
-- variant of the gold atlas, Cancel is drawn from the red file instead --
|
||||||
-- both, and Cancel's HIGHLIGHT region goes with the rest of its art.
|
-- Skin.RedButtonArt matches both files, and Cancel's HIGHLIGHT region goes with
|
||||||
|
-- the rest of its art.
|
||||||
--
|
--
|
||||||
-- The labels don't carry the atlas's green/red split over: the two buttons sit
|
-- The labels don't carry the atlas's green/red split over: the buttons sit in a
|
||||||
-- side by side and read apart by their text, and they take the same yellow
|
-- row and read apart by their text, and they take the same yellow every other
|
||||||
-- every other templated button on these frames uses -- the talent frame's live
|
-- templated button on these frames uses -- the talent frame's live Activate
|
||||||
-- Activate label included -- so a pending change doesn't get its own colour
|
-- label included -- so a pending change doesn't get its own colour scheme. The
|
||||||
-- scheme.
|
-- grey is the disabled half of that same pair.
|
||||||
local LABEL_COLOR = {1, 0.82, 0}
|
local LABEL_COLOR = {1, 0.82, 0}
|
||||||
|
local DISABLED_LABEL_COLOR = {0.55, 0.55, 0.55}
|
||||||
|
|
||||||
|
-- Apply is disabled for as long as an invalid slot is pending, and with the
|
||||||
|
-- pill gone nothing else says so -- the ElvUI panel is drawn the same either
|
||||||
|
-- way. The label is greyed instead, exactly as the talent frame does it for the
|
||||||
|
-- active spec's Activate button.
|
||||||
|
--
|
||||||
|
-- Driven from the button's update because there's no event for the state
|
||||||
|
-- change: clearing the invalid slots enables Apply on the spot. The cached
|
||||||
|
-- state is what keeps that cheap -- the colours are only written when the state
|
||||||
|
-- actually flips.
|
||||||
|
local function UpdatePendingButtonState(button)
|
||||||
|
local enabled = Skin:IsEnabled(button)
|
||||||
|
|
||||||
|
if enabled == button.CoAPendingEnabled then return end
|
||||||
|
button.CoAPendingEnabled = enabled
|
||||||
|
|
||||||
|
-- Clearing the invalid slots enables Apply under the very cursor that just
|
||||||
|
-- clicked Clear invalid slots, so its hover border would stay dark until
|
||||||
|
-- the pointer moved off. This update already watches the state, so it
|
||||||
|
-- carries the border too.
|
||||||
|
Skin:RefreshButtonBorder(button)
|
||||||
|
|
||||||
|
local text = button.GetFontString and button:GetFontString()
|
||||||
|
if text then text:SetTextColor(unpack(enabled and LABEL_COLOR or DISABLED_LABEL_COLOR)) end
|
||||||
|
end
|
||||||
|
|
||||||
-- The strip runs on every pass rather than once behind the skinned guard: the
|
-- The strip runs on every pass rather than once behind the skinned guard: the
|
||||||
-- art is only there to be cleared once a change is pending, and nothing fires
|
-- art is only there to be cleared once a change is pending, and nothing fires
|
||||||
@@ -41,24 +68,34 @@ local function SkinPendingButton(name)
|
|||||||
|
|
||||||
Skin:StripArtByFile(button, Skin.RedButtonArt)
|
Skin:StripArtByFile(button, Skin.RedButtonArt)
|
||||||
|
|
||||||
if button.CoASkinned then return end
|
if not button.CoASkinned then
|
||||||
button.CoASkinned = true
|
button.CoASkinned = true
|
||||||
|
|
||||||
-- Stripped before templating: HandleButton adds its backdrop as regions of
|
-- Stripped before templating: HandleButton adds its backdrop as regions
|
||||||
-- this same button, so a strip afterwards takes the backdrop with the pill.
|
-- of this same button, so a strip afterwards takes the backdrop with the
|
||||||
|
-- pill.
|
||||||
Skin:Button(button)
|
Skin:Button(button)
|
||||||
|
|
||||||
local text = button.GetFontString and button:GetFontString()
|
|
||||||
if text then text:SetTextColor(unpack(LABEL_COLOR)) end
|
|
||||||
|
|
||||||
button:HookScript("OnShow", function(self)
|
button:HookScript("OnShow", function(self)
|
||||||
Skin:StripArtByFile(self, Skin.RedButtonArt)
|
Skin:StripArtByFile(self, Skin.RedButtonArt)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
button:HookScript("OnUpdate", UpdatePendingButtonState)
|
||||||
|
end
|
||||||
|
|
||||||
|
UpdatePendingButtonState(button)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local PENDING_BUTTONS = {
|
||||||
|
"PlayerModelApplyButton",
|
||||||
|
"PlayerModelCancelButton",
|
||||||
|
"PlayerModelClearInvalidButton",
|
||||||
|
}
|
||||||
|
|
||||||
local function SkinPendingButtons()
|
local function SkinPendingButtons()
|
||||||
SkinPendingButton(FRAME_NAME.."PlayerModelApplyButton")
|
for _, suffix in ipairs(PENDING_BUTTONS) do
|
||||||
SkinPendingButton(FRAME_NAME.."PlayerModelCancelButton")
|
SkinPendingButton(FRAME_NAME..suffix)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function SkinSearchBox()
|
local function SkinSearchBox()
|
||||||
|
|||||||
Reference in New Issue
Block a user