PageRenderTime 112ms CodeModel.GetById 91ms app.highlight 2ms RepoModel.GetById 18ms app.codeStats 0ms

/Tukui/modules/actionbars/Hide.lua

http://github.com/Asphyxia/Tukui
Lua | 60 lines | 47 code | 6 blank | 7 comment | 7 complexity | 3937984ec09fee3ddbb2d8e64c3c1503 MD5 | raw file
 1local T, C, L = unpack(select(2, ...)) -- Import: T - functions, constants, variables; C - config; L - locales
 2if not C["actionbar"].enable == true then return end
 3
 4---------------------------------------------------------------------------
 5-- Hide all Blizzard stuff that we don't need
 6---------------------------------------------------------------------------
 7
 8do
 9	MainMenuBar:SetScale(0.00001)
10	MainMenuBar:EnableMouse(false)
11	VehicleMenuBar:SetScale(0.00001)
12	VehicleMenuBar:EnableMouse(false)
13	PetActionBarFrame:EnableMouse(false)
14	ShapeshiftBarFrame:EnableMouse(false)
15	
16	local elements = {
17		MainMenuBar, MainMenuBarArtFrame, BonusActionBarFrame, VehicleMenuBar,
18		PossessBarFrame, PetActionBarFrame, ShapeshiftBarFrame,
19		ShapeshiftBarLeft, ShapeshiftBarMiddle, ShapeshiftBarRight,
20	}
21	for _, element in pairs(elements) do
22		if element:GetObjectType() == "Frame" then
23			element:UnregisterAllEvents()
24		end
25		
26		-- Because of code changes by Blizzard developer thought 4.0.6 about action bars, we must have MainMenuBar always visible. :X
27		-- MultiActionBar_Update() and IsNormalActionBarState() Blizzard functions make shit thought our bars. (example: Warrior after /rl)
28		-- See 4.0.6 MultiActionBars.lua for more info at line ~25.
29		if element ~= MainMenuBar then
30			element:Hide()
31		end
32		element:SetAlpha(0)
33	end
34	elements = nil
35	
36	-- fix main bar keybind not working after a talent switch. :X
37	hooksecurefunc('TalentFrame_LoadUI', function()
38		PlayerTalentFrame:UnregisterEvent('ACTIVE_TALENT_GROUP_CHANGED')
39	end)
40end
41
42do
43	local uiManagedFrames = {
44		"MultiBarLeft",
45		"MultiBarRight",
46		"MultiBarBottomLeft",
47		"MultiBarBottomRight",
48		"ShapeshiftBarFrame",
49		"PossessBarFrame",
50		"PETACTIONBAR_YPOS",
51		"MultiCastActionBarFrame",
52		"MULTICASTACTIONBAR_YPOS",
53		"ChatFrame1",
54		"ChatFrame2",
55	}
56	for _, frame in pairs(uiManagedFrames) do
57		UIPARENT_MANAGED_FRAME_POSITIONS[frame] = nil
58	end
59	uiManagedFrames = nil
60end