Mercurial > wow > reaction
diff Button.lua @ 286:77609bfa804e stable
Merge 1.1 beta 8 to stable
author | Flick |
---|---|
date | Sat, 11 Jun 2011 10:57:00 -0700 |
parents | 7a9e82c0df15 |
children | e337b39dc491 |
line wrap: on
line diff
--- a/Button.lua Wed May 11 09:53:48 2011 -0700 +++ b/Button.lua Sat Jun 11 10:57:00 2011 -0700 @@ -1,10 +1,5 @@ ---[[ - ReAction Button base class ---]] - --- local imports -local addonName, addonTable = ... -local ReAction = addonTable.ReAction +local _, ns = ... +local ReAction = ns.ReAction local L = ReAction.L local LKB = ReAction.LKB local _G = _G @@ -32,14 +27,17 @@ btnColumns = 12, spacing = 3 }, - barType = L["Button Bar"] + -- barType = L["Button Bar"], -- derived classes must declare + -- buttonTypeID = "Button" -- derived classes must declare } ReAction.Button = Button -- export to ReAction -function Button:New( name, config, bar, idx, inherits, buttonType ) +function Button:New( config, bar, idx, inherits, buttonType ) buttonType = buttonType or "CheckButton" + local name = format("ReAction_%s_%s_%d",bar:GetName(), self.buttonTypeID, idx) + -- create new self self = setmetatable( { @@ -190,7 +188,9 @@ if not success then bar:ClipNButtons(n) cfgN = n - geterrorhandler()(r) + if r then + geterrorhandler()(r) + end end end end @@ -237,7 +237,8 @@ end if id == nil then if unique then - error(("All action IDs for bars of type '%s' are in use, cannot create any more buttons"):format(self.config.barType)) + ReAction:UserError(L["All action IDs for bars of type '%s' are in use, cannot create any more buttons"]:format(self.barType)) + error(nil) -- no error message, user has already been notified, so don't put in Lua error handler end pool.nWraps = nWraps + 1 end