-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathWindowOrder.lua
74 lines (60 loc) · 1.46 KB
/
WindowOrder.lua
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
local TopWindow
local AddToScale = {}
local AllWindows = {}
local LevelDiff
local function SetLevel_ProcessChildFrames(...)
for i = 1, select('#', ...) do
local frame = select(i, ...)
Spy:SetLevel(frame, frame:GetFrameLevel() + LevelDiff)
end
end
function Spy:SetLevel(frame, level)
LevelDiff = level - frame:GetFrameLevel()
frame:SetFrameLevel(level)
end
function Spy:InitOrder()
TopWindow = UIParent
Spy:AddWindow(Spy.MainWindow)
end
function Spy:SetWindowTop(window)
local Check = window.Above
while Check ~= nil do
window.Above = Check.Above
Check.Above = window
Check.Below = window.Below
window.Below = Check
Check.Below.Above = Check
Spy:SetLevel(Check, Check.Below:GetFrameLevel() + 10)
Check = window.Above
end
Spy:SetLevel(window, window.Below:GetFrameLevel() + 10)
TopWindow = window
end
function Spy:AddWindow(window)
window.Below = TopWindow
TopWindow.Above = window
window.Above = nil
Spy:SetLevel(window, TopWindow:GetFrameLevel() + 10)
TopWindow = window
AddToScale[#AddToScale + 1] = window
AllWindows[#AllWindows + 1] = window
window.isLocked = Spy.db.profile.Locked
end
function Spy:LockWindows(lock)
for _, v in pairs(AllWindows) do
if v.DragBottomRight then
v.isLocked = lock
v:EnableMouse(not lock)
if lock then
v.DragBottomRight:Hide()
v.DragBottomLeft:Hide()
else
v.DragBottomRight:Show()
v.DragBottomLeft:Show()
end
else
v.isLocked = false
v:EnableMouse(true)
end
end
end