1 |
175 |
Thurallor-7095 |
DirectoryTab = class(Thurallor.UI.TabCard); |
2 |
170 |
Thurallor-7095 |
|
3 |
175 |
Thurallor-7095 |
local function AddInstructions(panel, top, maxLines) |
4 |
|
Thurallor-7095 |
local label = Turbine.UI.Label(); |
5 |
|
Thurallor-7095 |
label:SetParent(panel); |
6 |
|
Thurallor-7095 |
label:SetMultiline(true); |
7 |
|
Thurallor-7095 |
label:SetHeight(maxLines * 16); |
8 |
|
Thurallor-7095 |
label:SetFont(Turbine.UI.Lotro.Font.TrajanPro14); |
9 |
|
Thurallor-7095 |
label:SetForeColor(Turbine.UI.Color.PaleGoldenrod); |
10 |
|
Thurallor-7095 |
label:SetTop(top); |
11 |
|
Thurallor-7095 |
AddCallback(panel, "SizeChanged", function() |
12 |
|
Thurallor-7095 |
label:SetWidth(panel:GetWidth()); |
13 |
|
Thurallor-7095 |
end); |
14 |
|
Thurallor-7095 |
return label, top + label:GetHeight(); |
15 |
170 |
Thurallor-7095 |
end |
16 |
|
Thurallor-7095 |
|
17 |
|
Thurallor-7095 |
function DirectoryTab:Constructor(manager, optionsPanel) |
18 |
|
Thurallor-7095 |
Thurallor.UI.TabCard.Constructor(self); |
19 |
|
Thurallor-7095 |
self.manager = manager; |
20 |
|
Thurallor-7095 |
self.optionsPanel = optionsPanel; |
21 |
|
Thurallor-7095 |
|
22 |
|
Thurallor-7095 |
self.inside = Turbine.UI.Control(); |
23 |
|
Thurallor-7095 |
self:SetInteriorControl(self.inside); |
24 |
|
Thurallor-7095 |
self:SetInteriorAlignment(Turbine.UI.ContentAlignment.TopCenter); |
25 |
|
Thurallor-7095 |
|
26 |
175 |
Thurallor-7095 |
self.refreshButton = Turbine.UI.Lotro.Button(); |
27 |
|
Thurallor-7095 |
self.refreshButton:SetSize(L:GetNumber("/PluginManager/OptionsTab/DirectoryTab/ShowHideButtonWidth"), 20); |
28 |
|
Thurallor-7095 |
self:SetInteriorControl(self.refreshButton); |
29 |
|
Thurallor-7095 |
self:HideDirectory(); |
30 |
170 |
Thurallor-7095 |
end |
31 |
|
Thurallor-7095 |
|
32 |
177 |
Thurallor-7095 |
function DirectoryTab:ShowDirectory(whichTab) |
33 |
175 |
Thurallor-7095 |
if (not self.directoryWindow) then |
34 |
|
Thurallor-7095 |
self.directoryWindow = DirectoryWindow(self.manager, self.optionsPanel); |
35 |
177 |
Thurallor-7095 |
AddCallback(self.directoryWindow, "Closing", function(win, args) |
36 |
|
Thurallor-7095 |
self:HideDirectory(); |
37 |
|
Thurallor-7095 |
args.Cancel = true; |
38 |
|
Thurallor-7095 |
end); |
39 |
175 |
Thurallor-7095 |
end |
40 |
177 |
Thurallor-7095 |
self.directoryWindow:Show(whichTab); |
41 |
175 |
Thurallor-7095 |
self.refreshButton:SetText(L:GetText("/PluginManager/OptionsTab/DirectoryTab/Hide")); |
42 |
|
Thurallor-7095 |
self.refreshButton.Click = function() |
43 |
|
Thurallor-7095 |
self:HideDirectory(); |
44 |
|
Thurallor-7095 |
end |
45 |
|
Thurallor-7095 |
self.showingDirectory = true; |
46 |
|
Thurallor-7095 |
end |
47 |
170 |
Thurallor-7095 |
|
48 |
175 |
Thurallor-7095 |
function DirectoryTab:HideDirectory() |
49 |
|
Thurallor-7095 |
if (self.directoryWindow) then |
50 |
|
Thurallor-7095 |
self.directoryWindow:Hide(); |
51 |
170 |
Thurallor-7095 |
end |
52 |
175 |
Thurallor-7095 |
self.refreshButton:SetText(L:GetText("/PluginManager/OptionsTab/DirectoryTab/Show")); |
53 |
|
Thurallor-7095 |
self.refreshButton.Click = function() |
54 |
|
Thurallor-7095 |
self:ShowDirectory(); |
55 |
170 |
Thurallor-7095 |
end |
56 |
175 |
Thurallor-7095 |
self.showingDirectory = false; |
57 |
170 |
Thurallor-7095 |
end |
58 |
|
Thurallor-7095 |
|
59 |
177 |
Thurallor-7095 |
function DirectoryTab:UpdateDirectory(updateBarDirectory, updateEventDirectory) |
60 |
175 |
Thurallor-7095 |
if (self.showingDirectory) then |
61 |
177 |
Thurallor-7095 |
self.directoryWindow:Redraw(updateBarDirectory, updateEventDirectory); |
62 |
175 |
Thurallor-7095 |
end |
63 |
170 |
Thurallor-7095 |
end |
64 |
|
Thurallor-7095 |
|
65 |
|
Thurallor-7095 |
function DirectoryTab:SetWidth(width) |
66 |
|
Thurallor-7095 |
Thurallor.UI.TabCard.SetWidth(self, width); |
67 |
|
Thurallor-7095 |
self.inside:SetWidth(width - 20); |
68 |
175 |
Thurallor-7095 |
DoCallbacks(self.inside, "SizeChanged"); |
69 |
170 |
Thurallor-7095 |
end |
70 |
|
Thurallor-7095 |
|
71 |
|
Thurallor-7095 |
function DirectoryTab:Localize() |
72 |
|
Thurallor-7095 |
self:SetTabText(L:GetText("/PluginManager/OptionsTab/Directory")); |
73 |
175 |
Thurallor-7095 |
local prevContext = L:SetContext("/PluginManager/OptionsTab/DirectoryTab"); |
74 |
|
Thurallor-7095 |
self.refreshButton:SetSize(L:GetNumber("ShowHideButtonWidth"), 20); |
75 |
|
Thurallor-7095 |
if (self.showingDirectory) then |
76 |
|
Thurallor-7095 |
self.refreshButton:SetText(L:GetText("Hide")); |
77 |
|
Thurallor-7095 |
else |
78 |
|
Thurallor-7095 |
self.refreshButton:SetText(L:GetText("Show")); |
79 |
170 |
Thurallor-7095 |
end |
80 |
175 |
Thurallor-7095 |
if (self.directoryWindow) then |
81 |
|
Thurallor-7095 |
self.directoryWindow:Localize(); |
82 |
170 |
Thurallor-7095 |
end |
83 |
175 |
Thurallor-7095 |
L:SetContext(prevContext); |
84 |
170 |
Thurallor-7095 |
end |
85 |
175 |
Thurallor-7095 |
|