1 |
2 |
Thurallor-7095 |
OptionsPanel = class(Turbine.UI.Control); |
2 |
|
Thurallor-7095 |
|
3 |
|
Thurallor-7095 |
function OptionsPanel:Constructor(manager) |
4 |
|
Thurallor-7095 |
Turbine.UI.Control.Constructor(self); |
5 |
|
Thurallor-7095 |
|
6 |
|
Thurallor-7095 |
self.manager = manager; |
7 |
12 |
Thurallor-7095 |
self.skipSizeChanged = 0; |
8 |
|
Thurallor-7095 |
self.skipUpdate = 0; |
9 |
2 |
Thurallor-7095 |
|
10 |
12 |
Thurallor-7095 |
self.tabs = Thurallor.UI.TabCardStack(); |
11 |
|
Thurallor-7095 |
self.tabs:SetParent(self); |
12 |
|
Thurallor-7095 |
|
13 |
170 |
Thurallor-7095 |
self.tab1 = GlobalOptionsTab(manager, self); |
14 |
|
Thurallor-7095 |
local width, height = self.tab1.inside:GetSize(); |
15 |
|
Thurallor-7095 |
self.tab1:Refresh(); |
16 |
12 |
Thurallor-7095 |
|
17 |
175 |
Thurallor-7095 |
self.tab2 = DirectoryTab(manager); |
18 |
|
Thurallor-7095 |
AddCallback(self.tab2, "HeightChanged", function(tab, height) |
19 |
171 |
Thurallor-7095 |
maxHeight = math.max(height, self.tab1.inside:GetHeight()); |
20 |
|
Thurallor-7095 |
self:SetHeight(maxHeight + 40); |
21 |
|
Thurallor-7095 |
tab:SetHeight(maxHeight + 40); |
22 |
170 |
Thurallor-7095 |
end); |
23 |
12 |
Thurallor-7095 |
|
24 |
|
Thurallor-7095 |
self.tabs:AddTabCard(self.tab1); |
25 |
|
Thurallor-7095 |
self.tabs:AddTabCard(self.tab2); |
26 |
|
Thurallor-7095 |
self:Localize(); |
27 |
170 |
Thurallor-7095 |
self:SetSize(width + 20, height + 40); |
28 |
12 |
Thurallor-7095 |
|
29 |
2 |
Thurallor-7095 |
plugin.GetOptionsPanel = function() |
30 |
|
Thurallor-7095 |
return self; |
31 |
|
Thurallor-7095 |
end |
32 |
|
Thurallor-7095 |
end |
33 |
|
Thurallor-7095 |
|
34 |
12 |
Thurallor-7095 |
function OptionsPanel:ShowGlobalSettings() |
35 |
5 |
Thurallor-7095 |
Turbine.PluginManager.ShowOptions(Plugins.SequenceBars); |
36 |
12 |
Thurallor-7095 |
self.tabs:BringToFront(self.tab1); |
37 |
170 |
Thurallor-7095 |
self.tab1:Refresh(); |
38 |
5 |
Thurallor-7095 |
end |
39 |
|
Thurallor-7095 |
|
40 |
177 |
Thurallor-7095 |
function OptionsPanel:ShowDirectory(whichTab) |
41 |
12 |
Thurallor-7095 |
self.tabs:BringToFront(self.tab2); |
42 |
177 |
Thurallor-7095 |
self.tab2:ShowDirectory(whichTab); |
43 |
12 |
Thurallor-7095 |
end |
44 |
|
Thurallor-7095 |
|
45 |
177 |
Thurallor-7095 |
function OptionsPanel:UpdateDirectory(updateBarDirectory, updateEventDirectory) |
46 |
|
Thurallor-7095 |
self.tab2:UpdateDirectory(updateBarDirectory, updateEventDirectory); |
47 |
175 |
Thurallor-7095 |
end |
48 |
|
Thurallor-7095 |
|
49 |
12 |
Thurallor-7095 |
function OptionsPanel:Localize() |
50 |
170 |
Thurallor-7095 |
self.tab1:Localize(); |
51 |
|
Thurallor-7095 |
self.tab2:Localize(); |
52 |
|
Thurallor-7095 |
self.tabs:RedistributeTabs(); |
53 |
12 |
Thurallor-7095 |
end |
54 |
2 |
Thurallor-7095 |
|
55 |
12 |
Thurallor-7095 |
function OptionsPanel:SetHeight(height) |
56 |
|
Thurallor-7095 |
Turbine.UI.Control.SetHeight(self, height); |
57 |
|
Thurallor-7095 |
self.tabs:SetHeight(height); |
58 |
|
Thurallor-7095 |
end |
59 |
|
Thurallor-7095 |
|
60 |
170 |
Thurallor-7095 |
function OptionsPanel:SetWidth(width) |
61 |
|
Thurallor-7095 |
Turbine.UI.Control.SetWidth(self, width); |
62 |
|
Thurallor-7095 |
self.tabs:SetWidth(width); |
63 |
|
Thurallor-7095 |
self.tabs:RedistributeTabs(); |
64 |
|
Thurallor-7095 |
end |
65 |
|
Thurallor-7095 |
|
66 |
|
Thurallor-7095 |
function OptionsPanel:SetSize(width, height) |
67 |
|
Thurallor-7095 |
self:SetHeight(height); |
68 |
|
Thurallor-7095 |
self:SetWidth(width); |
69 |
|
Thurallor-7095 |
end |
70 |
|
Thurallor-7095 |
|
71 |
2 |
Thurallor-7095 |
function OptionsPanel:SizeChanged() |
72 |
12 |
Thurallor-7095 |
if (self.skipSizeChanged > 0) then |
73 |
|
Thurallor-7095 |
self.skipSizeChanged = self.skipSizeChanged - 1; |
74 |
|
Thurallor-7095 |
return; |
75 |
|
Thurallor-7095 |
end |
76 |
2 |
Thurallor-7095 |
local width = self:GetWidth(); |
77 |
12 |
Thurallor-7095 |
if (self.width ~= width) then |
78 |
|
Thurallor-7095 |
self.width = width; |
79 |
170 |
Thurallor-7095 |
self.tabs:SetWidth(width); |
80 |
|
Thurallor-7095 |
self.tab2:SetWidth(width); |
81 |
2 |
Thurallor-7095 |
end |
82 |
|
Thurallor-7095 |
end |
83 |
|
Thurallor-7095 |
|