actionbar: entire rewrite of the actionbars

Final squashed commit of the actionbars. Ready for master.
Config migration is now armed, you can't go back without backups.
This commit is contained in:
shagu
2019-03-31 14:59:20 +02:00
parent f13ac95ebb
commit 26a9fff578
10 changed files with 1496 additions and 741 deletions
+19 -5
View File
@@ -814,11 +814,12 @@ function pfUI.api.BarButtonAnchor(button,basename,buttonindex,barsize,formfactor
return button._anchor
end
-- [ Create Autohide ] --
-- [ Enable Autohide ] --
-- 'frame' the frame that should be hidden
function pfUI.api.CreateAutohide(frame)
function pfUI.api.EnableAutohide(frame, timeout)
if not frame then return end
frame.hover = CreateFrame("Frame", frame:GetName() .. "Autohide", frame)
frame.hover = frame.hover or CreateFrame("Frame", frame:GetName() .. "Autohide", frame)
frame.hover:SetParent(frame)
frame.hover:SetAllPoints(frame)
frame.hover.parent = frame
@@ -828,20 +829,33 @@ function pfUI.api.CreateAutohide(frame)
this:Hide()
end)
local timeout = timeout
frame.hover:SetScript("OnUpdate", function()
if MouseIsOver(this, 10, -10, -10, 10) then
this.activeTo = GetTime() + tonumber(pfUI_config.bars.hide_time)
this.activeTo = GetTime() + timeout
this.parent:SetAlpha(1)
elseif this.activeTo then
if this.activeTo < GetTime() and this.parent:GetAlpha() > 0 then
this.parent:SetAlpha(this.parent:GetAlpha() - 0.1)
end
else
this.activeTo = GetTime() + tonumber(pfUI_config.bars.hide_time)
this.activeTo = GetTime() + timeout
end
end)
end
-- [ Disable Autohide ] --
-- 'frame' the frame that should get the autohide removed
function pfUI.api.DisableAutohide(frame)
if not frame then return end
if not frame.hover then return end
frame.hover:UnregisterAllEvents()
frame.hover:SetScript("OnUpdate", nil)
frame.hover:Hide()
frame:SetAlpha(1)
end
-- [ GetColoredTime ] --
-- 'remaining' the time in seconds that should be converted
-- return a colored string including a time unit (m/h/d)