Here ya go :P be gentle.
Code:
--[Thanks go to Mairelon on the WoW UI forum and Ayradyss on wowinterface.com's forums!]--
local print, buildbar
local rows, cols, scale = 10, 12, 1
local eventframe = CreateFrame("Frame")
eventframe:RegisterEvent("VARIABLES_LOADED")
eventframe:RegisterEvent("PLAYER_LOGIN")
eventframe:SetScript("OnEvent", function(self, event, ...)
if ( event == "PLAYER_LOGIN" ) then
buildbar(); print("Test")
end
end)
function print(str)
DEFAULT_CHAT_FRAME:AddMessage(tostring(str))
end
function buildbar()
local anchor = CreateFrame("Frame", "EasyBarAnchorFrame", UIParent)
anchor:SetWidth(2) anchor:SetHeight(2)
anchor:SetScale(scale)
local height, width
local action = 1
for row = 1, rows do
for col = 1, cols do
local btn = CreateFrame("CheckButton", "EasyBarButton"..action, anchor, "ActionBarButtonTemplate")
btn:SetScript("OnAttributeChanged", ActionButton_Update)
btn:SetMovable(1)
btn:SetClampedToScreen(1)
btn:SetAttribute("type", "action")
btn:SetAttribute("action", action)
height = height or btn:GetHeight()
width = width or btn:GetWidth()
btn:SetPoint("TOPLEFT", (col-1)*width, -1 * (row-1)*height)
action = action+1
local cap = CreateFrame("Frame",btn:GetName().."Cap", btn)
cap:EnableMouse(1)
cap:SetClampedToScreen(1)
cap:SetAllPoints()
cap:Hide()
cap:RegisterForDrag("LeftButton")
cap:SetScript("OnDragStart", function(self) self:GetParent():StartMoving() end)
cap:SetScript("OnDragStop", function(self) self:GetParent():StopMovingOrSizing() ValidateFramePosition(self)end)
local tex = cap:CreateTexture(nil, "OVERLAY")
tex:SetAllPoints()
tex:SetTexture(1,1,0)
tex:SetAlpha(.6)
end
end
anchor:SetPoint("CENTER", -1 * (cols/2) * width, (rows/2) * height)
end
SlashCmdList["ColonelBarCOMMAND"] =
function (msg)
local argT = {};
gsub(msg, "(%S+)", function(w) tinsert(argT, w) end)
if (argT[1]) == "move" then
if tonumber(argT[2]) > 0 then
getglobal("EasyBarButton"..argT[2].."Cap"):Show();
end
else if (argT[1]) == "lock" then
if tonumber(argT[2]) > 0 then
getglobal("EasyBarButton"..argT[2].."Cap"):Hide();
end
end
local argT = {};
gsub(msg, "(%S+)", function(w) tinsert(argT, w) end)
if (argT[1]) == "hide" then
if tonumber(argT[2]) > 0 then
getglobal("EasyBarButton"..argT[2]):Hide();
end
else if (argT[1]) == "display" then
if tonumber(argT[2]) > 0 then
getglobal("EasyBarButton"..argT[2]):Show();
end
end
local argT = {};
gsub(msg, "(%S+)", function(w) tinsert(argT, w) end)
if (argT[1]) == "scale" then
if tonumber(argT[2]) > 0 then
getglobal("EasyBarButton"..argT[2]):SetScale(argT[3]);
end
end
end
end
end
SLASH_ColonelBarCOMMAND1 = "/eb"
SLASH_ColonelBarCOMMAND2 = "/easybar"