comparison modules/PetAction.lua @ 147:901c91dc1bf2

Some refactoring of configmode/keybind handlers
author Flick <flickerstreak@gmail.com>
date Thu, 07 May 2009 23:55:00 +0000
parents 6e4a11b9d290
children de1da46dadb3
comparison
equal deleted inserted replaced
146:86564b5cbbff 147:901c91dc1bf2
12 local _G = _G 12 local _G = _G
13 local CreateFrame = CreateFrame 13 local CreateFrame = CreateFrame
14 local format = string.format 14 local format = string.format
15 15
16 ReAction:UpdateRevision("$Revision$") 16 ReAction:UpdateRevision("$Revision$")
17
18 -- libraries
19 local KB = LibStub("LibKeyBound-1.0")
20 17
21 -- module declaration 18 -- module declaration
22 local moduleID = "PetAction" 19 local moduleID = "PetAction"
23 local module = ReAction:NewModule( moduleID ) 20 local module = ReAction:NewModule( moduleID )
24 21
54 ReAction.RegisterCallback(self, "OnDestroyBar") 51 ReAction.RegisterCallback(self, "OnDestroyBar")
55 ReAction.RegisterCallback(self, "OnRefreshBar") 52 ReAction.RegisterCallback(self, "OnRefreshBar")
56 ReAction.RegisterCallback(self, "OnEraseBar") 53 ReAction.RegisterCallback(self, "OnEraseBar")
57 ReAction.RegisterCallback(self, "OnRenameBar") 54 ReAction.RegisterCallback(self, "OnRenameBar")
58 ReAction.RegisterCallback(self, "OnConfigModeChanged") 55 ReAction.RegisterCallback(self, "OnConfigModeChanged")
59
60 KB.RegisterCallback(self, "LIBKEYBOUND_ENABLED")
61 KB.RegisterCallback(self, "LIBKEYBOUND_DISABLED")
62 KB.RegisterCallback(self, "LIBKEYBOUND_MODE_COLOR_CHANGED","LIBKEYBOUND_ENABLED")
63 end 56 end
64 57
65 function module:OnEnable() 58 function module:OnEnable()
66 ReAction:RegisterBarType(L["Pet Action Bar"], 59 ReAction:RegisterBarType(L["Pet Action Bar"],
67 { 60 {
169 end 162 end
170 end 163 end
171 end 164 end
172 end 165 end
173 166
174 function module:LIBKEYBOUND_ENABLED(evt)
175 for _, buttons in pairs(self.buttons) do
176 for _, b in pairs(buttons) do
177 b:SetKeybindMode(true)
178 end
179 end
180 end
181
182 function module:LIBKEYBOUND_DISABLED(evt)
183 for _, buttons in pairs(self.buttons) do
184 for _, b in pairs(buttons) do
185 b:SetKeybindMode(false)
186 end
187 end
188 end
189
190
191 ---- Options ---- 167 ---- Options ----
192 local Handler = { } 168 local Handler = { }
193 local meta = { __index = Handler } 169 local meta = { __index = Handler }
194 170
195 function Handler:New(bar) 171 function Handler:New(bar)
230 name = L["Pet Buttons"], 206 name = L["Pet Buttons"],
231 handler = Handler:New(bar), 207 handler = Handler:New(bar),
232 args = { 208 args = {
233 lockButtons = { 209 lockButtons = {
234 name = L["Lock Buttons"], 210 name = L["Lock Buttons"],
235 desc = L["Prevents picking up/dragging actions.|nNOTE: This setting is overridden by the global setting in Blizzard's Action Buttons tab"], 211 desc = L["Prevents picking up/dragging actions (use SHIFT to override this behavior)"],
236 order = 2, 212 order = 2,
237 type = "toggle", 213 type = "toggle",
238 get = "GetLockButtons", 214 get = "GetLockButtons",
239 set = "SetLockButtons", 215 set = "SetLockButtons",
240 }, 216 },