PageRenderTime 83ms CodeModel.GetById 40ms app.highlight 8ms RepoModel.GetById 32ms app.codeStats 1ms

/Tukui/modules/skins/mail.lua

http://github.com/Asphyxia/Tukui
Lua | 140 lines | 115 code | 23 blank | 2 comment | 6 complexity | 341726c8a76d0901f864a8cd6b884bc0 MD5 | raw file
  1local T, C, L = unpack(select(2, ...))
  2
  3local function LoadSkin()
  4	MailFrame:StripTextures(true)
  5	MailFrame:CreateBackdrop("Transparent")
  6	MailFrame.backdrop:Point("TOPLEFT", 4, 0)
  7	MailFrame.backdrop:Point("BOTTOMRIGHT", 2, 74)
  8	MailFrame.backdrop:CreateShadow("Transparent")
  9	MailFrame:SetWidth(360)
 10
 11	for i = 1, INBOXITEMS_TO_DISPLAY do
 12		local bg = _G["MailItem"..i]
 13		bg:StripTextures()
 14		bg:CreateBackdrop("Transparent")
 15		bg.backdrop:Point("TOPLEFT", 2, 1)
 16		bg.backdrop:Point("BOTTOMRIGHT", -2, 2)
 17		
 18		local b = _G["MailItem"..i.."Button"]
 19		b:StripTextures()
 20		b:SetTemplate("Transparent", true)
 21		b:StyleButton()
 22
 23		local t = _G["MailItem"..i.."ButtonIcon"]
 24		t:SetTexCoord(.08, .92, .08, .92)
 25		t:ClearAllPoints()
 26		t:Point("TOPLEFT", 2, -2)
 27		t:Point("BOTTOMRIGHT", -2, 2)
 28	end
 29
 30	T.SkinCloseButton(InboxCloseButton)
 31	T.SkinNextPrevButton(InboxPrevPageButton)
 32	T.SkinNextPrevButton(InboxNextPageButton)
 33
 34	MailFrameTab1:StripTextures()
 35	MailFrameTab2:StripTextures()
 36	T.SkinTab(MailFrameTab1)
 37	T.SkinTab(MailFrameTab2)
 38
 39	-- send mail
 40	SendMailScrollFrame:StripTextures(true)
 41	SendMailScrollFrame:SetTemplate("Transparent")
 42
 43	T.SkinScrollBar(SendMailScrollFrameScrollBar)
 44
 45	T.SkinEditBox(SendMailNameEditBox)
 46	T.SkinEditBox(SendMailSubjectEditBox)
 47	T.SkinEditBox(SendMailMoneyGold)
 48	T.SkinEditBox(SendMailMoneySilver)
 49	T.SkinEditBox(SendMailMoneyCopper)
 50
 51	SendMailNameEditBox.backdrop:Point("BOTTOMRIGHT", 2, 0)
 52	SendMailSubjectEditBox.backdrop:Point("BOTTOMRIGHT", 2, 0)
 53	SendMailFrame:StripTextures()
 54
 55	local function MailFrameSkin()
 56		for i = 1, ATTACHMENTS_MAX_SEND do				
 57			local b = _G["SendMailAttachment"..i]
 58			if not b.skinned then
 59				b:StripTextures()
 60				b:SetTemplate("Transparent", true)
 61				b:StyleButton()
 62				b.skinned = true
 63			end
 64			local t = b:GetNormalTexture()
 65			if t then
 66				t:SetTexCoord(.08, .92, .08, .92)
 67				t:ClearAllPoints()
 68				t:Point("TOPLEFT", 2, -2)
 69				t:Point("BOTTOMRIGHT", -2, 2)
 70			end
 71		end
 72	end
 73	hooksecurefunc("SendMailFrame_Update", MailFrameSkin)
 74
 75	T.SkinButton(SendMailMailButton)
 76	T.SkinButton(SendMailCancelButton)
 77
 78	-- open mail (cod)
 79	OpenMailFrame:StripTextures(true)
 80	OpenMailFrame:CreateBackdrop("Transparent")
 81	OpenMailFrame.backdrop:Point("TOPLEFT", 4, 0)
 82	OpenMailFrame.backdrop:Point("BOTTOMRIGHT", 2, 74)
 83	OpenMailFrame.backdrop:CreateShadow("Transparent")
 84	OpenMailFrame:SetWidth(360)
 85
 86	T.SkinCloseButton(OpenMailCloseButton)
 87	T.SkinButton(OpenMailReportSpamButton)
 88	T.SkinButton(OpenMailReplyButton)
 89	T.SkinButton(OpenMailDeleteButton)
 90	T.SkinButton(OpenMailCancelButton)
 91	T.SkinButton(TakeAll_Button)
 92	T.SkinButton(TakeCash_Button)
 93
 94	OpenMailScrollFrame:StripTextures(true)
 95	OpenMailScrollFrame:SetTemplate("Transparent")
 96
 97	T.SkinScrollBar(OpenMailScrollFrameScrollBar)
 98
 99	SendMailBodyEditBox:SetTextColor(1, 1, 1)
100	OpenMailBodyText:SetTextColor(1, 1, 1)
101	InvoiceTextFontNormal:SetTextColor(1, 1, 1)
102	OpenMailArithmeticLine:Kill()
103
104	OpenMailLetterButton:StripTextures()
105	OpenMailLetterButton:SetTemplate("Transparent", true)
106	OpenMailLetterButton:StyleButton()
107	OpenMailLetterButtonIconTexture:SetTexCoord(.08, .92, .08, .92)						
108	OpenMailLetterButtonIconTexture:ClearAllPoints()
109	OpenMailLetterButtonIconTexture:Point("TOPLEFT", 2, -2)
110	OpenMailLetterButtonIconTexture:Point("BOTTOMRIGHT", -2, 2)
111
112	OpenMailMoneyButton:StripTextures()
113	OpenMailMoneyButton:SetTemplate("Transparent", true)
114	OpenMailMoneyButton:StyleButton()
115	OpenMailMoneyButtonIconTexture:SetTexCoord(.08, .92, .08, .92)						
116	OpenMailMoneyButtonIconTexture:ClearAllPoints()
117	OpenMailMoneyButtonIconTexture:Point("TOPLEFT", 2, -2)
118	OpenMailMoneyButtonIconTexture:Point("BOTTOMRIGHT", -2, 2)
119
120	for i = 1, ATTACHMENTS_MAX_SEND do				
121		local b = _G["OpenMailAttachmentButton"..i]
122		b:StripTextures()
123		b:SetTemplate("Transparent", true)
124		b:StyleButton()
125		
126		local t = _G["OpenMailAttachmentButton"..i.."IconTexture"]
127		if t then
128			t:SetTexCoord(.08, .92, .08, .92)
129			t:ClearAllPoints()
130			t:Point("TOPLEFT", 2, -2)
131			t:Point("BOTTOMRIGHT", -2, 2)
132		end				
133	end
134
135	OpenMailReplyButton:Point("RIGHT", OpenMailDeleteButton, "LEFT", -2, 0)
136	OpenMailDeleteButton:Point("RIGHT", OpenMailCancelButton, "LEFT", -2, 0)
137	SendMailMailButton:Point("RIGHT", SendMailCancelButton, "LEFT", -2, 0)
138end
139
140tinsert(T.SkinFuncs["Tukui"], LoadSkin)