implement option to change the button style
This commit is contained in:
+21
-3
@@ -23,6 +23,7 @@ do
|
||||
rows = "Rows",
|
||||
enabled = "Enabled",
|
||||
grid = "Grid",
|
||||
style = "Style",
|
||||
}
|
||||
|
||||
-- retrieves a valid bar object from the modules actionbars table
|
||||
@@ -95,7 +96,15 @@ function module:GetOptionsObject()
|
||||
desc = "Toggle the button grid.",
|
||||
set = optSetter,
|
||||
get = optGetter,
|
||||
width = "full",
|
||||
},
|
||||
style = {
|
||||
order = 59,
|
||||
name = "Style",
|
||||
type = "select",
|
||||
desc = "Button Style",
|
||||
values = Bartender4.ButtonStyle:GetStyles(),
|
||||
set = optSetter,
|
||||
get = optGetter,
|
||||
},
|
||||
buttons = {
|
||||
order = 60,
|
||||
@@ -161,9 +170,9 @@ end
|
||||
-- Update the number of buttons in our bar, creating new ones if necessary
|
||||
function ActionBar:UpdateButtons(numbuttons)
|
||||
if numbuttons then
|
||||
self.config.buttons = numbuttons
|
||||
self.config.buttons = min(numbuttons, 12)
|
||||
else
|
||||
numbuttons = self.config.buttons
|
||||
numbuttons = min(self.config.buttons, 12)
|
||||
end
|
||||
|
||||
local buttons = self.buttons or {}
|
||||
@@ -254,6 +263,15 @@ function ActionBar:SetRows(rows)
|
||||
self:UpdateButtonLayout()
|
||||
end
|
||||
|
||||
function ActionBar:GetStyle()
|
||||
return self.config.style
|
||||
end
|
||||
|
||||
function ActionBar:SetStyle(style)
|
||||
self.config.style = style
|
||||
self:ForAll("ApplyStyle", style)
|
||||
end
|
||||
|
||||
function ActionBar:GetEnabled()
|
||||
return true
|
||||
end
|
||||
|
||||
+2
-4
@@ -8,15 +8,13 @@ Bartender4.ButtonStyle = {}
|
||||
|
||||
local styles = {
|
||||
["default"] = "Default",
|
||||
["bongos"] = "Bongos Style",
|
||||
["zoom"] = "Full Zoom",
|
||||
["dream"] = "Dreamlayout",
|
||||
}
|
||||
|
||||
local styledata = {
|
||||
--["default"] = {},
|
||||
["bongos"] = { texCoord = {0.06, 0.94, 0.06, 0.94} },
|
||||
["zoom"] = { texCoord = {0.08,0.92,0.08,0.92} },
|
||||
["default"] = {},
|
||||
["zoom"] = { texCoord = {0.06, 0.94, 0.06, 0.94} },
|
||||
["dream"] = {
|
||||
texCoord = {0.08,0.92,0.08,0.92},
|
||||
padding = 3,
|
||||
|
||||
Reference in New Issue
Block a user