diff classes/ActionButton.lua @ 138:1f36187a94cf

Fixed paged actions
author Flick <flickerstreak@gmail.com>
date Fri, 10 Apr 2009 23:22:10 +0000
parents 16048f516f5e
children 8b35239339c5
line wrap: on
line diff
--- a/classes/ActionButton.lua	Wed Mar 18 02:22:24 2009 +0000
+++ b/classes/ActionButton.lua	Fri Apr 10 23:22:10 2009 +0000
@@ -52,8 +52,9 @@
       action = 0
     end
   elseif page and state and page[state] then
-    action = self:GetAttribute("action-page"..page[state])
-  else
+    action = self:GetAttribute("action-"..page[state]) 
+  end
+  if action == nil then
     action = self:GetAttribute("default-action")
   end
 
@@ -186,7 +187,15 @@
   f:SetAttribute("showgrid-event",0)
   f:SetAttribute("showgrid",not self:GetBarConfig().hideEmpty)
 
-  self:RefreshHasActionAttributes()
+  self:Refresh()
+
+  -- attach to skinner
+  bar:SkinButton(self)
+
+  -- initial display
+  if ReAction:GetConfigMode() then
+    self:ShowGridTemp(true)
+  end
 
   -- non secure scripts
   f:SetScript("OnEvent", function(frame, ...) self:OnEvent(...) end)
@@ -198,12 +207,6 @@
   f:SetScript("OnDragStart", function(frame) self:OnDragStart() end)
   f:SetScript("OnReceiveDrag", function(frame) self:OnReceiveDrag() end)
 
-  -- secure handlers
-  f:SetAttribute("_childupdate", _childupdate)
-  f:SetAttribute("_childupdate-showgrid",_childupdate_showgrid)
-  barFrame:WrapScript(f, "OnDragStart", _onDragStart)
-  barFrame:WrapScript(f, "OnReceiveDrag", _onReceiveDrag)
-
   -- event registration
   f:EnableMouse(true)
   f:RegisterForDrag("LeftButton", "RightButton")
@@ -212,15 +215,11 @@
     f:RegisterEvent(evt)
   end
 
-  -- attach to skinner
-  bar:SkinButton(self)
-
-  -- initial display
-  if ReAction:GetConfigMode() then
-    self:ShowGridTemp(true)
-  end
-
-  self:Refresh()
+  -- secure handlers
+  f:SetAttribute("_childupdate", _childupdate)
+  f:SetAttribute("_childupdate-showgrid",_childupdate_showgrid)
+  barFrame:WrapScript(f, "OnDragStart", _onDragStart)
+  barFrame:WrapScript(f, "OnReceiveDrag", _onReceiveDrag)
 
   return self
 end
@@ -250,6 +249,7 @@
 
 function Action:Refresh()
   Super.Refresh(self)
+  self:RefreshHasActionAttributes()
   self:RefreshPages()
   self:InstallVehicle()
   self:ShowGrid(not self:GetBarConfig().hideEmpty)