actionbar: make use of hook functions

This commit is contained in:
shagu
2018-03-05 21:06:52 +01:00
parent 55e2d06834
commit 9f33e0b037
+10 -32
View File
@@ -4,35 +4,15 @@ pfUI:RegisterModule("actionbar", function ()
default_border = C.appearance.border.actionbars
end
-- override wow ui functions
function _G.ActionButton_ShowGrid(button)
if not button then button = this end
button.showgrid = button.showgrid + 1
button:Show()
end
hooksecurefunc("MultiActionBar_ShowAllGrids", function()
MultiActionBar_UpdateGrid("BonusAction", 1)
MultiActionBar_UpdateGrid("Action", 1)
end)
function _G.ActionButton_HideGrid(button)
if not button then button = this end
button.showgrid = button.showgrid - 1
if button.showgrid == 0 and not HasAction(ActionButton_GetPagedID(button)) then
button:Hide()
end
end
function _G.MultiActionBar_ShowAllGrids()
for _, bar in pairs({ "MultiBarBottomLeft", "MultiBarBottomRight",
"MultiBarRight", "MultiBarLeft", "BonusAction", "Action" }) do
MultiActionBar_UpdateGrid(bar, 1)
end
end
function _G.MultiActionBar_HideAllGrids()
for _, bar in pairs({ "MultiBarBottomLeft", "MultiBarBottomRight",
"MultiBarRight", "MultiBarLeft", "BonusAction", "Action" }) do
MultiActionBar_UpdateGrid(bar)
end
end
hooksecurefunc("MultiActionBar_HideAllGrids", function()
MultiActionBar_UpdateGrid("BonusAction")
MultiActionBar_UpdateGrid("Action")
end)
hooksecurefunc("ShowBonusActionBar", function()
if pfActionBar then pfActionBar:Hide() end
@@ -600,10 +580,8 @@ pfUI:RegisterModule("actionbar", function ()
button:SetHeight(C.bars.icon_size)
button:Show()
local texture = _G[actionbutton..i..'NormalTexture']
texture:SetAlpha(0)
texture:SetAllPoints(button)
texture:SetTexCoord(.08, .92, .08, .92)
button:SetNormalTexture("")
button.SetNormalTexture = function() return end
local icon = _G[actionbutton..i..'Icon']
icon:SetAllPoints(button)