Furhter split of the StateBar from the ActionBar

This commit is contained in:
Hendrik Leppkes
2009-02-23 16:12:18 +01:00
parent d0f4650b58
commit 723bb00618
3 changed files with 25 additions and 29 deletions
-14
View File
@@ -9,20 +9,6 @@ local abdefaults = {
buttons = 12,
hidemacrotext = false,
showgrid = false,
autoassist = false,
states = {
enabled = false,
possess = false,
actionbar = false,
default = 0,
ctrl = 0,
alt = 0,
shift = 0,
stance = {
['*'] = {
},
},
},
}, Bartender4.StateBar.defaults),
[1] = {
states = {
+10 -1
View File
@@ -146,6 +146,12 @@ function Bartender4.Button:Create(id, parent)
button:UpdateGrid()
button:ToggleButtonElements()
button:ClearStateAction()
for page = 0,11,1 do
local action = (page == 0) and button.id or (button.rid + (page - 1) * 12)
button:SetStateAction(page, action)
end
return button
end
@@ -241,6 +247,10 @@ function Button:GetNormalTexture()
return self.normalTexture
end
function Button:UpdateStates()
self:RefreshAllStateActions()
end
function Button:ClearStateAction()
for state in pairs(self.stateactions) do
self.stateactions = {}
@@ -256,7 +266,6 @@ function Button:SetStateAction(state, action)
end
function Button:RefreshAllStateActions()
self.stateconfig = {}
for state in pairs(self.stateactions) do
self:RefreshStateAction(state)
end
+15 -14
View File
@@ -5,6 +5,20 @@ local StateBar = setmetatable({}, {__index = ButtonBar})
local StateBar_MT = {__index = StateBar}
local defaults = Bartender4:Merge({
autoassist = false,
states = {
enabled = false,
possess = false,
actionbar = false,
default = 0,
ctrl = 0,
alt = 0,
shift = 0,
stance = {
['*'] = {
},
},
},
}, Bartender4.ButtonBar.defaults)
Bartender4.StateBar = {}
@@ -86,13 +100,9 @@ function StateBar:UpdateStates(returnOnly)
stancemap = DefaultStanceMap[playerclass]
end
self:ForAll("ClearStateAction")
for i=0,11 do
self:AddButtonStates(i)
end
self:ForAll("UpdateStates")
local statedriver
if returnOnly or not self:GetStateOption("customEnabled") then
statedriver = {}
local stateconfig = self.config.states
@@ -203,14 +213,6 @@ function StateBar:SetStanceStateOption(stance, state)
self:UpdateStates()
end
function StateBar:AddButtonStates(state, page)
if not page then page = state end
for _, button in self:GetAll() do
local action = (page == 0) and button.id or (button.rid + (page - 1) * 12)
button:SetStateAction(state, action)
end
end
function StateBar:GetStateOption(key)
return self.config.states[key]
end
@@ -238,7 +240,6 @@ function StateBar:SetConfigAutoAssist(_, value)
self.config.autoassist = value
end
self:UpdateStates()
self:ForAll("RefreshAllStateActions")
end
function StateBar:SetCopyCustomConditionals()