* Add support for the tooltip attribute
James Whitehead II [01-18-09 - 09:42]
* Add support for the tooltip attribute
diff --git a/NinjaPanel.lua b/NinjaPanel.lua
index b08eff2..e45b2d2 100644
--- a/NinjaPanel.lua
+++ b/NinjaPanel.lua
@@ -180,7 +180,17 @@ function NinjaPanel:UpdatePlugin(event, name, key, value, dataobj)
self:UpdateButtonWidth(button)
elseif key == "icon" then
button.icon:SetTexture(value)
- -- TODO: Clean this up
+ elseif key == "tooltip" then
+ -- This means we have a custom frame to be displayed so we must handle the
+ -- showing/hiding and anchoring
+ button:SetScript("OnEnter", function(self)
+ value:ClearAllPoints()
+ value:SetPoint("TOPLEFT", button, "BOTTOMLEFT", 0, 0)
+ value:Show()
+ end)
+ button:SetScript("OnLeave", function(self)
+ value:Hide()
+ end)
elseif key == "OnTooltipShow" and type(value) == "function" then
button:SetScript("OnEnter", Button_OnEnter)
button:SetScript("OnLeave", Button_OnLeave)