-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrChat_Tabs.lua
More file actions
93 lines (79 loc) · 1.97 KB
/
rChat_Tabs.lua
File metadata and controls
93 lines (79 loc) · 1.97 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
rChat = rChat or {}
local SF = LibSFUtils
local L = GetString
--[[ ---------------------------------------------
A lookup table of tab names indexed by tab index
--]]
rChat_TabNames = ZO_Object:Subclass()
local TabNames = rChat_TabNames
function TabNames:New()
local o = {}
setmetatable(o, self)
self.__index = self
o.nameList = {}
return o
end
function TabNames:Refresh()
local nameList = {}
local totalTabs = CHAT_SYSTEM.tabPool.m_Active
if totalTabs ~= nil and #totalTabs >= 1 then
for idx, tmpTab in pairs(totalTabs) do
local tabLabel = tmpTab:GetNamedChild("Text")
local tmpTabName = tabLabel:GetText()
if tmpTabName ~= nil and tmpTabName ~= "" then
nameList[idx] = tmpTabName
end
end
end
self.nameList = nameList
return self.nameList
end
function TabNames:GetNames()
if not self.nameList then
self:Refresh()
end
local totalTabs = CHAT_SYSTEM.tabPool.m_Active
if #totalTabs ~= #self.nameList then
self:Refresh()
end
return self.nameList
end
function TabNames:GetIndex(tabName)
local tabIdx = 1
for i,v in ipairs(self.nameList) do
if v == tabName then
tabIdx = i
break
end
end
return tabIdx
end
--[[ ---------------------------------------------
rChat functions which manipulate tabs
--]]
local function isValidTabIndex(tabndx)
if type(tabndx)~="number" then
return false
end
local container=CHAT_SYSTEM.primaryContainer
if not container then
return false
end
if tabndx<1 or tabndx>#container.windows then
return false
end
if container.windows[tabndx].tab==nil then
return false
end
return true
end
function rChat.ChangeTab(tabToSet)
if isValidTabIndex(tabToSet) == false then
return
end
local container=CHAT_SYSTEM.primaryContainer
container.tabGroup:SetClickedButton(container.windows[tabToSet].tab)
if CHAT_SYSTEM:IsMinimized() then
CHAT_SYSTEM:Maximize()
end
end