File choir.lua changed (mode: 100644) (index a42686c..f526d66) |
... |
... |
local function createSpoiler(spoilerParent, spoilerDesignation) |
240 |
240 |
local spoiler = CreateFrame('BUTTON', spoilerDesignation, spoilerParent, 'SecureHandlerClickTemplate') |
local spoiler = CreateFrame('BUTTON', spoilerDesignation, spoilerParent, 'SecureHandlerClickTemplate') |
241 |
241 |
spoiler:EnableMouse(true) |
spoiler:EnableMouse(true) |
242 |
242 |
spoiler:SetAttribute('_onclick', [=[ |
spoiler:SetAttribute('_onclick', [=[ |
243 |
|
--[[ Toggle sibling frames, which are other spoilers that contain unit buttons ]]-- |
|
244 |
|
local parentFrame = self:GetParent() |
|
245 |
|
local siblingTable = parentFrame:GetChildList(newtable()) |
|
246 |
|
local i = 0 |
|
247 |
|
while (i < #siblingTable) do |
|
248 |
|
i = i + 1 |
|
249 |
|
local sibling = siblingTable[i] |
|
250 |
|
sibling:ClearBindings() |
|
251 |
|
sibling:Hide() |
|
|
243 |
|
--[[ Toggle the spoiler on repeated clicks. ]]-- |
|
244 |
|
if self:IsShown() then |
|
245 |
|
self:Hide() |
|
246 |
|
return |
252 |
247 |
end |
end |
253 |
248 |
|
|
254 |
|
--[[ Apply override bindings to children which are unit buttons of a specific raid group ]]-- |
|
|
249 |
|
--[[ Override binding key to toggle the spoiler on Escape key press. ]]-- |
|
250 |
|
self:SetBindingClick(true, 'CTRL-W', self) |
|
251 |
|
self:SetBindingClick(true, 'ESCAPE', self) |
255 |
252 |
self:Show() |
self:Show() |
|
253 |
|
|
|
254 |
|
--[[ Apply override bindings to children which are unit buttons of a specific raid group. ]]-- |
256 |
255 |
local j = 0 |
local j = 0 |
257 |
256 |
local childTable = self:GetChildList(newtable()) |
local childTable = self:GetChildList(newtable()) |
258 |
257 |
while (j < #childTable) do |
while (j < #childTable) do |
|
... |
... |
local function createSpoiler(spoilerParent, spoilerDesignation) |
267 |
266 |
end |
end |
268 |
267 |
]=]) |
]=]) |
269 |
268 |
|
|
|
269 |
|
--[[ Toggle sibling frames, which are other spoilers that contain unit buttons ]]-- |
|
270 |
|
--[[ WARNING Make sure not to toggle this frame (self). |
|
271 |
|
-- Otherwise wrap scripts might trigger unexpectedly. ]]-- |
|
272 |
|
spoiler:WrapScript(spoiler, 'OnShow', [=[ |
|
273 |
|
local parentFrame = self:GetParent() |
|
274 |
|
local siblingTable = parentFrame:GetChildList(newtable()) |
|
275 |
|
local i = 0 |
|
276 |
|
while (i < #siblingTable) do |
|
277 |
|
i = i + 1 |
|
278 |
|
local sibling = siblingTable[i] |
|
279 |
|
if self ~= sibling then |
|
280 |
|
sibling:Hide() |
|
281 |
|
end |
|
282 |
|
end |
|
283 |
|
]=]) |
|
284 |
|
|
|
285 |
|
--[[ Override key bindings are set when _onclick script is executed. |
|
286 |
|
-- Reset the bindings when the frame is hidden to allow other frames, |
|
287 |
|
-- especially nested spoilers, to re-use the keys. ]]-- |
|
288 |
|
spoiler:WrapScript(spoiler, 'OnHide', [=[ |
|
289 |
|
self:ClearBindings() |
|
290 |
|
]=]) |
|
291 |
|
|
270 |
292 |
return spoiler |
return spoiler |
271 |
293 |
end |
end |
272 |
294 |
|
|
|
... |
... |
local function createGroup(rootFrame, groupNumber, unitTable) |
342 |
364 |
-- which was created with createSpoiler and |
-- which was created with createSpoiler and |
343 |
365 |
-- has required scripts hooked to it ]]-- |
-- has required scripts hooked to it ]]-- |
344 |
366 |
local spoilerFrame = self:GetParent() |
local spoilerFrame = self:GetParent() |
345 |
|
spoilerFrame:ClearBindings() |
|
346 |
367 |
spoilerFrame:Hide() |
spoilerFrame:Hide() |
347 |
368 |
]=]) |
]=]) |
348 |
369 |
b:Hide() |
b:Hide() |
|
... |
... |
local function createGroup(rootFrame, groupNumber, unitTable) |
357 |
378 |
|
|
358 |
379 |
_G['BINDING_NAME_CLICK ' .. spoiler:GetName() .. ':LeftButton'] = 'Group ' .. tostring(groupNumber) |
_G['BINDING_NAME_CLICK ' .. spoiler:GetName() .. ':LeftButton'] = 'Group ' .. tostring(groupNumber) |
359 |
380 |
|
|
|
381 |
|
spoiler:Hide() |
|
382 |
|
|
360 |
383 |
return spoiler |
return spoiler |
361 |
384 |
end |
end |
362 |
385 |
|
|