Quantcast
WoWInterface: SVN - zz_Actionbuttons - Rev 8 - /trunk/zz_Actionbuttons/core.lua

WoWInterface SVN zz_Actionbuttons

[/] [trunk/] [zz_Actionbuttons/] [core.lua] - Rev 8

Go to most recent revision | Compare with Previous | Blame | View Log

local name, addon = ...
local defaults = {}
local options, db
local _,class = UnitClass('player')
local _G = _G
local xoffset, yoffset = 8,0

local function createBar(bid,id)
        local f = CreateFrame("Frame", "zzABar"..bid, UIParent, "SecureHandlerStateTemplate",id)
        f:SetWidth(1)
        f:SetHeight(1)
        f:SetPoint("CENTER")
        f:SetAttribute('_onstate-page', [[
                self:SetAttribute('actionpage', newstate)
                control:ChildUpdate('actionpage', newstate)
        ]])
        if(class == "WARRIOR") then
                RegisterStateDriver(f, "page", "[bonusbar:1] 7;[bonusbar:2] 8;[bonusbar:3] 9;1")
        elseif(class == "DRUID") then
                RegisterStateDriver(f, "page", "[stance:1] 9;[stance:3,stealth] 8;[stance:3] 7;[stance:5] 10;1") -- 1 bear/ 3 cat/ 5 moonkin
        elseif(class == "ROGUE") then
                RegisterStateDriver(f, "page", "[stance:1] 7;[stance:3] 8; 1") -- 1 stealth/ 3 shadow dance
        end
        
        local lastbutton = f
        for i = 1, 12 do
                local b = CreateFrame("CheckButton", "$PARENTActionButton"..i, f, "ActionButtonTemplate ActionBarButtonCodeTemplate",i)
--              b:SetWidth(32)
--              b:SetHeight(32)
                b:SetPoint("TOPLEFT", lastbutton, "TOPRIGHT", xoffset, yoffset)
                lastbutton = b
                b:SetAttribute('action--base',i)
                b:SetAttribute('showgrid', 1)
                b:SetAttribute('_childupdate-actionpage', [[
                        self:SetAttribute('action', self:GetAttribute('action--base'))
                ]])
                b:SetAttribute('action', i)
        end
end

local function init(self, event, ...)
        _,class = UnitClass('player')
end

addon['preloads'][#addon['preloads'] + 1] = function(self,event,...)
        createBar(1,1)
end

addon['startup'](addon, name, name, init, true, defaults)

Go to most recent revision | Compare with Previous | Blame