/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

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