annotate modules/ReAction_HideBlizzard/ReAction_HideBlizzard.lua @ 30:0d95ce7a9ec2

- added Ace3 externs - converted ReAction_ConfigUI to use blizzard interface addons panel via AceConfigDialog-3.0 - partially converted FuBar module to LibRock, deprecated it (going to remove it entirely later) - cleaned up a couple other tidbits
author Flick <flickerstreak@gmail.com>
date Wed, 02 Apr 2008 23:31:13 +0000
parents 21bcaf8215ff
children 27dde2743f43
rev   line source
flickerstreak@25 1 --[[
flickerstreak@25 2 ReAction 'Hide Blizzard' module
flickerstreak@25 3
flickerstreak@25 4 Hides Blizzard action bars. This hides the extra action bars, stance bar, pet bar, and
flickerstreak@25 5 main menu bar, which in turn hides the experience bar, bag bar, micro menu bar, and lag meter.
flickerstreak@25 6
flickerstreak@25 7 --]]
flickerstreak@25 8
flickerstreak@25 9 -- local imports
flickerstreak@25 10 local ReAction = ReAction
flickerstreak@25 11 local L = ReAction.L
flickerstreak@25 12 local _G = _G
flickerstreak@25 13
flickerstreak@25 14 -- module declaration
flickerstreak@25 15 local moduleID = "HideBlizzard"
flickerstreak@25 16 local module = ReAction:NewModule( moduleID )
flickerstreak@25 17
flickerstreak@25 18
flickerstreak@25 19 -- module methods
flickerstreak@25 20 function module:OnInitialize()
flickerstreak@28 21 self.db = ReAction.db:RegisterNamespace( moduleID,
flickerstreak@25 22 {
flickerstreak@28 23 profile = {
flickerstreak@28 24 hide = false
flickerstreak@28 25 }
flickerstreak@25 26 }
flickerstreak@25 27 )
flickerstreak@28 28 self.db.RegisterCallback(self,"OnProfileChanged")
flickerstreak@25 29
flickerstreak@25 30 self.hiddenFrame = CreateFrame("Frame")
flickerstreak@25 31 self.hiddenFrame:Hide()
flickerstreak@25 32 end
flickerstreak@25 33
flickerstreak@25 34 function module:OnEnable()
flickerstreak@25 35 if self.db.profile.hide then
flickerstreak@25 36 self:HideAll(true)
flickerstreak@25 37 end
flickerstreak@30 38 ReAction:RegisterOptions("global", self, {
flickerstreak@30 39 hideBlizzard = {
flickerstreak@30 40 type = "toggle",
flickerstreak@30 41 handler = self,
flickerstreak@30 42 name = L["Hide Blizzard Action Bars"],
flickerstreak@30 43 desc = L["Hide the default main bar and extra action bars"],
flickerstreak@30 44 get = "IsHidden",
flickerstreak@30 45 set = function(info,value) self:SetHidden(value) end,
flickerstreak@30 46 disabled = InCombatLockdown
flickerstreak@30 47 }
flickerstreak@30 48 })
flickerstreak@25 49 end
flickerstreak@25 50
flickerstreak@25 51 function module:OnDisable()
flickerstreak@25 52 self:ShowAll(true)
flickerstreak@25 53 end
flickerstreak@25 54
flickerstreak@28 55 function module:OnProfileChanged()
flickerstreak@25 56 if self.db.profile.hide then
flickerstreak@28 57 module:HideAll(true)
flickerstreak@25 58 else
flickerstreak@28 59 module:ShowAll(true)
flickerstreak@25 60 end
flickerstreak@25 61 end
flickerstreak@25 62
flickerstreak@25 63 local frames = {
flickerstreak@25 64 MainMenuBar,
flickerstreak@25 65 PetActionButton1,
flickerstreak@25 66 PetActionButton2,
flickerstreak@25 67 PetActionButton3,
flickerstreak@25 68 PetActionButton4,
flickerstreak@25 69 PetActionButton5,
flickerstreak@25 70 PetActionButton6,
flickerstreak@25 71 PetActionButton7,
flickerstreak@25 72 PetActionButton8,
flickerstreak@25 73 PetActionButton9,
flickerstreak@25 74 PetActionButton10,
flickerstreak@25 75 BonusActionBarFrame,
flickerstreak@25 76 ShapeshiftBarFrame,
flickerstreak@25 77 MultiBarLeft,
flickerstreak@25 78 MultiBarRight,
flickerstreak@25 79 MultiBarBottomLeft,
flickerstreak@25 80 MultiBarBottomRight,
flickerstreak@25 81 SlidingActionBarTexture0,
flickerstreak@25 82 SlidingActionBarTexture1,
flickerstreak@25 83 }
flickerstreak@25 84
flickerstreak@25 85 local hidden = { }
flickerstreak@25 86
flickerstreak@25 87 function module:HideAll( force )
flickerstreak@25 88 if not(self.db.profile.hide) or force then
flickerstreak@25 89 self.db.profile.hide = true
flickerstreak@25 90 -- the pet bar is a child of MainMenuBar, but can't be permanently hidden because it will
flickerstreak@25 91 -- break automatic pet bar show/hide. Need to reparent it instead.
flickerstreak@25 92 PetActionBarFrame:SetParent(UIParent)
flickerstreak@25 93 -- for some odd reason PetActionBarFrame has mouse input enabled even though it has no mouse
flickerstreak@25 94 -- input handlers. Because of this it can potentially trap mouse clicks from getting through
flickerstreak@25 95 -- to things behind it. It's not feasible to move it, either, since UIParent_ManageFramePositions()
flickerstreak@25 96 -- will move it back to its original position whenever it's called.
flickerstreak@25 97 PetActionBarFrame:EnableMouse(false)
flickerstreak@25 98
flickerstreak@25 99 for _, f in pairs(frames) do
flickerstreak@25 100 hidden[f] = hidden[f] or { parent = f:GetParent(), wasShown = f:IsShown() }
flickerstreak@25 101 f:SetParent(self.hiddenFrame)
flickerstreak@25 102 f:Hide()
flickerstreak@25 103 end
flickerstreak@25 104 end
flickerstreak@25 105 end
flickerstreak@25 106
flickerstreak@25 107 function module:ShowAll( force )
flickerstreak@25 108 if self.db.profile.hide or force then
flickerstreak@25 109 self.db.profile.hide = false
flickerstreak@25 110
flickerstreak@25 111 PetActionBarFrame:SetParent(MainMenuBar)
flickerstreak@25 112 for _, f in pairs(frames) do
flickerstreak@25 113 local h = hidden[f]
flickerstreak@25 114 if h then
flickerstreak@25 115 f:SetParent(h.parent)
flickerstreak@25 116 if h.wasShown then
flickerstreak@25 117 f:Show()
flickerstreak@25 118 end
flickerstreak@25 119 end
flickerstreak@25 120 end
flickerstreak@25 121 end
flickerstreak@25 122 end
flickerstreak@25 123
flickerstreak@25 124 function module:IsHidden()
flickerstreak@25 125 return self.db.profile.hide
flickerstreak@25 126 end
flickerstreak@25 127
flickerstreak@25 128 function module:SetHidden(h)
flickerstreak@25 129 if h then
flickerstreak@25 130 self:HideAll()
flickerstreak@25 131 else
flickerstreak@25 132 self:ShowAll()
flickerstreak@25 133 end
flickerstreak@25 134 end
flickerstreak@25 135