/
extraActionBar.lua
64 lines (51 loc) · 1.03 KB
/
extraActionBar.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
local ExtraActionBarFrame = _G['ExtraActionBarFrame']
if not ExtraActionBarFrame then return end
local ExtraBar = Dominos:CreateClass('Frame', Dominos.Frame)
Dominos.ExtraBar = ExtraBar
function ExtraBar:New()
local f = self.super.New(self, 'extra')
f:LoadButtons()
f:Layout()
f:UpdateButtonsShown()
return f
end
function ExtraBar:GetDefaults()
return {
point = 'CENTER',
x = -244,
y = 0,
}
end
function ExtraBar:GetShowStates()
return '[extrabar]show;hide'
end
function ExtraBar:NumButtons(f)
return 1
end
function ExtraBar:AddButton(i)
local b = self:GetExtraButton(i)
if b then
b:SetAttribute('showgrid', 1)
b:SetParent(self.header)
b:Show()
self.buttons[i] = b
end
end
function ExtraBar:RemoveButton(i)
local b = self.buttons[i]
if b then
b:SetParent(nil)
b:Hide()
self.buttons[i] = nil
end
end
function ExtraBar:GetExtraButton(index)
return _G['ExtraActionButton' .. index]
end
function ExtraBar:UpdateButtonsShown()
if HasExtraActionBar() then
self.header:Show()
else
self.header:Hide()
end
end