Show tooltips for plugins that don't define any
James Whitehead II [04-18-09 - 13:30]
Show tooltips for plugins that don't define any
diff --git a/NinjaPanel.lua b/NinjaPanel.lua
index a430c06..b20e299 100644
--- a/NinjaPanel.lua
+++ b/NinjaPanel.lua
@@ -310,7 +310,11 @@ function NinjaPanel:UpdateTooltipHandlers(button, dataobj)
elseif dataobj.OnTooltipShow then
button:SetScript("OnEnter", Button_OnEnter)
button:SetScript("OnLeave", Button_OnLeave)
- end
+ else
+ -- Fallback and proide our own tooltip handler
+ button:SetScript("OnEnter", Button_Tooltip_OnEnter)
+ button:SetScript("OnLeave", Button_Tooltip_OnLeave)
+ end
end
function NinjaPanel:UpdatePanels()
@@ -657,13 +661,20 @@ end
function Button_Tooltip_OnEnter(button)
local tooltip = button.object.tooltip
- tooltip:ClearAllPoints()
- tooltip:SetPoint("TOPLEFT", button, "BOTTOMLEFT", 0, 0)
- tooltip:Show()
+ if tooltip then
+ tooltip:ClearAllPoints()
+ tooltip:SetPoint("TOPLEFT", button, "BOTTOMLEFT", 0, 0)
+ tooltip:Show()
+ else
+ GameTooltip:SetOwner(button, "ANCHOR_BOTTOMLEFT")
+ GameTooltip:AddLine(button.entry.name, nil, nil, nil, true)
+ GameTooltip:AddDoubleLine("LDB Type", button.entry.type, nil, nil, nil, 1, 1, 1, true)
+ GameTooltip:Show()
+ end
end
function Button_Tooltip_OnLeave(button)
- local tooltip = button.object.tooltip
+ local tooltip = button.object.tooltip or GameTooltip
tooltip:Hide()
end