PageRenderTime 30ms CodeModel.GetById 24ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Tukui/modules/skins/friends.lua

http://github.com/Asphyxia/Tukui
Lua | 181 lines | 154 code | 20 blank | 7 comment | 9 complexity | 8800eab7ac9ef4280c29993162501acf MD5 | raw file
  1local T, C, L = unpack(select(2, ...))
  2
  3local function LoadSkin()
  4	T.SkinScrollBar(FriendsFrameFriendsScrollFrameScrollBar, 5)
  5	T.SkinScrollBar(WhoListScrollFrameScrollBar, 5)
  6	T.SkinScrollBar(ChannelRosterScrollFrameScrollBar, 5)
  7	local tabs = {
  8		"LeftDisabled",
  9		"MiddleDisabled",
 10		"RightDisabled",
 11		"Left",
 12		"Middle",
 13		"Right",
 14	}
 15	
 16	local function SkinSocialHeaderTab(tab)
 17		if not tab then return end
 18		for _, object in pairs(tabs) do
 19			local tex = _G[tab:GetName()..object]
 20			tex:SetTexture(nil)
 21		end
 22		tab:GetHighlightTexture():SetTexture(nil)
 23		tab.backdrop = CreateFrame("Frame", nil, tab)
 24		tab.backdrop:SetTemplate("Transparent")
 25		tab.backdrop:SetFrameLevel(tab:GetFrameLevel() - 1)
 26		tab.backdrop:Point("TOPLEFT", 3, -8)
 27		tab.backdrop:Point("BOTTOMRIGHT", -6, 0)
 28	end
 29		
 30	local StripAllTextures = {
 31		"FriendsListFrame",
 32		"FriendsTabHeader",
 33		"FriendsFrameFriendsScrollFrame",
 34		"WhoFrameColumnHeader1",
 35		"WhoFrameColumnHeader2",
 36		"WhoFrameColumnHeader3",
 37		"WhoFrameColumnHeader4",
 38		"ChannelListScrollFrame",
 39		"ChannelRoster",
 40		"FriendsFramePendingButton1",
 41		"FriendsFramePendingButton2",
 42		"FriendsFramePendingButton3",
 43		"FriendsFramePendingButton4",
 44		"ChannelFrameDaughterFrame",
 45		"AddFriendFrame",
 46		"AddFriendNoteFrame",
 47		"FriendsFriendsFrame",
 48		"FriendsFriendsList",
 49		"FriendsFriendsNoteFrame",
 50	}			
 51
 52	local KillTextures = {
 53		"FriendsFrameTopLeft",
 54		"FriendsFrameTopRight",
 55		"FriendsFrameBottomLeft",
 56		"FriendsFrameBottomRight",
 57		"ChannelFrameVerticalBar",
 58		"FriendsFrameBroadcastInputLeft",
 59		"FriendsFrameBroadcastInputRight",
 60		"FriendsFrameBroadcastInputMiddle",
 61		"ChannelFrameDaughterFrameChannelNameLeft",
 62		"ChannelFrameDaughterFrameChannelNameRight",
 63		"ChannelFrameDaughterFrameChannelNameMiddle",
 64		"ChannelFrameDaughterFrameChannelPasswordLeft",
 65		"ChannelFrameDaughterFrameChannelPasswordRight",				
 66		"ChannelFrameDaughterFrameChannelPasswordMiddle",			
 67	}
 68
 69	local buttons = {
 70		"FriendsFrameAddFriendButton",
 71		"FriendsFrameSendMessageButton",
 72		"WhoFrameWhoButton",
 73		"WhoFrameAddFriendButton",
 74		"WhoFrameGroupInviteButton",
 75		"ChannelFrameNewButton",
 76		"FriendsFrameIgnorePlayerButton",
 77		"FriendsFrameUnsquelchButton",
 78		"FriendsFramePendingButton1AcceptButton",
 79		"FriendsFramePendingButton1DeclineButton",
 80		"FriendsFramePendingButton2AcceptButton",
 81		"FriendsFramePendingButton2DeclineButton",
 82		"FriendsFramePendingButton3AcceptButton",
 83		"FriendsFramePendingButton3DeclineButton",
 84		"FriendsFramePendingButton4AcceptButton",
 85		"FriendsFramePendingButton4DeclineButton",
 86		"ChannelFrameDaughterFrameOkayButton",
 87		"ChannelFrameDaughterFrameCancelButton",
 88		"AddFriendEntryFrameAcceptButton",
 89		"AddFriendEntryFrameCancelButton",
 90		"AddFriendInfoFrameContinueButton",
 91		"FriendsFriendsSendRequestButton",
 92		"FriendsFriendsCloseButton",
 93	}			
 94
 95	for _, button in pairs(buttons) do
 96		T.SkinButton(_G[button])
 97	end
 98	--Reposition buttons
 99	WhoFrameWhoButton:Point("RIGHT", WhoFrameAddFriendButton, "LEFT", -2, 0)
