Add pref-button to toggle all minimap buttons of childs
This commit is contained in:
parent
33e8f02cbe
commit
60bfaac28d
|
@ -1,3 +0,0 @@
|
|||
<Bindings>
|
||||
<Binding name="COORDS_TOGGLE" header="COORDS" category="ADDONS">zzCoords_MinimapToggle()</Binding>
|
||||
</Bindings>
|
|
@ -2,5 +2,6 @@ local addonname, addon = ...
|
|||
local childName = addon['childName']
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale(childName, "enUS", true)
|
||||
if L then
|
||||
L[childName] = childName
|
||||
L['Toggle Minimap-Icons'] = true
|
||||
L['Show or Hide all Icons of childs'] = true
|
||||
end
|
32
prefs.lua
32
prefs.lua
|
@ -1,12 +1,40 @@
|
|||
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
|
||||
print("Found parent", child['specs']['name'],"with childs",#childs)
|
||||
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
|
||||
}
|
||||
--print('reg', format("Init%s", childName))
|
||||
--addon.RegisterCallback(init, format("Init%s", childName), 'Setup')
|
||||
addon.RegisterCallback(init, format("Init%s", childName), 'Setup')
|
Loading…
Reference in New Issue