PageRenderTime 39ms CodeModel.GetById 18ms app.highlight 16ms RepoModel.GetById 1ms app.codeStats 1ms

/Tukui/modules/skins/auction.lua

http://github.com/Asphyxia/Tukui
Lua | 283 lines | 234 code | 43 blank | 6 comment | 9 complexity | ba16c135f6c9856cc2a77bd91f420e88 MD5 | raw file
  1local T, C, L = unpack(select(2, ...))
  2
  3local function LoadSkin()
  4	T.SkinCloseButton(AuctionFrameCloseButton)
  5	AuctionFrame:StripTextures(true)
  6	AuctionFrame:SetTemplate("Transparent")
  7	AuctionFrame:CreateShadow("Transparent")
  8	
  9	BrowseFilterScrollFrame:StripTextures()
 10	BrowseScrollFrame:StripTextures()
 11	AuctionsScrollFrame:StripTextures()
 12	BidScrollFrame:StripTextures()
 13	
 14	T.SkinDropDownBox(BrowseDropDown)
 15	T.SkinDropDownBox(PriceDropDown)
 16	T.SkinDropDownBox(DurationDropDown)
 17	T.SkinScrollBar(BrowseFilterScrollFrameScrollBar)
 18	T.SkinScrollBar(BrowseScrollFrameScrollBar)
 19	
 20	T.SkinCheckBox(IsUsableCheckButton)
 21	T.SkinCheckBox(ShowOnPlayerCheckButton)
 22	
 23	--Dress Up Frame
 24	AuctionDressUpFrame:StripTextures()
 25	AuctionDressUpFrame:SetTemplate("Transparent")
 26	AuctionDressUpFrame:Point("TOPLEFT", AuctionFrame, "TOPRIGHT", 2, 0)
 27	T.SkinButton(AuctionDressUpFrameResetButton)
 28	AuctionDressUpFrameCloseButton:StripTextures()
 29	AuctionDressUpFrameCloseButton:SetNormalTexture(AuctionFrameCloseButton:GetNormalTexture():GetTexture())
 30	AuctionDressUpFrameCloseButton:SetPushedTexture(AuctionFrameCloseButton:GetPushedTexture():GetTexture())
 31	AuctionDressUpFrameCloseButton:SetHighlightTexture(AuctionFrameCloseButton:GetHighlightTexture():GetTexture())
 32	AuctionDressUpFrameCloseButton:SetDisabledTexture(AuctionFrameCloseButton:GetDisabledTexture():GetTexture())
 33	
 34	T.SkinRotateButton(AuctionDressUpModelRotateLeftButton)
 35	T.SkinRotateButton(AuctionDressUpModelRotateRightButton)
 36	AuctionDressUpModelRotateRightButton:Point("TOPLEFT", AuctionDressUpModelRotateLeftButton, "TOPRIGHT", 4, 0)
 37	
 38	--Progress Frame
 39	AuctionProgressFrame:StripTextures()
 40	AuctionProgressFrame:SetTemplate("Transparent")
 41	AuctionProgressFrame:CreateShadow("Transparent")
 42	AuctionProgressFrameCancelButton:StyleButton()
 43	AuctionProgressFrameCancelButton:SetTemplate("Transparent")
 44	AuctionProgressFrameCancelButton:SetHitRectInsets(0, 0, 0, 0)
 45	AuctionProgressFrameCancelButton:GetNormalTexture():ClearAllPoints()
 46	AuctionProgressFrameCancelButton:GetNormalTexture():Point("TOPLEFT", 2, -2)
 47	AuctionProgressFrameCancelButton:GetNormalTexture():Point("BOTTOMRIGHT", -2, 2)
 48	AuctionProgressFrameCancelButton:GetNormalTexture():SetTexCoord(0.67, 0.37, 0.61, 0.26)
 49	AuctionProgressFrameCancelButton:Size(28, 28)
 50	AuctionProgressFrameCancelButton:Point("LEFT", AuctionProgressBar, "RIGHT", 8, 0)
 51	
 52	AuctionProgressBarIcon:SetTexCoord(0.67, 0.37, 0.61, 0.26)
 53	
 54	local backdrop = CreateFrame("Frame", nil, AuctionProgressBarIcon:GetParent())
 55	backdrop:Point("TOPLEFT", AuctionProgressBarIcon, "TOPLEFT", -2, 2)
 56	backdrop:Point("BOTTOMRIGHT", AuctionProgressBarIcon, "BOTTOMRIGHT", 2, -2)
 57	backdrop:SetTemplate("Transparent")
 58	AuctionProgressBarIcon:SetParent(backdrop)
 59	
 60	AuctionProgressBarText:ClearAllPoints()
 61	AuctionProgressBarText:SetPoint("CENTER")
 62	
 63	AuctionProgressBar:StripTextures()
 64	AuctionProgressBar:CreateBackdrop("Transparent")
 65	AuctionProgressBar:SetStatusBarTexture(C["media"].normTex)
 66	AuctionProgressBar:SetStatusBarColor(1, 1, 0)
 67	
 68	T.SkinNextPrevButton(BrowseNextPageButton)
 69	T.SkinNextPrevButton(BrowsePrevPageButton)
 70	
 71	local buttons = {
 72		"BrowseBidButton",
 73		"BidBidButton",
 74		"BrowseBuyoutButton",
 75		"BidBuyoutButton",
 76		"BrowseCloseButton",
 77		"BidCloseButton",
 78		"BrowseSearchButton",
 79		"AuctionsCreateAuctionButton",
 80		"AuctionsCancelAuctionButton",
 81		"AuctionsCloseButton",
 82		"BrowseResetButton",
 83		"AuctionsStackSizeMaxButton",
 84		"AuctionsNumStacksMaxButton",
 85	}
 86	
 87	for _, button in pairs(buttons) do
 88		T.SkinButton(_G[button])
 89	end
 90	
 91	--Fix Button Positions
 92	AuctionsCloseButton:Point("BOTTOMRIGHT", AuctionFrameAuctions, "BOTTOMRIGHT", 66, 10)
 93	AuctionsCancelAuctionButton:Point("RIGHT", AuctionsCloseButton, "LEFT", -4, 0)
 94	BidBuyoutButton:Point("RIGHT", BidCloseButton, "LEFT", -4, 0)
 95	BidBidButton:Point("RIGHT", BidBuyoutButton, "LEFT", -4, 0)
 96	BrowseBuyoutButton:Point("RIGHT", BrowseCloseButton, "LEFT", -4, 0)
 97	BrowseBidButton:Point("RIGHT", BrowseBuyoutButton, "LEFT", -4, 0)		
 98	AuctionsItemButton:StripTextures()
 99	AuctionsItemButton:StyleButton()
