lotrointerface.com
Search Downloads

LoTROInterface SVN SequenceBars

[/] [trunk/] [Thurallor/] [Common/] [UI/] [Tabs/] [TabCardStack.lua] - Rev 92

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

TabCardStack = class(Turbine.UI.Control);

function TabCardStack:Constructor()
    Turbine.UI.Control.Constructor(self);

    self.tabCards = {};
end

function TabCardStack:AddTabCard(tabCard)
    table.insert(self.tabCards, tabCard);
    tabCard:SetParent(self);
    self:BringToFront(tabCard);

    -- Default behavior when the tab is clicked is to bring the card to the front.
    tabCard.Click = function(sender, args)
        if (args.Button == Turbine.UI.MouseButton.Left) then
            self:BringToFront(sender);
        end
    end
end

function TabCardStack:BringToFront(tabCard)
    for t = 1, #self.tabCards do
        local otherTabCard = self.tabCards[t];
        if (otherTabCard == tabCard) then
            tabCard:BringToFront();
            tabCard:SetSize(self:GetSize());
            self.frontTabCard = tabCard;
        else
            otherTabCard:SendToBack();
        end
    end
end

function TabCardStack:SetSize(width, height)
    Turbine.UI.Control.SetSize(self, width, height);
    if (self.frontTabCard) then
        self.frontTabCard:SetSize(width, height);
    end
end

function TabCardStack:SetWidth(width)
    self:SetSize(width, self:GetHeight());
end

function TabCardStack:SetHeight(height)
    self:SetSize(self:GetWidth(), height);
end

Go to most recent revision | Compare with Previous | Blame


All times are GMT -5. The time now is 02:12 AM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui