All pastes #70315 Raw Edit

Stuff

public lua v1 · immutable
#70315 ·published 2006-06-24 01:34 UTC
rendered paste body
idPopbar = {}-- general stuff ------------------function idPopbar:Enable()    self.PoppedBar = false    local oldActionButton_HideGrid    oldActionButton_HideGrid = ActionButton_HideGrid    ActionButton_HideGrid = function(Button)        Button = Button or this        if string.find(Button:GetName(), 'idPopbarButton') then            idPopbar:alterButtonLooks(Button)        end        oldActionButton_HideGrid(Button)    end    self.MainBar = self:initMainbar()    self.Popbar = self:initPopbar()    MainMenuBar:Hide()    self.MainBar:Show()end-- button bindings ----------------function idPopbar:ButtonDown(nButton)    if self.PoppedBar then        Button = getglobal('idPopbarButton'..nButton)        if Button:GetButtonState() == 'NORMAL' then            Button:SetButtonState('PUSHED')        end    endendfunction idPopbar:ButtonUp(nButton)    if self.PoppedBar then        Button = getglobal('idPopbarButton'..nButton)        if Button:GetButtonState() == 'PUSHED' then            Button:SetButtonState('NORMAL')            UseAction(ActionButton_GetPagedID(Button), 0, onSelf)            if IsCurrentAction(ActionButton_GetPagedID(Button)) then                Button:SetChecked(1)            else                Button:SetChecked(0)            end        end        self:unpopBar(nButton)    else        self:popBar(nButton)    endendfunction idPopbar:popBar(nBar)    local j = nBar * 12 - 11    for i=1,12 do        getglobal('idPopbarButton'..i):SetID(j)        j = j + 1    end    self.Popbar:SetPoint('RIGHT', self.Mainbar['Drawer'..nBar], 'LEFT', 1, 0)    self.Popbar:Show()    self.PoppedBar = nBarendfunction idPopbar:unpopBar(nBar)    self.Popbar:Hide()    self.PoppedBar = falseend-- bar looks ----------------------function idPopbar:alterButtonLooks(Button)    bg = getglobal(Button:GetName()..'NormalTexture2') or getglobal(Button:GetName()..'NormalTexture')    ic = getglobal(Button:GetName()..'Icon')    bg:SetAlpha(0)    ic:SetTexCoord(0.07, 0.93, 0.07, 0.93)endfunction idPopbar:giveStandardBackground(Frame)    Frame:SetBackdrop({        bgFile = 'Interface\\Tooltips\\UI-Tooltip-Background',        edgeFile = '',        tile = true,        tileSize = 16,        edgeSize = 0,        insets = {            left = 0,            right = 0,            top = 0,            bottom = 0        }    })    Frame:SetBackdropColor(0,0,0,0.4)endfunction idPopbar:addBar(name, first, last)    local Button    local totalWidth    local totalHeight    Button = getglobal(name..first)    Button:ClearAllPoints()    Button:SetPoint('CENTER', UIParent, 'CENTER')    for i=first+1, last do        Button = getglobal(name..i)        Button:ClearAllPoints()        Button:SetPoint('LEFT', getglobal(name..i-1), 'RIGHT')    end    totalWidth = ((last-first)+1)*getglobal(name..first):GetWidth()    totalHeight = getglobal(name..first):GetHeight()    return totalWidth, totalHeightendfunction idPopbar:addDrawer()    local Drawer = CreateFrame('Button', nil, UIParent)    Drawer:SetWidth(20)    Drawer:SetHeight(40)    self:giveStandardBackground(Drawer)    return Drawerendfunction idPopbar:initMainbar()    local Mainbar = CreateFrame('frame', nil, UIParent)    Mainbar.Drawer1 = self:addDrawer()    Mainbar.Drawer2 = self:addDrawer()    Mainbar.Drawer3 = self:addDrawer()    Mainbar.Drawer4 = self:addDrawer()    Mainbar.Drawer5 = self:addDrawer()    Mainbar:SetWidth(Mainbar.Drawer1:GetWidth())    Mainbar:SetHeight(Mainbar.Drawer1:GetHeight()*5+4) -- plus 1px padding    Mainbar.Drawer1:ClearAllPoints()    Mainbar.Drawer1:SetPoint('BOTTOMLEFT', Mainbar, 'BOTTOMLEFT')    for i=2,5 do        Mainbar['Drawer'..i]:ClearAllPoints()        Mainbar['Drawer'..i]:SetPoint('BOTTOM', Mainbar['Drawer'..i-1], 'TOP', 0, 1)    end    Mainbar:ClearAllPoints()    Mainbar:SetPoint('BOTTOMRIGHT', UIParent, 'BOTTOMRIGHT', -2, 2)    Mainbar:Show()    return Mainbarendfunction idPopbar:initPopbar()    local Popbar = CreateFrame('frame', nil, UIParent)    w,h = self:addBar('idPopbarButton',  1, 12)    Popbar:SetWidth(w)    Popbar:SetHeight(h)    for i=1,12 do        getglobal('idPopbarButton'..i):SetParent(Popbar)        self:alterButtonLooks(getglobal('idPopbarButton'..i))    end    idPopbarButton1:ClearAllPoints()    idPopbarButton1:SetPoint('BOTTOMLEFT', Popbar, 'BOTTOMLEFT')    self:giveStandardBackground(Popbar)    Popbar:ClearAllPoints()    Popbar:SetPoint('RIGHT', self.Mainbar.Drawer1, 'LEFT', 1, 0)    return PopbarendidPopbar:Enable()