diff modules/ReAction_Action/ReAction_Action.lua @ 28:21bcaf8215ff

- converted to Ace3 - rearranged file layout - configGUI menus not working right now
author Flick <flickerstreak@gmail.com>
date Mon, 17 Mar 2008 18:24:53 +0000
parents 9e1984088124
children 0d95ce7a9ec2
line wrap: on
line diff
--- a/modules/ReAction_Action/ReAction_Action.lua	Tue Mar 11 21:39:34 2008 +0000
+++ b/modules/ReAction_Action/ReAction_Action.lua	Mon Mar 17 18:24:53 2008 +0000
@@ -11,34 +11,22 @@
 local ReAction = ReAction
 local L = ReAction.L
 local _G = _G
-local AceOO = AceLibrary("AceOO-2.0")
 local CreateFrame = CreateFrame
 local print = ReAction.print
 
 -- module declaration
 local moduleID = "Action"
-local module = ReAction:NewModule( moduleID,
-  "AceEvent-2.0"
-)
-
---
--- action button class declaration
---
-local BtnClass = AceOO.Class()
-local Button = BtnClass.prototype
-module.BtnClass = BtnClass
-
-
+local module = ReAction:NewModule( moduleID )
 
 -- module methods
 function module:OnInitialize()
-  self.db = ReAction:AcquireDBNamespace(moduleID)
-  ReAction:RegisterDefaults(moduleID,"profile", 
+  self.db = ReAction.db:RegisterNamespace( moduleID,
     { 
-      buttons = { }
+      profile = {
+        buttons = { }
+      }
     }
   )
-
   self.buttons = { }
 end
 
@@ -48,9 +36,6 @@
 function module:OnDisable()
 end
 
-function module:OnProfileEnable()
-end
-
 function module:ApplyToBar(bar)
   self:RefreshBar(bar)
 end
@@ -136,7 +121,7 @@
         name = L["New Action Bar"],
         desc = L["Create a new bar of standard action buttons"],
         func = function()
-                 ReAction:GetModule("Bar"):CreateBar()
+                 ReAction:CreateBar()
                end,
         disabled = InCombatLockdown,
       }
@@ -194,9 +179,11 @@
 
 
 
--- button class methods
-function Button:init( bar, idx, config )
-  BtnClass.super.prototype.init(self)
+
+------ Button class ------
+local Button = { }
+
+local function Constructor( self, bar, idx, config )
   self.bar, self.idx, self.config = bar, idx, config
 
   local barFrame = bar:GetFrame()
@@ -225,8 +212,8 @@
   f:Hide()
   f:SetParent(UIParent)
   f:ClearAllPoints()
-  if self.config.name then
-    _G[self.config.name] = nil
+  if self.name then
+    _G[self.name] = nil
   end
   ActionIDList[self.config.actionID] = nil
   self.frame = nil
@@ -249,3 +236,16 @@
 function Button:GetActionID()
   return self.config.actionID
 end
+
+
+-- export as a class-factory to module
+module.BtnClass = {
+  new = function(self, ...)
+    local x = { }
+    for k,v in pairs(Button) do
+      x[k] = v
+    end
+    Constructor(x, ...)
+    return x
+  end
+}