view ui/ItemTooltipFrame.lua @ 51:6f1bb8fcf64d v18

AskMrRobot.toc - Added line for new SettingsTab file AskMrRobotUi.lua - Added code for new Settings menu amr-constants.lua - Added instance IDs for all WoD 6.0 5-mans and Raids. - Removed legacy SoO IDs. config.lua - Removed "Interface/Addons" options area, migrated all settings to main addon window. localization/localization.en.lua - Added new strings for new Settings tab and new Raid auto-logging ui/CombatLogTab.lua - Removed legacy SoO code - Added auto-logging settings for Highmaul and Blackrock Foundry. ui/SettingsTab.lua - new main window tab for Minimap and Auction House settings options
author TuhMuffinMan <TuhMuffinMan>
date Fri, 28 Nov 2014 13:09:52 -0600
parents ec731d2fe6ba
children
line wrap: on
line source
local _, AskMrRobot = ...

-- initialize the ItemLink class
AskMrRobot.ItemTooltipFrame = AskMrRobot.inheritsFrom(AskMrRobot.Frame)

-- item link contructor
function AskMrRobot.ItemTooltipFrame:new(name, parent)
	-- create a new frame
	local o = AskMrRobot.Frame:new(name, parent)

	-- use the ItemTooltipFrame class
	setmetatable(o, { __index = AskMrRobot.ItemTooltipFrame })

	o.tooltipShown = false

	-- initialize the enter/leave scripts for showing the tooltips
	o:SetScript("OnEnter", AskMrRobot.ItemTooltipFrame.OnEnterTooltipFrame)
	o:SetScript("OnLeave", AskMrRobot.ItemTooltipFrame.OnLeaveTooltipFrame)

	-- return the instance of the ItemTooltipFrame
	return o
end

function AskMrRobot.ItemTooltipFrame:OnEnterTooltipFrame()
	if self.itemLink then
		GameTooltip:SetOwner(self, "ANCHOR_CURSOR")

		GameTooltip:SetHyperlink(self.itemLink)

		GameTooltip:Show()
		self.tooltipShown = true
	end
end

function AskMrRobot.ItemTooltipFrame:OnLeaveTooltipFrame()
	GameTooltip:Hide()
	self.tooltipShown = false
end

-- set the tooltip from the specified item link
function AskMrRobot.ItemTooltipFrame:SetItemLink(link)
	if self.tooltipShown then
		GameTooltip:Hide()
	end
	self.itemLink = link
end