-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtooltip.lua
More file actions
45 lines (37 loc) · 1.63 KB
/
tooltip.lua
File metadata and controls
45 lines (37 loc) · 1.63 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
PlayerbotsPanel.tooltips = {}
local _self = PlayerbotsPanel.tooltips
-- tooltip used for items
_self.tooltip = nil
_self.tooltipCompare1 = nil
_self.tooltipCompare2 = nil
-- tooltip used to display help/descriptions of what buttons do
_self.tooltipInfo = nil
-- for drawing stats
_self.tooltipStat = nil
function _self:Init(parentFrame)
local scale = UIParent:GetScale()
_self.tooltip = CreateFrame("GameTooltip", "PlayerbotsPanelTooltip", UIParent, "GameTooltipTemplate")
_self.tooltip:SetScale(scale)
_self.tooltipCompare1 = CreateFrame("GameTooltip", "PlayerbotsPanelTooltipCompare1", UIParent, "GameTooltipTemplate")
_self.tooltipCompare1:SetScale(scale)
_self.tooltipCompare2 = CreateFrame("GameTooltip", "PlayerbotsPanelTooltipCompare2", UIParent, "GameTooltipTemplate")
_self.tooltipCompare2:SetScale(scale)
_self.tooltipInfo = CreateFrame("GameTooltip", "PlayerbotsPanelTooltipInfo", UIParent, "GameTooltipTemplate")
_self.tooltipInfo:SetScale(scale)
_self.tooltipStat = CreateFrame("GameTooltip", "PlayerbotsPanelTooltipStat", UIParent, "GameTooltipTemplate")
_self.tooltipStat:SetScale(scale)
end
-- Assumes whatever is passed as target is Frame/Button etc and will override OnEnter/OnLeave
function _self.AddInfoTooltip(target, strTooltip)
if target == nil or strTooltip == nil then
error("AddInfoTooltip - nil values passed")
return
end
target:SetScript("OnEnter", function(self, motion)
_self.tooltipInfo:SetOwner(target, "ANCHOR_BOTTOMRIGHT")
_self.tooltipInfo:SetText(strTooltip)
end)
target:SetScript("OnLeave", function(self, motion)
_self.tooltipInfo:Hide()
end)
end