lotrointerface.com
Search Downloads

LoTROInterface SVN SequenceBars

[/] [trunk/] [Thurallor/] [SequenceBars/] [OptionsPanel.lua] - Rev 179

Compare with Previous | Blame | View Log

OptionsPanel = class(Turbine.UI.Control);

function OptionsPanel:Constructor(manager)
    Turbine.UI.Control.Constructor(self);

    self.manager = manager;
    self.skipSizeChanged = 0;
    self.skipUpdate = 0;
    
    self.tabs = Thurallor.UI.TabCardStack();
    self.tabs:SetParent(self);

    self.tab1 = GlobalOptionsTab(manager, self);
    local width, height = self.tab1.inside:GetSize();
    self.tab1:Refresh();

    self.tab2 = DirectoryTab(manager);
    AddCallback(self.tab2, "HeightChanged", function(tab, height)
        maxHeight = math.max(height, self.tab1.inside:GetHeight());
        self:SetHeight(maxHeight + 40);
        tab:SetHeight(maxHeight + 40);
    end);

    self.tabs:AddTabCard(self.tab1);
    self.tabs:AddTabCard(self.tab2);
    self:Localize();
    self:SetSize(width + 20, height + 40);

    plugin.GetOptionsPanel = function()
        return self;
    end
end

function OptionsPanel:ShowGlobalSettings()
    Turbine.PluginManager.ShowOptions(Plugins.SequenceBars);
    self.tabs:BringToFront(self.tab1);
    self.tab1:Refresh();
end

function OptionsPanel:ShowDirectory(whichTab)
    self.tabs:BringToFront(self.tab2);
    self.tab2:ShowDirectory(whichTab);
end

function OptionsPanel:UpdateDirectory(updateBarDirectory, updateEventDirectory)
    self.tab2:UpdateDirectory(updateBarDirectory, updateEventDirectory);
end

function OptionsPanel:Localize()
    self.tab1:Localize();
    self.tab2:Localize();
    self.tabs:RedistributeTabs();
end

function OptionsPanel:SetHeight(height)
    Turbine.UI.Control.SetHeight(self, height);
    self.tabs:SetHeight(height);
end

function OptionsPanel:SetWidth(width)
    Turbine.UI.Control.SetWidth(self, width);
    self.tabs:SetWidth(width);
    self.tabs:RedistributeTabs();
end

function OptionsPanel:SetSize(width, height)
    self:SetHeight(height);
    self:SetWidth(width);
end

function OptionsPanel:SizeChanged()
    if (self.skipSizeChanged > 0) then
        self.skipSizeChanged = self.skipSizeChanged - 1;
        return;
    end
    local width = self:GetWidth();
    if (self.width ~= width) then
        self.width = width;
        self.tabs:SetWidth(width);
        self.tab2:SetWidth(width);
    end
end

Compare with Previous | Blame


All times are GMT -5. The time now is 04:56 PM.


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