100	AuctionsItemButton:SetTemplate("Transparent", true)
101	BrowseResetButton:Point("TOPLEFT", AuctionFrameBrowse, "TOPLEFT", 81, -74)
102	BrowseSearchButton:Point("TOPRIGHT", AuctionFrameBrowse, "TOPRIGHT", 25, -34)
103	
104	AuctionsItemButton:SetScript("OnUpdate", function()
105		if AuctionsItemButton:GetNormalTexture() then
106			AuctionsItemButton:GetNormalTexture():SetTexCoord(.08, .92, .08, .92)
107			AuctionsItemButton:GetNormalTexture():ClearAllPoints()
108			AuctionsItemButton:GetNormalTexture():Point("TOPLEFT", 2, -2)
109			AuctionsItemButton:GetNormalTexture():Point("BOTTOMRIGHT", -2, 2)
110		end
111	end)
112	
113	local sorttabs = {
114		"BrowseQualitySort",
115		"BrowseLevelSort",
116		"BrowseDurationSort",
117		"BrowseHighBidderSort",
118		"BrowseCurrentBidSort",
119		"BidQualitySort",
120		"BidLevelSort",
121		"BidDurationSort",
122		"BidBuyoutSort",
123		"BidStatusSort",
124		"BidBidSort",
125		"AuctionsQualitySort",
126		"AuctionsDurationSort",
127		"AuctionsHighBidderSort",
128		"AuctionsBidSort",
129	}
130	
131	for _, sorttab in pairs(sorttabs) do
132		_G[sorttab.."Left"]:Kill()
133		_G[sorttab.."Middle"]:Kill()
134		_G[sorttab.."Right"]:Kill()
135	end
136	
137	for i=1, 3 do
138		T.SkinTab(_G["AuctionFrameTab"..i])
139	end
140	
141	for i=1, NUM_FILTERS_TO_DISPLAY do
142		local tab = _G["AuctionFilterButton"..i]
143		tab:StripTextures()
144		tab:StyleButton()
145	end
146	
147	local editboxs = {
148		"BrowseName",
149		"BrowseMinLevel",
150		"BrowseMaxLevel",
151		"BrowseBidPriceGold",
152		"BrowseBidPriceSilver",
153		"BrowseBidPriceCopper",
154		"BidBidPriceGold",
155		"BidBidPriceSilver",
156		"BidBidPriceCopper",
157		"AuctionsStackSizeEntry",
158		"AuctionsNumStacksEntry",
159		"StartPriceGold",
160		"StartPriceSilver",
161		"StartPriceCopper",
162		"BuyoutPriceGold",
163		"BuyoutPriceSilver",
164		"BuyoutPriceCopper"			
165	}
166	
167	for _, editbox in pairs(editboxs) do
168		T.SkinEditBox(_G[editbox])
169		_G[editbox]:SetTextInsets(1, 1, -1, 1)
170	end
171	BrowseMaxLevel:Point("LEFT", BrowseMinLevel, "RIGHT", 8, 0)
172	AuctionsStackSizeEntry.backdrop:SetAllPoints()
173	AuctionsNumStacksEntry.backdrop:SetAllPoints()
174	
175	for i=1, NUM_BROWSE_TO_DISPLAY do
176		local button = _G["BrowseButton"..i]
177		local icon = _G["BrowseButton"..i.."Item"]
178		
179		_G["BrowseButton"..i.."ItemIconTexture"]:SetTexCoord(.08, .92, .08, .92)
180		_G["BrowseButton"..i.."ItemIconTexture"]:ClearAllPoints()
181		_G["BrowseButton"..i.."ItemIconTexture"]:Point("TOPLEFT", 2, -2)
182		_G["BrowseButton"..i.."ItemIconTexture"]:Point("BOTTOMRIGHT", -2, 2)
183		
184		icon:StyleButton()
185		--TODO: Find a better method to ensure that the icon:GetNormalTexture doesn't return after clicking
186		icon:HookScript("OnUpdate", function() icon:GetNormalTexture():Kill() end)
187		
188		icon:CreateBackdrop("Transparent")
189		icon.backdrop:SetAllPoints()
190
191		button:StripTextures()
192		button:StyleButton()
193		_G["BrowseButton"..i.."Highlight"] = button:GetHighlightTexture()
194		button:GetHighlightTexture():ClearAllPoints()
195		button:GetHighlightTexture():Point("TOPLEFT", icon, "TOPRIGHT", 2, 0)
196		button:GetHighlightTexture():SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 5)
197		button:GetPushedTexture():SetAllPoints(button:GetHighlightTexture())
198	end
199	
200	for i=1, NUM_AUCTIONS_TO_DISPLAY do
201		local button = _G["AuctionsButton"..i]
202		local icon = _G["AuctionsButton"..i.."Item"]
203		
204		_G["AuctionsButton"..i.."ItemIconTexture"]:SetTexCoord(.08, .92, .08, .92)
205		_G["AuctionsButton"..i.."ItemIconTexture"].SetTexCoord = T.dummy
206		_G["AuctionsButton"..i.."ItemIconTexture"]:ClearAllPoints()
207		_G["AuctionsButton"..i.."ItemIconTexture"]:Point("TOPLEFT", 2, -2)
208		_G["AuctionsButton"..i.."ItemIconTexture"]:Point("BOTTOMRIGHT", -2, 2)
209		
210		icon:StyleButton()
211		--TODO: Find a better method to ensure that the icon:GetNormalTexture doesn't return after clicking
212		icon:HookScript("OnUpdate", function() icon:GetNormalTexture():Kill() end)
213		
214		icon:CreateBackdrop("Transparent")
215		icon.backdrop:SetAllPoints()
216
217		button:StripTextures()
218		button:StyleButton()
219		_G["AuctionsButton"..i.."Highlight"] = button:GetHighlightTexture()
220		button:GetHighlightTexture():ClearAllPoints()
221		button:GetHighlightTexture():Point("TOPLEFT", icon, "TOPRIGHT", 2, 0)
222		button:GetHighlightTexture():SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 5)
223		button:GetPushedTexture():SetAllPoints(button:GetHighlightTexture())		
224	end
225	
226	for i=1, NUM_BIDS_TO_DISPLAY do
227		local button = _G["BidButton"..i]
228		local icon = _G["BidButton"..i.."Item"]
229		
230		_G["BidButton"..i.."ItemIconTexture"]:SetTexCoord(.08, .92, .08, .92)
231		_G["BidButton"..i.."ItemIconTexture"]:ClearAllPoints()
232		_G["BidButton"..i.."ItemIconTexture"]:Point("TOPLEFT", 2, -2)
233		_G["BidButton"..i.."ItemIconTexture"]:Point("BOTTOMRIGHT", -2, 2)
234		
235		icon:StyleButton()
236		icon:HookScript("OnUpdate", function() icon:GetNormalTexture():Kill() end)
237		
238		icon:CreateBackdrop("Transparent")
239		icon.backdrop:SetAllPoints()
240
241		button:StripTextures()
242		button:StyleButton()
243		_G["BidButton"..i.."Highlight"] = button:GetHighlightTexture()
244		button:GetHighlightTexture():ClearAllPoints()
245		button:GetHighlightTexture():Point("TOPLEFT", icon, "TOPRIGHT", 2, 0)
246		button:GetHighlightTexture():SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 5)
247		button:GetPushedTexture():SetAllPoints(button:GetHighlightTexture())			
248	end
249	
250	--Custom Backdrops
251	AuctionFrameBrowse.bg1 = CreateFrame("Frame", nil, AuctionFrameBrowse)
252	AuctionFrameBrowse.bg1:SetTemplate("Transparent")
253	AuctionFrameBrowse.bg1:Point("TOPLEFT", 20, -103)
254	AuctionFrameBrowse.bg1:Point("BOTTOMRIGHT", -575, 40)
255	BrowseFilterScrollFrame:Height(300) --Adjust scrollbar height a little off
256
257	AuctionFrameBrowse.bg2 = CreateFrame("Frame", nil, AuctionFrameBrowse)
258	AuctionFrameBrowse.bg2:SetTemplate("Transparent")
259	AuctionFrameBrowse.bg2:Point("TOPLEFT", AuctionFrameBrowse.bg1, "TOPRIGHT", 4, 0)
260	AuctionFrameBrowse.bg2:Point("BOTTOMRIGHT", AuctionFrame, "BOTTOMRIGHT", -8, 40)
261	BrowseScrollFrame:Height(300) --Adjust scrollbar height a little off
262	
263	AuctionFrameBid.bg = CreateFrame("Frame", nil, AuctionFrameBid)
264	AuctionFrameBid.bg:SetTemplate("Transparent")
265	AuctionFrameBid.bg:Point("TOPLEFT", 22, -72)
266	AuctionFrameBid.bg:Point("BOTTOMRIGHT", 66, 39)
267	BidScrollFrame:Height(332)	
268
269	AuctionsScrollFrame:Height(336)	
270	AuctionFrameAuctions.bg1 = CreateFrame("Frame", nil, AuctionFrameAuctions)
271	AuctionFrameAuctions.bg1:SetTemplate("Transparent")
272	AuctionFrameAuctions.bg1:Point("TOPLEFT", 15, -70)
273	AuctionFrameAuctions.bg1:Point("BOTTOMRIGHT", -545, 35)  
274	AuctionFrameAuctions.bg1:SetFrameLevel(AuctionFrameAuctions.bg1:GetFrameLevel() - 2)	
275	
276	AuctionFrameAuctions.bg2 = CreateFrame("Frame", nil, AuctionFrameAuctions)
277	AuctionFrameAuctions.bg2:SetTemplate("Transparent")
278	AuctionFrameAuctions.bg2:Point("TOPLEFT", AuctionFrameAuctions.bg1, "TOPRIGHT", 3, 0)
279	AuctionFrameAuctions.bg2:Point("BOTTOMRIGHT", AuctionFrame, -8, 35)  
280	AuctionFrameAuctions.bg2:SetFrameLevel(AuctionFrameAuctions.bg2:GetFrameLevel() - 2)		
281end
282
283T.SkinFuncs["Blizzard_AuctionUI"] = LoadSkin