100	WhoFrameAddFriendButton:Point("RIGHT", WhoFrameGroupInviteButton, "LEFT", -2, 0)
101	WhoFrameGroupInviteButton:Point("BOTTOMRIGHT", WhoFrame, "BOTTOMRIGHT", -44, 82)
102	--Resize Buttons
103	WhoFrameWhoButton:Size(WhoFrameWhoButton:GetWidth() - 4, WhoFrameWhoButton:GetHeight())
104	WhoFrameAddFriendButton:Size(WhoFrameAddFriendButton:GetWidth() - 4, WhoFrameAddFriendButton:GetHeight())
105	WhoFrameGroupInviteButton:Size(WhoFrameGroupInviteButton:GetWidth() - 4, WhoFrameGroupInviteButton:GetHeight())
106	T.SkinEditBox(WhoFrameEditBox)
107	WhoFrameEditBox:Height(WhoFrameEditBox:GetHeight() - 15)
108	WhoFrameEditBox:Point("BOTTOM", WhoFrame, "BOTTOM", -10, 108)
109	WhoFrameEditBox:Width(WhoFrameEditBox:GetWidth() + 17)
110
111	for _, texture in pairs(KillTextures) do
112		_G[texture]:Kill()
113	end
114
115	for _, object in pairs(StripAllTextures) do
116		_G[object]:StripTextures()
117	end
118	FriendsFrame:StripTextures(true)
119
120	T.SkinEditBox(AddFriendNameEditBox)
121	AddFriendFrame:SetTemplate("Transparent")			
122
123	--Who Frame
124	local function UpdateWhoSkins()
125		WhoListScrollFrame:StripTextures()
126	end
127	--Channel Frame
128	local function UpdateChannel()
129		ChannelRosterScrollFrame:StripTextures()
130	end
131	--BNet Frame
132	FriendsFrameBroadcastInput:CreateBackdrop("Transparent")
133	ChannelFrameDaughterFrameChannelName:CreateBackdrop("Transparent")
134	ChannelFrameDaughterFrameChannelPassword:CreateBackdrop("Transparent")			
135
136	ChannelFrame:HookScript("OnShow", UpdateChannel)
137	hooksecurefunc("FriendsFrame_OnEvent", UpdateChannel)
138
139	WhoFrame:HookScript("OnShow", UpdateWhoSkins)
140	hooksecurefunc("FriendsFrame_OnEvent", UpdateWhoSkins)
141
142	ChannelFrameDaughterFrame:CreateBackdrop("Transparent")
143	FriendsFrame:CreateBackdrop("Transparent")
144	FriendsFrame.backdrop:Point( "TOPLEFT", FriendsFrame, "TOPLEFT", 11,-12)
145	FriendsFrame.backdrop:Point( "BOTTOMRIGHT", FriendsFrame, "BOTTOMRIGHT", -35, 76)
146	T.SkinCloseButton(ChannelFrameDaughterFrameDetailCloseButton,ChannelFrameDaughterFrame)
147	T.SkinCloseButton(FriendsFrameCloseButton,FriendsFrame.backdrop)
148	T.SkinDropDownBox(WhoFrameDropDown,150)
149	T.SkinDropDownBox(FriendsFrameStatusDropDown,70)
150
151	--Bottom Tabs
152	for i=1, 4 do
153		T.SkinTab(_G["FriendsFrameTab"..i])
154	end
155
156	for i=1, 3 do
157		SkinSocialHeaderTab(_G["FriendsTabHeaderTab"..i])
158	end
159
160	local function Channel()
161		for i=1, MAX_DISPLAY_CHANNEL_BUTTONS do
162			local button = _G["ChannelButton"..i]
163			if button then
164				button:StripTextures()
165				button:SetHighlightTexture("Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight")
166				
167				_G["ChannelButton"..i.."Text"]:SetFont(C.media.font, 12)
168			end
169		end
170	end
171	hooksecurefunc("ChannelList_Update", Channel)
172	
173	--View Friends BN Frame
174	FriendsFriendsFrame:CreateBackdrop("Transparent")
175
176	T.SkinEditBox(FriendsFriendsList)
177	T.SkinEditBox(FriendsFriendsNoteFrame)
178	T.SkinDropDownBox(FriendsFriendsFrameDropDown,150)
179end
180
181tinsert(T.SkinFuncs["Tukui"], LoadSkin)