annotate ui/ItemTooltipFrame.lua @ 56:75431c084aa0

Added tag v20 for changeset 826f8e68e045
author yellowfive
date Tue, 24 Feb 2015 21:50:13 -0800
parents ec731d2fe6ba
children
rev   line source
adam@0 1 local _, AskMrRobot = ...
adam@0 2
adam@0 3 -- initialize the ItemLink class
adam@0 4 AskMrRobot.ItemTooltipFrame = AskMrRobot.inheritsFrom(AskMrRobot.Frame)
adam@0 5
adam@0 6 -- item link contructor
adam@0 7 function AskMrRobot.ItemTooltipFrame:new(name, parent)
adam@0 8 -- create a new frame
adam@0 9 local o = AskMrRobot.Frame:new(name, parent)
adam@0 10
adam@0 11 -- use the ItemTooltipFrame class
adam@0 12 setmetatable(o, { __index = AskMrRobot.ItemTooltipFrame })
adam@0 13
adam@0 14 o.tooltipShown = false
adam@0 15
adam@0 16 -- initialize the enter/leave scripts for showing the tooltips
adam@0 17 o:SetScript("OnEnter", AskMrRobot.ItemTooltipFrame.OnEnterTooltipFrame)
adam@0 18 o:SetScript("OnLeave", AskMrRobot.ItemTooltipFrame.OnLeaveTooltipFrame)
adam@0 19
adam@0 20 -- return the instance of the ItemTooltipFrame
adam@0 21 return o
adam@0 22 end
adam@0 23
adam@0 24 function AskMrRobot.ItemTooltipFrame:OnEnterTooltipFrame()
adam@0 25 if self.itemLink then
adam@0 26 GameTooltip:SetOwner(self, "ANCHOR_CURSOR")
adam@0 27
adam@0 28 GameTooltip:SetHyperlink(self.itemLink)
adam@0 29
adam@0 30 GameTooltip:Show()
adam@0 31 self.tooltipShown = true
adam@0 32 end
adam@0 33 end
adam@0 34
adam@0 35 function AskMrRobot.ItemTooltipFrame:OnLeaveTooltipFrame()
adam@0 36 GameTooltip:Hide()
adam@0 37 self.tooltipShown = false
adam@0 38 end
adam@0 39
adam@0 40 -- set the tooltip from the specified item link
adam@0 41 function AskMrRobot.ItemTooltipFrame:SetItemLink(link)
adam@0 42 if self.tooltipShown then
adam@0 43 GameTooltip:Hide()
adam@0 44 end
adam@0 45 self.itemLink = link
adam@0 46 end