diff classes/Button.lua @ 131:e39d80bb0b7a

Refactored some code into Button, cleaned up PetActionButton a little
author Flick <flickerstreak@gmail.com>
date Fri, 06 Mar 2009 23:58:02 +0000
parents 28b430de5875
children 16048f516f5e
line wrap: on
line diff
--- a/classes/Button.lua	Fri Mar 06 23:44:55 2009 +0000
+++ b/classes/Button.lua	Fri Mar 06 23:58:02 2009 +0000
@@ -58,6 +58,17 @@
 
   self.frame = f
 
+  local frames = { }
+  self.frames = frames
+  frames.icon          = _G[name.."Icon"]
+  frames.flash         = _G[name.."Flash"]
+  frames.hotkey        = _G[name.."HotKey"]
+  frames.count         = _G[name.."Count"]
+  frames.name          = _G[name.."Name"]
+  frames.border        = _G[name.."Border"]
+  frames.cooldown      = _G[name.."Cooldown"]
+  frames.normalTexture = _G[name.."NormalTexture"]
+
   if config then
     config.name = name
   end
@@ -190,22 +201,22 @@
 end
 
 function Button:UpdateKeybindModeDisplay( mode )
-  self.border = self.border or _G[format("%sBorder",tostring(self:GetName()))]
-  if self.border then
+  local border = self.frames.border or _G[format("%sBorder",tostring(self:GetName()))]
+  if border then
     if mode then
-      self.border:SetVertexColor(KB:GetColorKeyBoundMode())
-      self.border:Show()
+      border:SetVertexColor(KB:GetColorKeyBoundMode())
+      border:Show()
     else
-      self.border:Hide()
+      border:Hide()
     end
   end
 end
 
 function Button:UpdateHotkey( hotkey )
-  hotkey = hotkey or self.hotkey
+  hotkey = hotkey or self.frames.hotkey
   if not hotkey then
     hotkey = _G[self:GetName().."HotKey"]
-    self.hotkey = hotkey
+    self.frames.hotkey = hotkey
   end
   if hotkey then
     local txt = self.frame:GetHotkey()