This repository was archived by the owner on Jan 21, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathBarEditTab_BarVisibilityPanel.lua
More file actions
76 lines (63 loc) · 2.36 KB
/
BarEditTab_BarVisibilityPanel.lua
File metadata and controls
76 lines (63 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
-- Neuron is a World of Warcraft® user interface addon.
-- Copyright (c) 2017-2021 Britt W. Yazel
-- Copyright (c) 2006-2014 Connor H. Chenoweth
-- This code is licensed under the MIT license (see LICENSE for details)
local _, addonTable = ...
local Neuron = addonTable.Neuron
local NeuronGUI = Neuron.NeuronGUI
local L = LibStub("AceLocale-3.0"):GetLocale("Neuron")
local AceGUI = LibStub("AceGUI-3.0")
local Array = addonTable.utilities.Array
---@param bar Bar
local function barVisibilityOptions(bar)
local stateList =
Array.map(
function (state)
return state[1]
end,
Array.fromIterator(pairs(Neuron.VISIBILITY_STATES)))
if Neuron.class == 'ROGUE' then
stateList = Array.filter(
function (state)
return state ~= 'stealth0' and state ~= 'stealth1'
end,
stateList
)
end
local visibilityStatesContainer = AceGUI:Create("SimpleGroup")
visibilityStatesContainer:SetFullWidth(true)
visibilityStatesContainer:SetLayout("Flow")
for _,state in ipairs(stateList) do
local checkbox = AceGUI:Create("CheckBox")
checkbox:SetLabel(Neuron.VISIBILITY_STATES[state])
checkbox:SetValue(not bar.data.hidestates:find(state))
checkbox:SetCallback("OnValueChanged", function(_,_,value)
bar:SetVisibility(state, value)
end)
visibilityStatesContainer:AddChild(checkbox)
end
return visibilityStatesContainer
end
---@param bar Bar
function NeuronGUI:BarVisibilityPanel(bar, tabFrame)
-- weird stuff happens if we don't wrap this in a group
-- like dropdowns showing at the bottom of the screen and stuff
local settingContainer = AceGUI:Create("SimpleGroup")
settingContainer:SetFullWidth(true)
settingContainer:SetLayout("Flow")
--sometimes the apply button doesn't appear
--so far it doesn't seem to happen when it is in
--it's own group :-/
local reloadButtonContainer = AceGUI:Create("SimpleGroup")
reloadButtonContainer:SetFullWidth(true)
reloadButtonContainer:SetLayout("Flow")
--visibility status doesn't apply properly
--so just suggest a ui reload with this apply button
local reloadButton = AceGUI:Create("Button")
reloadButton:SetText(L["Apply"])
reloadButton:SetCallback("OnClick", ReloadUI)
reloadButtonContainer:AddChild(reloadButton)
settingContainer:AddChild(barVisibilityOptions(bar))
settingContainer:AddChild(reloadButtonContainer)
tabFrame:AddChild(settingContainer)
end