PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 5ms RepoModel.GetById 35ms app.codeStats 0ms

/Tukui/modules/skins/macro.lua

http://github.com/Asphyxia/Tukui
Lua | 116 lines | 90 code | 20 blank | 6 comment | 7 complexity | 78a616e01aaec88d178a84d68ffb0cb4 MD5 | raw file
  1local T, C, L = unpack(select(2, ...))
  2
  3local function LoadSkin()
  4	T.SkinCloseButton(MacroFrameCloseButton)
  5	
  6	MacroFrame:Width(360)
  7	
  8	local buttons = {
  9		"MacroDeleteButton",
 10		"MacroNewButton",
 11		"MacroSaveButton",
 12		"MacroCancelButton",
 13		"MacroExitButton",
 14		"MacroEditButton",
 15		"MacroFrameTab1",
 16		"MacroFrameTab2",
 17		"MacroPopupOkayButton",
 18		"MacroPopupCancelButton",
 19	}
 20	
 21	for i = 1, #buttons do
 22		_G[buttons[i]]:StripTextures()
 23		T.SkinButton(_G[buttons[i]])
 24	end
 25	
 26	for i = 1, 2 do
 27		tab = _G[format("MacroFrameTab%s", i)]
 28		tab:Height(22)
 29	end
 30	MacroFrameTab1:Point("TOPLEFT", MacroFrame, "TOPLEFT", 85, -39)
 31	MacroFrameTab2:Point("LEFT", MacroFrameTab1, "RIGHT", 4, 0)
 32	
 33
 34	-- General
 35	MacroFrame:StripTextures()
 36	MacroFrame:SetTemplate("Transparent")
 37	MacroFrameTextBackground:StripTextures()
 38	MacroFrameTextBackground:CreateBackdrop()
 39	MacroFrameTextBackground:SetTemplate("Transparent")
 40	MacroButtonScrollFrame:CreateBackdrop()
 41	MacroPopupFrame:StripTextures()
 42	MacroPopupFrame:SetTemplate("Transparent")
 43	MacroPopupScrollFrame:StripTextures()
 44	MacroPopupScrollFrame:CreateBackdrop()
 45	MacroPopupScrollFrame.backdrop:Point("TOPLEFT", 51, 2)
 46	MacroPopupScrollFrame.backdrop:Point("BOTTOMRIGHT", -4, 4)
 47	MacroPopupEditBox:CreateBackdrop()
 48	MacroPopupEditBox:StripTextures()
 49	
 50	--Reposition edit button
 51	MacroEditButton:ClearAllPoints()
 52	MacroEditButton:Point("BOTTOMLEFT", MacroFrameSelectedMacroButton, "BOTTOMRIGHT", 10, 0)
 53	
 54	-- Regular scroll bar
 55	T.SkinScrollBar(MacroButtonScrollFrame)
 56	T.SkinScrollBar(MacroFrameScrollFrameScrollBar)
 57	T.SkinScrollBar(MacroPopupScrollFrameScrollBar)
 58	T.SkinScrollBar(MacroButtonScrollFrameScrollBar)
 59	
 60	MacroPopupFrame:HookScript("OnShow", function(self)
 61		self:ClearAllPoints()
 62		self:Point("TOPLEFT", MacroFrame, "TOPRIGHT", 5, -2)
 63	end)
 64	
 65	-- Big icon
 66	MacroFrameSelectedMacroButton:StripTextures()
 67	MacroFrameSelectedMacroButton:StyleButton(true)
 68	MacroFrameSelectedMacroButton:GetNormalTexture():SetTexture(nil)
 69	MacroFrameSelectedMacroButton:SetTemplate("Transparent")
 70	MacroFrameSelectedMacroButtonIcon:SetTexCoord(.08, .92, .08, .92)
 71	MacroFrameSelectedMacroButtonIcon:ClearAllPoints()
 72	MacroFrameSelectedMacroButtonIcon:Point("TOPLEFT", 2, -2)
 73	MacroFrameSelectedMacroButtonIcon:Point("BOTTOMRIGHT", -2, 2)
 74	
 75	-- temporarily moving this text
 76	MacroFrameCharLimitText:ClearAllPoints()
 77	MacroFrameCharLimitText:Point("BOTTOM", MacroFrameTextBackground, 0, -70)
 78	
 79	-- Skin all buttons
 80	for i = 1, MAX_ACCOUNT_MACROS do
 81		local b = _G["MacroButton"..i]
 82		local t = _G["MacroButton"..i.."Icon"]
 83		local pb = _G["MacroPopupButton"..i]
 84		local pt = _G["MacroPopupButton"..i.."Icon"]
 85		
 86		if b then
 87			b:StripTextures()
 88			b:StyleButton(true)
 89			
 90			b:SetTemplate("Default", true)
 91		end
 92		
 93		if t then
 94			t:SetTexCoord(.08, .92, .08, .92)
 95			t:ClearAllPoints()
 96			t:Point("TOPLEFT", 2, -2)
 97			t:Point("BOTTOMRIGHT", -2, 2)
 98		end
 99
100		if pb then
101			pb:StripTextures()
102			pb:StyleButton(true)
103			
104			pb:SetTemplate("Transparent")					
105		end
106		
107		if pt then
108			pt:SetTexCoord(.08, .92, .08, .92)
109			pt:ClearAllPoints()
110			pt:Point("TOPLEFT", 2, -2)
111			pt:Point("BOTTOMRIGHT", -2, 2)
112		end
113	end
114end
115
116T.SkinFuncs["Blizzard_MacroUI"] = LoadSkin