comparison classes/Bar.lua @ 171:fe0c7be6f6ef

Convert GridProxy to LibShowGrid
author Flick <flickerstreak@gmail.com>
date Tue, 19 Oct 2010 20:22:59 +0000
parents 8cc187143acd
children df68b5a40490
comparison
equal deleted inserted replaced
170:0030201b5fc2 171:fe0c7be6f6ef
4 local CreateFrame = CreateFrame 4 local CreateFrame = CreateFrame
5 local floor = math.floor 5 local floor = math.floor
6 local fmod = math.fmod 6 local fmod = math.fmod
7 local format = string.format 7 local format = string.format
8 8
9 local KB = LibStub("LibKeyBound-1.0") 9 local LKB = LibStub("LibKeyBound-1.0")
10 local LSG = LibStub("LibShowGrid-1.0")
10 11
11 ---- Secure snippets ---- 12 ---- Secure snippets ----
12 local _reaction_init = 13 local _reaction_init =
13 [[ 14 [[
14 anchorKeys = newtable("point","relPoint","x","y") 15 anchorKeys = newtable("point","relPoint","x","y")
219 f:SetHeight(self.height) 220 f:SetHeight(self.height)
220 f:SetAlpha(config.alpha or 1.0) 221 f:SetAlpha(config.alpha or 1.0)
221 f:Show() 222 f:Show()
222 f:EnableMouse(false) 223 f:EnableMouse(false)
223 f:SetClampedToScreen(true) 224 f:SetClampedToScreen(true)
224 ReAction.gridProxy:AddFrame(f) 225 LSG:AddFrame(f)
225 226
226 -- secure handlers 227 -- secure handlers
227 f:Execute(_reaction_init) 228 f:Execute(_reaction_init)
228 f:SetAttribute("_onstate-reaction", _onstate_reaction) 229 f:SetAttribute("_onstate-reaction", _onstate_reaction)
229 f:SetAttribute("_onstate-showgrid", _onstate_showgrid) 230 f:SetAttribute("_onstate-showgrid", _onstate_showgrid)
243 self:ApplyAnchor() 244 self:ApplyAnchor()
244 self:SetConfigMode(ReAction:GetConfigMode()) 245 self:SetConfigMode(ReAction:GetConfigMode())
245 self:SetKeybindMode(ReAction:GetKeybindMode()) 246 self:SetKeybindMode(ReAction:GetKeybindMode())
246 247
247 ReAction.RegisterCallback(self, "OnConfigModeChanged") 248 ReAction.RegisterCallback(self, "OnConfigModeChanged")
248 KB.RegisterCallback(self, "LIBKEYBOUND_ENABLED") 249 LKB.RegisterCallback(self, "LIBKEYBOUND_ENABLED")
249 KB.RegisterCallback(self, "LIBKEYBOUND_DISABLED") 250 LKB.RegisterCallback(self, "LIBKEYBOUND_DISABLED")
250 KB.RegisterCallback(self, "LIBKEYBOUND_MODE_COLOR_CHANGED","LIBKEYBOUND_ENABLED") 251 LKB.RegisterCallback(self, "LIBKEYBOUND_MODE_COLOR_CHANGED","LIBKEYBOUND_ENABLED")
251 252
252 return self 253 return self
253 end 254 end
254 255
255 function Bar:Destroy() 256 function Bar:Destroy()
256 local f = self:GetFrame() 257 local f = self:GetFrame()
257 f:UnregisterAllEvents() 258 f:UnregisterAllEvents()
258 self:ShowControls(false) 259 self:ShowControls(false)
259 ReAction.UnregisterAllCallbacks(self) 260 ReAction.UnregisterAllCallbacks(self)
260 KB.UnregisterAllCallbacks(self) 261 LKB.UnregisterAllCallbacks(self)
261 ReAction.gridProxy:RemoveFrame(f) 262 LSG:RemoveFrame(f)
262 f:SetParent(UIParent) 263 f:SetParent(UIParent)
263 f:ClearAllPoints() 264 f:ClearAllPoints()
264 f:Hide() 265 f:Hide()
265 end 266 end
266 267