comparison classes/Button.lua @ 131:e39d80bb0b7a

Refactored some code into Button, cleaned up PetActionButton a little
author Flick <flickerstreak@gmail.com>
date Fri, 06 Mar 2009 23:58:02 +0000
parents 28b430de5875
children 16048f516f5e
comparison
equal deleted inserted replaced
130:6e4a11b9d290 131:e39d80bb0b7a
55 frameList[name] = f 55 frameList[name] = f
56 end 56 end
57 end 57 end
58 58
59 self.frame = f 59 self.frame = f
60
61 local frames = { }
62 self.frames = frames
63 frames.icon = _G[name.."Icon"]
64 frames.flash = _G[name.."Flash"]
65 frames.hotkey = _G[name.."HotKey"]
66 frames.count = _G[name.."Count"]
67 frames.name = _G[name.."Name"]
68 frames.border = _G[name.."Border"]
69 frames.cooldown = _G[name.."Cooldown"]
70 frames.normalTexture = _G[name.."NormalTexture"]
60 71
61 if config then 72 if config then
62 config.name = name 73 config.name = name
63 end 74 end
64 75
188 self:ShowGridTemp(mode) 199 self:ShowGridTemp(mode)
189 self:UpdateKeybindModeDisplay( mode ) 200 self:UpdateKeybindModeDisplay( mode )
190 end 201 end
191 202
192 function Button:UpdateKeybindModeDisplay( mode ) 203 function Button:UpdateKeybindModeDisplay( mode )
193 self.border = self.border or _G[format("%sBorder",tostring(self:GetName()))] 204 local border = self.frames.border or _G[format("%sBorder",tostring(self:GetName()))]
194 if self.border then 205 if border then
195 if mode then 206 if mode then
196 self.border:SetVertexColor(KB:GetColorKeyBoundMode()) 207 border:SetVertexColor(KB:GetColorKeyBoundMode())
197 self.border:Show() 208 border:Show()
198 else 209 else
199 self.border:Hide() 210 border:Hide()
200 end 211 end
201 end 212 end
202 end 213 end
203 214
204 function Button:UpdateHotkey( hotkey ) 215 function Button:UpdateHotkey( hotkey )
205 hotkey = hotkey or self.hotkey 216 hotkey = hotkey or self.frames.hotkey
206 if not hotkey then 217 if not hotkey then
207 hotkey = _G[self:GetName().."HotKey"] 218 hotkey = _G[self:GetName().."HotKey"]
208 self.hotkey = hotkey 219 self.frames.hotkey = hotkey
209 end 220 end
210 if hotkey then 221 if hotkey then
211 local txt = self.frame:GetHotkey() 222 local txt = self.frame:GetHotkey()
212 hotkey:SetText( txt ) 223 hotkey:SetText( txt )
213 if txt == nil or txt == "" then 224 if txt == nil or txt == "" then