39 lines
1.1 KiB
Lua
Executable File
39 lines
1.1 KiB
Lua
Executable File
local addonName, addon = ...
|
|
local childName = addon['childName']
|
|
local child = addon[childName]
|
|
|
|
local ldbicon = LibStub:GetLibrary("LibDBIcon-1.0")
|
|
local L = LibStub("AceLocale-3.0"):GetLocale(childName, true)
|
|
local function toggleChilds()
|
|
local childs = child['children']
|
|
if(#childs > 0) then
|
|
local sb = addon['db']['global']['ldbicons']
|
|
for i = 1, #childs do
|
|
local cName = childs[i]['specs']['name']
|
|
if(cName) then
|
|
sb[cName] = sb[cName] or {
|
|
['hide'] = true
|
|
}
|
|
sb[cName]['hide'] = not sb[cName]['hide']
|
|
if(ldbicon) then
|
|
if(sb[cName]['hide']) then
|
|
ldbicon:Hide(cName)
|
|
else
|
|
ldbicon:Show(cName)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
|
|
local init = {
|
|
Setup = function()
|
|
local config = LibStub:GetLibrary("zzConfig")
|
|
local options = child['options']
|
|
local main = options['args'][childName]
|
|
config:AddConfigEntry(main, "toggleChilds", "execute", L['Toggle Minimap-Icons'], L['Show or Hide all Icons of childs'], 3, toggleChilds)
|
|
end
|
|
}
|
|
addon.RegisterCallback(init, format("Init%s", childName), 'Setup') |