PageRenderTime 30ms CodeModel.GetById 8ms app.highlight 14ms RepoModel.GetById 2ms app.codeStats 0ms

/Tukui/modules/skins/help.lua

http://github.com/Asphyxia/Tukui
Lua | 139 lines | 112 code | 21 blank | 6 comment | 13 complexity | 57820c8e5170d71c4ac5c73bb2b7cea4 MD5 | raw file
  1local T, C, L = unpack(select(2, ...))
  2
  3local function LoadSkin()
  4	local frames = {
  5		"HelpFrameLeftInset",
  6		"HelpFrameMainInset",
  7		"HelpFrameKnowledgebase",
  8		"HelpFrameHeader",
  9		"HelpFrameKnowledgebaseErrorFrame",
 10	}
 11
 12	local buttons = {
 13		"HelpFrameAccountSecurityOpenTicket",
 14		"HelpFrameReportLagLoot",
 15		"HelpFrameReportLagAuctionHouse",
 16		"HelpFrameReportLagMail",
 17		"HelpFrameReportLagMovement",
 18		"HelpFrameReportLagSpell",
 19		"HelpFrameReportLagChat",
 20		"HelpFrameReportAbuseOpenTicket",
 21		"HelpFrameOpenTicketHelpTopIssues",
 22		"HelpFrameOpenTicketHelpOpenTicket",
 23		"HelpFrameKnowledgebaseSearchButton",
 24		"HelpFrameKnowledgebaseNavBarHomeButton",
 25		"HelpFrameCharacterStuckStuck",
 26		"GMChatOpenLog",
 27		"HelpFrameTicketSubmit",
 28		"HelpFrameTicketCancel",
 29	}
 30
 31	-- skin main frames
 32	for i = 1, #frames do
 33		_G[frames[i]]:StripTextures(true)
 34		_G[frames[i]]:CreateBackdrop("Transparent")
 35	end
 36
 37	HelpFrameHeader:SetFrameLevel(HelpFrameHeader:GetFrameLevel() + 2)
 38	HelpFrameKnowledgebaseErrorFrame:SetFrameLevel(HelpFrameKnowledgebaseErrorFrame:GetFrameLevel() + 2)
 39
 40	HelpFrameTicketScrollFrame:StripTextures()
 41	HelpFrameTicketScrollFrame:CreateBackdrop("Transparent")
 42	HelpFrameTicketScrollFrame.backdrop:Point("TOPLEFT", -4, 4)
 43	HelpFrameTicketScrollFrame.backdrop:Point("BOTTOMRIGHT", 6, -4)
 44	for i=1, HelpFrameTicket:GetNumChildren() do
 45		local child = select(i, HelpFrameTicket:GetChildren())
 46		if not child:GetName() then
 47			child:StripTextures()
 48		end
 49	end
 50
 51	T.SkinScrollBar(HelpFrameKnowledgebaseScrollFrame2ScrollBar)
 52
 53	-- skin sub buttons
 54	for i = 1, #buttons do
 55		_G[buttons[i]]:StripTextures(true)
 56		T.SkinButton(_G[buttons[i]], true)
 57		
 58		if _G[buttons[i]].text then
 59			_G[buttons[i]].text:ClearAllPoints()
 60			_G[buttons[i]].text:SetPoint("CENTER")
 61			_G[buttons[i]].text:SetJustifyH("CENTER")				
 62		end
 63	end
 64
 65	-- skin main buttons
 66	for i = 1, 6 do
 67		local b = _G["HelpFrameButton"..i]
 68		T.SkinButton(b, true)
 69		b.text:ClearAllPoints()
 70		b.text:SetPoint("CENTER")
 71		b.text:SetJustifyH("CENTER")
 72	end	
 73
 74	-- skin table options
 75	for i = 1, HelpFrameKnowledgebaseScrollFrameScrollChild:GetNumChildren() do
 76		local b = _G["HelpFrameKnowledgebaseScrollFrameButton"..i]
 77		b:StripTextures(true)
 78		T.SkinButton(b, true)
 79	end
 80
 81	-- skin misc items
 82	HelpFrameKnowledgebaseSearchBox:ClearAllPoints()
 83	HelpFrameKnowledgebaseSearchBox:Point("TOPLEFT", HelpFrameMainInset, "TOPLEFT", 13, -10)
 84	HelpFrameKnowledgebaseNavBarOverlay:Kill()
 85	HelpFrameKnowledgebaseNavBar:StripTextures()
 86
 87	HelpFrame:StripTextures(true)
 88	HelpFrame:CreateBackdrop("Transparent")
 89	T.SkinEditBox(HelpFrameKnowledgebaseSearchBox)
 90	T.SkinScrollBar(HelpFrameKnowledgebaseScrollFrameScrollBar, 5)
 91	T.SkinScrollBar(HelpFrameTicketScrollFrameScrollBar, 4)
 92	T.SkinCloseButton(HelpFrameCloseButton, HelpFrame.backdrop)	
 93	T.SkinCloseButton(HelpFrameKnowledgebaseErrorFrameCloseButton, HelpFrameKnowledgebaseErrorFrame.backdrop)
 94
 95	--Hearth Stone Button
 96	HelpFrameCharacterStuckHearthstone:StyleButton()
 97	HelpFrameCharacterStuckHearthstone:SetTemplate("Transparent", true)
 98	HelpFrameCharacterStuckHearthstone.IconTexture:ClearAllPoints()
 99	HelpFrameCharacterStuckHearthstone.IconTexture:Point("TOPLEFT", 2, -2)
100	HelpFrameCharacterStuckHearthstone.IconTexture:Point("BOTTOMRIGHT", -2, 2)
101	HelpFrameCharacterStuckHearthstone.IconTexture:SetTexCoord(.08, .92, .08, .92)
102
103	local function navButtonFrameLevel(self)
104		for i=1, #self.navList do
105			local navButton = self.navList[i]
106			local lastNav = self.navList[i-1]
107			if navButton and lastNav then
108				navButton:SetFrameLevel(lastNav:GetFrameLevel() - 2)
109			end
110		end			
111	end
112
113	hooksecurefunc("NavBar_AddButton", function(self, buttonData)
114		local navButton = self.navList[#self.navList]
115		
116		
117		if not navButton.skinned then
118			T.SkinButton(navButton, true)
119			navButton.skinned = true
120			
121			navButton:HookScript("OnClick", function()
122				navButtonFrameLevel(self)
123			end)
124		end
125		
126		navButtonFrameLevel(self)
127	end)
128	
129	T.SkinButton(HelpFrameGM_ResponseNeedMoreHelp)
130	T.SkinButton(HelpFrameGM_ResponseCancel)
131	for i=1, HelpFrameGM_Response:GetNumChildren() do
132		local child = select(i, HelpFrameGM_Response:GetChildren())
133		if child and child:GetObjectType() == "Frame" and not child:GetName() then
134			child:SetTemplate("Transparent")
135		end
136	end
137end
138
139tinsert(T.SkinFuncs["Tukui"], LoadSkin)