-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWidget.lua
35 lines (32 loc) · 957 Bytes
/
MainWidget.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
TMBMainWidgetMixin = {}
function TMBMainWidgetMixin:SetTab(index)
PanelTemplates_SetTab(self, index)
for i = 1,#self.tabFrames do
if i == index then
self.tabFrames[i]:Show()
else
self.tabFrames[i]:Hide()
end
end
end
function TMBMainWidgetMixin:Initialize()
self.elapsed = 0;
self.tabFrames = {};
local children = { self:GetChildren() };
local searchstr = self:GetName() .. "_tabFrame"
for _, child in ipairs(children) do
local childname = child:GetName()
if childname then
if string.find(childname, searchstr) and (#childname == #searchstr+1) then
table.insert(self.tabFrames, child)
end
end
end
PanelTemplates_SetNumTabs(self, #self.tabFrames)
self:SetTab(1)
end
function TMBTabButtonCallback(self)
local MainWidget = self:GetParent()
local id = self:GetID()
MainWidget:SetTab(id)
end