diff classes/ActionButton.lua @ 161:d0a41fc7b0d7

Totem bar support
author Flick <flickerstreak@gmail.com>
date Fri, 21 Aug 2009 04:15:09 +0000
parents 799c6ea9da7b
children 5257073138e8
line wrap: on
line diff
--- a/classes/ActionButton.lua	Sat Aug 08 00:04:04 2009 +0000
+++ b/classes/ActionButton.lua	Fri Aug 21 04:15:09 2009 +0000
@@ -372,8 +372,7 @@
 end
 
 function Action:UpdateIcon()
-  local action = self.actionID
-  local texture = GetActionTexture(action)
+  local texture, tLeft, tRight, tTop, tBottom = self:GetIconTexture()
   local icon = self.frames.icon
   local hotkey = self.frames.hotkey
   local f = self:GetFrame()
@@ -388,6 +387,9 @@
 
   if texture then
     icon:SetTexture(texture)
+    if tLeft then
+      icon:SetTexCoord(tLeft,tRight,tTop,tBottom)
+    end
     icon:Show()
     self.rangeTimer = -1
     f:SetNormalTexture("Interface\\Buttons\\UI-Quickslot2")
@@ -399,6 +401,10 @@
   end
 end
 
+function Action:GetIconTexture()
+  return GetActionTexture(self.actionID)
+end
+
 function Action:UpdateBorder()
   local action = self.actionID
   if ReAction:GetKeybindMode() then
@@ -456,8 +462,8 @@
 end
 
 function Action:UpdateUsable()
-  local isUsable, notEnoughMana = IsUsableAction(self.actionID)
-  local noRange = IsActionInRange(self.actionID) == 0
+  local isUsable, notEnoughMana = self:GetUsable()
+  local noRange = self:GetInRange()
 
   isUsable = self.vehicleExitMode or (isUsable and not noRange)
 
@@ -488,8 +494,20 @@
   end
 end
 
+function Action:GetUsable()
+  return IsUsableAction(self.actionID)
+end
+
+function Action:GetInRange()
+  return IsActionInRange(self.actionID) == 0
+end
+
 function Action:UpdateCooldown()
-  CooldownFrame_SetTimer(self.frames.cooldown, GetActionCooldown(self.actionID))
+  CooldownFrame_SetTimer(self.frames.cooldown, self:GetCooldown())
+end
+
+function Action:GetCooldown()
+  return GetActionCooldown(self.actionID)
 end
 
 function Action:UpdateFlash()
@@ -657,7 +675,9 @@
 end
 
 function Action:OnAttributeChanged( attr, value )
-  self:UpdateAction()
+  if attr ~= "statehidden" then
+    self:UpdateAction()
+  end
 end
 
 function Action:PostClick( )