zone ability button
Goranaws opened this issue ยท 5 comments
Do the extra action button and zone ability button ever display at the same time? perhaps the buttons could be handle by one bar? I'll see what I can do...
I'm working on this again. Working on the cast bar with you has taught me some things. :)
if not _G['DraenorZoneAbilityFrame'] then return end
--[[ Globals ]]--
local Addon = _G[...]
local KeyBound = LibStub('LibKeyBound-1.0')
local Tooltips = Addon:GetModule('Tooltips')
local Bindings = Addon.BindingsController
--[[ buttons ]]--
local ZoneActionButton = Addon:CreateClass('Button')
do
local unused = {}
function ZoneActionButton:New(id)
local button = self:Restore(id) or self:Create(id)
Tooltips:Register(button)
return button
end
function ZoneActionButton:Create(id)
local button = self:Bind(DraenorZoneAbilityFrame.SpellButton)
if button then
button.icon = button.Icon
button.style = button.Style
return button
end
end
function ZoneActionButton:Restore(id)
local b = unused and unused[id]
if b then
unused[id] = nil
b:Show()
return b
end
end
--saving them thar memories
function ZoneActionButton:Free()
unused[self:GetID()] = self
self:SetParent(nil)
self:Hide()
Tooltips:Unregister(self)
end
end
--[[ bar ]]--
local ZoneBar = Addon:CreateClass('Frame', Addon.ButtonBar)
do
function ZoneBar:New()
local bar = ZoneBar.proto.New(self, 'zone')
bar:UpdateShowBlizzardTexture()
return bar
end
function ZoneBar:GetDefaults()
return {
point = 'CENTER',
x = 244,
y = 0,
}
end
function ZoneBar:GetShowStates()
end
function ZoneBar:NumButtons()
return 1
end
function ZoneBar:GetButton(index)
local button = ZoneActionButton:New(index)
button:SetAttribute('showgrid', 1)
return button
end
function ZoneBar:ShowBlizzardTexture(show)
self.sets.hideBlizzardTeture = not show
self:UpdateShowBlizzardTexture()
end
function ZoneBar:ShowingBlizzardTexture()
return not self.sets.hideBlizzardTeture
end
function ZoneBar:UpdateShowBlizzardTexture()
local showTexture = self:ShowingBlizzardTexture()
for i, button in pairs(self.buttons) do
if showTexture then
button.style:Show()
else
button.style:Hide()
end
end
end
function ZoneBar:CreateMenu()
local bar = self
local menu = Addon:NewMenu(bar.id)
local panel = menu:AddLayoutPanel()
local L = LibStub('AceLocale-3.0'):GetLocale('Dominos-Config')
local showTextureButton = panel:NewCheckButton(L.ExtraBarShowBlizzardTexture)
showTextureButton:SetScript('OnShow', function(self)
self:SetChecked(bar:ShowingBlizzardTexture())
end)
showTextureButton:SetScript('OnClick', function(self)
bar:ShowBlizzardTexture(self:GetChecked())
end)
menu:AddAdvancedPanel()
self.menu = menu
end
end
--[[ module ]]--
local ZoneBarController = Addon:NewModule('ZoneBar')
function ZoneBarController:OnInitialize()
_G['DraenorZoneAbilityFrame'].ignoreFramePositionManager = true
end
function ZoneBarController:Load()
self.frame = ZoneBar:New()
end
function ZoneBarController:Unload()
self.frame:Free()
end
Possibly, at least if not now then maybe in the future. I'd rather keep them separate because of that.
It won't be difficult to make dominos control the zone ability button, so I can do that at least.
here's the code: http://pastebin.com/rqpcU9Ea
I copied that directly from extraActionBar.lua I couldn't get some things to work, but i'm sure you can. ;-)