- Button: added action drag support

- Button: added show grid option
- Options: cleanup and sorting
This commit is contained in:
Hendrik Leppkes
2007-12-30 21:36:55 +00:00
parent 09bb28f162
commit 72b94f4db2
4 changed files with 96 additions and 57 deletions
+28 -2
View File
@@ -21,6 +21,7 @@ do
buttons = "Buttons",
rows = "Rows",
enabled = "Enabled",
grid = "Grid",
}
-- retrieves a valid bar object from the modules actionbars table
@@ -79,6 +80,7 @@ function module:GetOptionsTable()
-- order = inherited (5)
args = {
padding = {
order = 30,
type = "range",
name = "Padding",
desc = "Configure the padding of the buttons.",
@@ -86,6 +88,14 @@ function module:GetOptionsTable()
set = optSetter,
get = optGetter,
},
grid = {
order = 5,
type = "toggle",
name = "Button Grid",
desc = "Toggle the button grid.",
set = optSetter,
get = optGetter,
},
},
},
layout = {
@@ -184,6 +194,7 @@ function ActionBar:UpdateButtons(numbuttons)
self.buttons = buttons
self:UpdateButtonLayout()
self:SetGrid()
end
-- align the buttons and correct the size of the bar overlay frame
@@ -223,7 +234,7 @@ end
-- set the padding and refresh layout
function ActionBar:SetPadding(pad)
if pad then
if pad ~= nil then
self.config.padding = pad
end
self:UpdateButtonLayout()
@@ -244,7 +255,7 @@ end
-- set the number of rows and refresh layout
function ActionBar:SetRows(rows)
if rows then
if rows ~= nil then
self.config.rows = rows
end
self:UpdateButtonLayout()
@@ -260,6 +271,21 @@ function ActionBar:SetEnabled(state)
end
end
function ActionBar:GetGrid()
return self.config.showgrid
end
function ActionBar:SetGrid(state)
if state ~= nil then
self.config.showgrid = state
end
if self.config.showgrid then
self:ForAll("ShowGrid", true)
else
self:ForAll("HideGrid", true)
end
end
--[[===================================================================================
Utility function
===================================================================================]]--