lotrointerface.com
Search Downloads

LoTROInterface SVN SequenceBars

[/] [trunk/] [Thurallor/] [SequenceBars/] [DirectoryTab.lua] - Rev 177

Compare with Previous | Blame | View Log

DirectoryTab = class(Thurallor.UI.TabCard);

local function AddInstructions(panel, top, maxLines)
    local label = Turbine.UI.Label();
    label:SetParent(panel);
    label:SetMultiline(true);
    label:SetHeight(maxLines * 16);
    label:SetFont(Turbine.UI.Lotro.Font.TrajanPro14);
    label:SetForeColor(Turbine.UI.Color.PaleGoldenrod);
    label:SetTop(top);
    AddCallback(panel, "SizeChanged", function()
        label:SetWidth(panel:GetWidth());
    end);
    return label, top + label:GetHeight();
end

function DirectoryTab:Constructor(manager, optionsPanel)
    Thurallor.UI.TabCard.Constructor(self);
    self.manager = manager;
    self.optionsPanel = optionsPanel;

    self.inside = Turbine.UI.Control();
    self:SetInteriorControl(self.inside);
    self:SetInteriorAlignment(Turbine.UI.ContentAlignment.TopCenter);

    self.refreshButton = Turbine.UI.Lotro.Button();
    self.refreshButton:SetSize(L:GetNumber("/PluginManager/OptionsTab/DirectoryTab/ShowHideButtonWidth"), 20);
    self:SetInteriorControl(self.refreshButton);
    self:HideDirectory();
end

function DirectoryTab:ShowDirectory(whichTab)
    if (not self.directoryWindow) then
        self.directoryWindow = DirectoryWindow(self.manager, self.optionsPanel);
        AddCallback(self.directoryWindow, "Closing", function(win, args)
            self:HideDirectory();
            args.Cancel = true;
        end);
    end
    self.directoryWindow:Show(whichTab);
    self.refreshButton:SetText(L:GetText("/PluginManager/OptionsTab/DirectoryTab/Hide"));
    self.refreshButton.Click = function()
        self:HideDirectory();
    end
    self.showingDirectory = true;
end

function DirectoryTab:HideDirectory()
    if (self.directoryWindow) then
        self.directoryWindow:Hide();
    end
    self.refreshButton:SetText(L:GetText("/PluginManager/OptionsTab/DirectoryTab/Show"));
    self.refreshButton.Click = function()
        self:ShowDirectory();
    end
    self.showingDirectory = false;
end

function DirectoryTab:UpdateDirectory(updateBarDirectory, updateEventDirectory)
    if (self.showingDirectory) then
        self.directoryWindow:Redraw(updateBarDirectory, updateEventDirectory);
    end
end

function DirectoryTab:SetWidth(width)
    Thurallor.UI.TabCard.SetWidth(self, width);
    self.inside:SetWidth(width - 20);
    DoCallbacks(self.inside, "SizeChanged");
end

function DirectoryTab:Localize()
    self:SetTabText(L:GetText("/PluginManager/OptionsTab/Directory"));
    local prevContext = L:SetContext("/PluginManager/OptionsTab/DirectoryTab");
    self.refreshButton:SetSize(L:GetNumber("ShowHideButtonWidth"), 20);    
    if (self.showingDirectory) then
        self.refreshButton:SetText(L:GetText("Hide"));
    else
        self.refreshButton:SetText(L:GetText("Show"));
    end
    if (self.directoryWindow) then
        self.directoryWindow:Localize();
    end
    L:SetContext(prevContext);
end

Compare with Previous | Blame


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


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