comparison modules/ReAction_HideBlizzard/ReAction_HideBlizzard.lua @ 31:27dde2743f43

Cleaned up and finished HideBlizzard module
author Flick <flickerstreak@gmail.com>
date Wed, 02 Apr 2008 23:44:06 +0000
parents 0d95ce7a9ec2
children 00f08528faaf
comparison
equal deleted inserted replaced
30:0d95ce7a9ec2 31:27dde2743f43
7 --]] 7 --]]
8 8
9 -- local imports 9 -- local imports
10 local ReAction = ReAction 10 local ReAction = ReAction
11 local L = ReAction.L 11 local L = ReAction.L
12 local _G = _G
13 12
14 -- module declaration 13 -- module declaration
15 local moduleID = "HideBlizzard" 14 local moduleID = "HideBlizzard"
16 local module = ReAction:NewModule( moduleID ) 15 local module = ReAction:NewModule( moduleID )
17 16
60 end 59 end
61 end 60 end
62 61
63 local frames = { 62 local frames = {
64 MainMenuBar, 63 MainMenuBar,
65 PetActionButton1, 64 PetActionBarFrame,
66 PetActionButton2,
67 PetActionButton3,
68 PetActionButton4,
69 PetActionButton5,
70 PetActionButton6,
71 PetActionButton7,
72 PetActionButton8,
73 PetActionButton9,
74 PetActionButton10,
75 BonusActionBarFrame, 65 BonusActionBarFrame,
76 ShapeshiftBarFrame, 66 ShapeshiftBarFrame,
77 MultiBarLeft, 67 MultiBarLeft,
78 MultiBarRight, 68 MultiBarRight,
79 MultiBarBottomLeft, 69 MultiBarBottomLeft,
85 local hidden = { } 75 local hidden = { }
86 76
87 function module:HideAll( force ) 77 function module:HideAll( force )
88 if not(self.db.profile.hide) or force then 78 if not(self.db.profile.hide) or force then
89 self.db.profile.hide = true 79 self.db.profile.hide = true
90 -- the pet bar is a child of MainMenuBar, but can't be permanently hidden because it will
91 -- break automatic pet bar show/hide. Need to reparent it instead.
92 PetActionBarFrame:SetParent(UIParent)
93 -- for some odd reason PetActionBarFrame has mouse input enabled even though it has no mouse
94 -- input handlers. Because of this it can potentially trap mouse clicks from getting through
95 -- to things behind it. It's not feasible to move it, either, since UIParent_ManageFramePositions()
96 -- will move it back to its original position whenever it's called.
97 PetActionBarFrame:EnableMouse(false)
98
99 for _, f in pairs(frames) do 80 for _, f in pairs(frames) do
100 hidden[f] = hidden[f] or { parent = f:GetParent(), wasShown = f:IsShown() } 81 hidden[f] = hidden[f] or { parent = f:GetParent(), wasShown = f:IsShown() }
101 f:SetParent(self.hiddenFrame) 82 f:SetParent(self.hiddenFrame)
102 f:Hide() 83 f:Hide()
103 end 84 end
106 87
107 function module:ShowAll( force ) 88 function module:ShowAll( force )
108 if self.db.profile.hide or force then 89 if self.db.profile.hide or force then
109 self.db.profile.hide = false 90 self.db.profile.hide = false
110 91
111 PetActionBarFrame:SetParent(MainMenuBar)
112 for _, f in pairs(frames) do 92 for _, f in pairs(frames) do
113 local h = hidden[f] 93 local h = hidden[f]
114 if h then 94 if h then
115 f:SetParent(h.parent) 95 f:SetParent(h.parent)
116 if h.wasShown then 96 if h.wasShown then