Go to most recent revision |
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, self);
AddCallback(self.tab2, "TreeHeightChanged", function(tab, height)
maxHeight = math.max(height, self.tab1.inside:GetHeight());
self:SetHeight(maxHeight + 40);
tab:SetHeight(maxHeight + 40);
end);
self.tab2:Refresh();
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:ShowRefreshButton()
local prevContext = L:SetContext("/PluginManager/OptionsTab/");
if (not self.refreshButton) then
self.refreshButton = Turbine.UI.Lotro.Button();
self.refreshButton:SetSize(L:GetNumber("ShowHideButtonWidth"), 20);
self.refreshButton.Click = function()
self:RefreshDirectory();
end
end
self.refreshButton:SetText(L:GetText("Show"));
self.tab2:SetInteriorControl(self.refreshButton);
L:SetContext(prevContext);
self.showingRefreshButton = true;
end
function OptionsPanel:ShowGlobalSettings()
Turbine.PluginManager.ShowOptions(Plugins.SequenceBars);
self.tabs:BringToFront(self.tab1);
self.tab1:Refresh();
end
function OptionsPanel:ShowDirectory()
Turbine.PluginManager.ShowOptions(Plugins.SequenceBars);
self.tabs:BringToFront(self.tab2);
self:RefreshDirectory();
end
function OptionsPanel:Localize()
self.tab1:Localize();
self.tab2:Localize();
self.tabs:RedistributeTabs();
end
function OptionsPanel:RefreshDirectory()
if (not self:IsDisplayed() or (not self.tab2:IsInFront())) then
if (not self.showingRefreshButton) then
return self:ShowRefreshButton();
end
end
self.showingRefreshButton = false;
--self.tab2:Localize();
self.tab2:Refresh();
self.width = 0;
self:SizeChanged();
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
Go to most recent revision |
Compare with Previous |
Blame
All times are GMT -5. The time now is 04:12 AM.