first working stance bar, still needs events for updating etc

This commit is contained in:
Hendrik Leppkes
2008-02-16 17:17:31 +00:00
parent 1cec9114c9
commit 3f60367faf
4 changed files with 129 additions and 46 deletions
+41 -1
View File
@@ -8,7 +8,8 @@ local ButtonBar_MT = {__index = ButtonBar}
local defaults = Bartender4:Merge({
padding = 2,
rows = 1
rows = 1,
style = "dream",
}, Bartender4.Bar.defaults)
Bartender4.ButtonBar = {}
@@ -34,6 +35,7 @@ do
optionMap = {
rows = "Rows",
padding = "Padding",
style = "Style",
}
-- retrieves a valid bar object from the barregistry table
@@ -78,6 +80,15 @@ function ButtonBar:GetOptionObject()
set = optSetter,
get = optGetter,
},
style = {
order = 59,
name = "Style",
type = "select",
desc = "Button Style",
values = Bartender4.ButtonStyle:GetStyles(),
set = optSetter,
get = optGetter,
},
rows = {
order = 70,
name = "Rows",
@@ -152,3 +163,32 @@ function ButtonBar:UpdateButtonLayout()
end
end
end
function ButtonBar:GetStyle()
return self.config.style
end
function ButtonBar:SetStyle(style)
self.config.style = style
self:ForAll("ApplyStyle", style)
end
--[[===================================================================================
Utility function
===================================================================================]]--
-- get a iterator over all buttons
function ButtonBar:GetAll()
return pairs(self.buttons)
end
-- execute a member function on all buttons
function ButtonBar:ForAll(method, ...)
for _, button in self:GetAll() do
local func = button[method]
if func then
func(button, ...)
end
end
end