diff classes/Button.lua @ 128:729232aeeb5e

Action Button rewrite. (note: pet actions are probably slightly broken right now, they haven't been updated yet)
author Flick <flickerstreak@gmail.com>
date Thu, 05 Mar 2009 01:28:48 +0000
parents 6a4b4d3c5fad
children 28b430de5875
line wrap: on
line diff
--- a/classes/Button.lua	Wed Mar 04 21:19:32 2009 +0000
+++ b/classes/Button.lua	Thu Mar 05 01:28:48 2009 +0000
@@ -30,7 +30,7 @@
 
 ReAction.Button = Button -- export to ReAction
 
-function Button:New( name, config, bar, idx, inherits, buttonType )
+function Button:New( name, barConfig, bar, idx, inherits, buttonType )
   buttonType = buttonType or "CheckButton"
 
   -- create new self
@@ -38,7 +38,8 @@
     { 
       bar = bar,
       idx = idx,
-      config = config,
+      barConfig = barConfig,
+      config = barConfig.buttons[idx],
       name = name,
     }, 
     { __index = self } )
@@ -84,6 +85,10 @@
   end
 end
 
+function Button:GetBar()
+  return self.bar
+end
+
 function Button:GetFrame()
   return self.frame
 end
@@ -96,6 +101,12 @@
   return self.config
 end
 
+function Button:GetBarConfig()
+  -- this is the per-bar Button config structure,
+  -- not the config structure of the bar itself
+  return self.barConfig
+end
+
 function Button:GetActionID()
   -- derived classes should override this
   return nil
@@ -180,6 +191,7 @@
     f:SetScript("OnEnter", self.oldOnEnter)
     self.oldOnEnter = nil
   end
+  self:ShowGridTemp(mode)
   self:UpdateKeybindModeDisplay( mode )
 end
 
@@ -256,23 +268,14 @@
   end
 end
 
-function Button:ShowGrid( show )
-  if not InCombatLockdown() then
-    local f = self.frame
-    local count = f:GetAttribute("showgrid")
-    if show then
-      count = count + 1
-    else
-      count = count - 1
-    end
-    if count < 0 then
-      count = 0
-    end
-    f:SetAttribute("showgrid",count)
-    self:UpdateShowGrid()
-  end
-end
-
 function Button:UpdateShowGrid()
  -- does nothing by default
 end
+
+function Button:ShowGridTemp(show)
+  -- does nothing by default
+end
+
+function Button:ShowGrid(show)
+  -- does nothing by default
+end