diff modules/ReAction_PetAction/ReAction_PetAction.lua @ 95:168cae4aa8bd

Fixes: - brute-force fix for invalid snippets - copying profile data now results in immediate changes - fixed keybinding tooltip display for pet bar simple actions Also did a little condensing of the state driver rule string generation
author Flick <flickerstreak@gmail.com>
date Wed, 22 Oct 2008 21:39:07 +0000
parents 39265b16d208
children ad49739d110d
line wrap: on
line diff
--- a/modules/ReAction_PetAction/ReAction_PetAction.lua	Fri Oct 17 23:46:30 2008 +0000
+++ b/modules/ReAction_PetAction/ReAction_PetAction.lua	Wed Oct 22 21:39:07 2008 +0000
@@ -11,6 +11,7 @@
 local L = ReAction.L
 local _G = _G
 local CreateFrame = CreateFrame
+local format = string.format
 
 ReAction:UpdateRevision("$Revision$")
 
@@ -225,7 +226,7 @@
 
 local frameRecycler = {}
 local trash = CreateFrame("Frame")
-local KBAttach, GetActionName, GetHotkey, SetKey, FreeKey, ClearBindings, GetBindings
+local KBAttach, GetActionName, GetHotkey, SetKey, FreeKey, ClearBindings, GetBindings, OnEnter, OnLeave
 do
   local buttonLookup = setmetatable({},{__mode="kv"})
 
@@ -304,6 +305,38 @@
       button.border:Show()
     end
   end
+
+  function OnEnter( self )
+    if not self.tooltipName then
+      return;
+    end
+    local uber = GetCVar("UberTooltips")
+    if self.isToken or (uber == "0") then
+      if uber == "0" then
+        GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
+      else
+        GameTooltip_SetDefaultAnchor(GameTooltip, self)
+      end
+      local tooltip = self.tooltipName
+      local k = GetBindings(self)
+      if k then
+        tooltip = tooltip .. format(" %s(%s)%s", NORMAL_FONT_COLOR_CODE, k, FONT_COLOR_CODE_CLOSE)
+      end
+      GameTooltip:SetText(tooltip)
+      if self.tooltipSubtext then
+        GameTooltip:AddLine(self.tooltipSubtext, "", 0.5, 0.5, 0.5)
+      end
+      GameTooltip:Show()
+    else
+      GameTooltip_SetDefaultAnchor(GameTooltip, self)
+      GameTooltip:SetPetAction(self:GetID())
+    end
+  end
+
+  function OnLeave()
+    GameTooltip:Hide()
+  end
+
 end
 
 local meta = { __index = Button }
@@ -345,6 +378,8 @@
     f.hotkey = hotkey
     f:HookScript("OnDragStart", function() self:Update() end)
     f:HookScript("OnReceiveDrag", function() self:Update() end)
+    f:SetScript("OnEnter", OnEnter)
+    f:SetScript("OnLeave", OnLeave)
   end
   if config.actionID then
     f:SetID(config.actionID) -- PetActionButtonTemplate isn't a proper SecureActionButton