-
Notifications
You must be signed in to change notification settings - Fork 11
/
Tooltip.lua
57 lines (43 loc) · 1.39 KB
/
Tooltip.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
-----------------------------------------
-- LOCALIZED GLOBAL VARIABLES
-----------------------------------------
local ZGV = _G.ZGV
local tinsert,tremove,sort,min,max,floor,type,pairs,ipairs = table.insert,table.remove,table.sort,math.min,math.max,math.floor,type,pairs,ipairs
local print = ZGV.print
local CHAIN = ZGV.Utils.ChainCall
local ui = ZGV.UI
local L = ZGV.L
local GuiRoot = _G.GuiRoot
local Tooltip = {}
local name = "Zygor_Tooltip"
-----------------------------------------
-- SAVED REFERENCES
-----------------------------------------
ZGV.Tooltip = Tooltip
-----------------------------------------
-- FUNCTIONS
-----------------------------------------
function Tooltip:Create()
local tooltip = ui:Create("Tooltip",GuiRoot,name)
Tooltip.Frame = tooltip
-- Set metatable for ZGV.Tooltip to actual Tooltip.
setmetatable(self,{__index = function(me,func)
assert(me.Frame[func],func.." missing in Tooltip")
return function(me,...)
me.Frame[func](me.Frame,...)
end
end})
end
-----------------------------------------
-- DEBUG
-----------------------------------------
function Tooltip:Debug(...)
local str = ...
ZGV:Debug("&tooltip "..str, select(2,...) )
end
-----------------------------------------
-- STARTUP
-----------------------------------------
tinsert(ZGV.startups,function(self)
Tooltip:Create()
end)