Mercurial > wow > reaction
comparison Bar.lua @ 70:2c12e2b1752e
Fixed unbinding a keystate toggle
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Tue, 03 Jun 2008 23:24:03 +0000 |
parents | fcb5dad031f9 |
children | 3d2cef5dc459 |
comparison
equal
deleted
inserted
replaced
69:a785d6708388 | 70:2c12e2b1752e |
---|---|
180 end | 180 end |
181 end | 181 end |
182 SecureStateHeader_Refresh(self.frame) | 182 SecureStateHeader_Refresh(self.frame) |
183 end | 183 end |
184 | 184 |
185 function Bar:SetStateKeybind(keybind, state, defaultstate) | 185 function Bar:SetStateKeybind(key, state, defaultstate) |
186 -- use a tiny offscreen button to get around making the bar itself a clickable button | 186 -- use a tiny offscreen button to get around making the bar itself a clickable button |
187 local f = self.statebuttonframe | 187 local f = self.statebuttonframe |
188 local off = ("%s_off"):format(state) | 188 local off = ("%s_off"):format(state) |
189 if keybind then | 189 if key then |
190 if not f then | 190 if not f then |
191 f = CreateFrame("Button",self:GetName().."_statebutton",UIParent,"SecureActionButtonTemplate") | 191 f = CreateFrame("Button",self:GetName().."_statebutton",UIParent,"SecureActionButtonTemplate") |
192 f:SetPoint("BOTTOMRIGHT",UIParent,"TOPLEFT") | 192 f:SetPoint("BOTTOMRIGHT",UIParent,"TOPLEFT") |
193 f:SetWidth(1) | 193 f:SetWidth(1) |
194 f:SetHeight(1) | 194 f:SetHeight(1) |
202 f:SetAttribute(("statebutton-%s"):format(state),("%s:%s;%s"):format(state,off,state)) | 202 f:SetAttribute(("statebutton-%s"):format(state),("%s:%s;%s"):format(state,off,state)) |
203 f:SetAttribute(("type-%s"):format(state),"attribute") | 203 f:SetAttribute(("type-%s"):format(state),"attribute") |
204 f:SetAttribute(("type-%s"):format(off),"attribute") | 204 f:SetAttribute(("type-%s"):format(off),"attribute") |
205 f:SetAttribute(("attribute-value-%s"):format(state), state) | 205 f:SetAttribute(("attribute-value-%s"):format(state), state) |
206 f:SetAttribute(("attribute-value-%s"):format(off), defaultstate) | 206 f:SetAttribute(("attribute-value-%s"):format(off), defaultstate) |
207 SetBindingClick(keybind, f:GetName(), state) | 207 SetBindingClick(key, f:GetName(), state) |
208 elseif f then | 208 elseif f then |
209 f:SetAttribute(("type-%s"):format(state),ATTRIBUTE_NOOP) | 209 f:SetAttribute(("type-%s"):format(state),ATTRIBUTE_NOOP) |
210 f:SetAttribute(("type-%s"):format(off),ATTRIBUTE_NOOP) | 210 f:SetAttribute(("type-%s"):format(off),ATTRIBUTE_NOOP) |
211 local action = ("CLICK %s:%s"):format(f:GetName(),state) | |
212 key = GetBindingKey(action) | |
213 if key then | |
214 SetBinding(key,nil) | |
215 end | |
211 end | 216 end |
212 end | 217 end |
213 | 218 |
214 function Bar:SetStatePageMap(state, map) -- map is a { ["statename"] = pagenumber } table | 219 function Bar:SetStatePageMap(state, map) -- map is a { ["statename"] = pagenumber } table |
215 local f = self.frame | 220 local f = self.frame |