|
Tercio@11
|
1
|
|
Tercio@20
|
2 local major, minor = "DetailsFramework-1.0", 5
|
|
Tercio@11
|
3 local DF, oldminor = LibStub:NewLibrary (major, minor)
|
|
Tercio@11
|
4
|
|
Tercio@18
|
5 if (not DF) then
|
|
Tercio@20
|
6 DetailsFrameworkCanLoad = false
|
|
Tercio@11
|
7 return
|
|
Tercio@11
|
8 end
|
|
Tercio@11
|
9
|
|
Tercio@20
|
10 DetailsFrameworkCanLoad = true
|
|
Tercio@18
|
11
|
|
Tercio@11
|
12 local _type = type
|
|
Tercio@11
|
13 local _unpack = unpack
|
|
Tercio@11
|
14 local _
|
|
Tercio@11
|
15 local upper = string.upper
|
|
Tercio@11
|
16
|
|
Tercio@11
|
17 DF.LabelNameCounter = 1
|
|
Tercio@11
|
18 DF.PictureNameCounter = 1
|
|
Tercio@11
|
19 DF.BarNameCounter = 1
|
|
Tercio@11
|
20 DF.DropDownCounter = 1
|
|
Tercio@11
|
21 DF.PanelCounter = 1
|
|
Tercio@11
|
22 DF.ButtonCounter = 1
|
|
Tercio@11
|
23 DF.SliderCounter = 1
|
|
Tercio@11
|
24 DF.SplitBarCounter = 1
|
|
Tercio@11
|
25
|
|
Tercio@11
|
26 do
|
|
Tercio@11
|
27 local path = string.match (debugstack (1, 1, 0), "AddOns\\(.+)fw.lua")
|
|
Tercio@11
|
28 if (path) then
|
|
Tercio@11
|
29 DF.folder = "Interface\\AddOns\\" .. path
|
|
Tercio@11
|
30 else
|
|
Tercio@11
|
31 DF.folder = ""
|
|
Tercio@11
|
32 end
|
|
Tercio@11
|
33 end
|
|
Tercio@11
|
34
|
|
Tercio@11
|
35 DF.debug = false
|
|
Tercio@11
|
36
|
|
Tercio@11
|
37 _G ["DetailsFramework"] = DF
|
|
Tercio@11
|
38
|
|
Tercio@11
|
39 DF.embeds = DF.embeds or {}
|
|
Tercio@11
|
40 local embed_functions = {
|
|
Tercio@20
|
41 "RemoveRealName",
|
|
Tercio@20
|
42 "table",
|
|
Tercio@20
|
43 "BuildDropDownFontList",
|
|
Tercio@11
|
44 "SetFontSize",
|
|
Tercio@11
|
45 "SetFontFace",
|
|
Tercio@11
|
46 "SetFontColor",
|
|
Tercio@11
|
47 "GetFontSize",
|
|
Tercio@11
|
48 "GetFontFace",
|
|
Tercio@17
|
49 "SetFontOutline",
|
|
Tercio@11
|
50 "trim",
|
|
Tercio@11
|
51 "Msg",
|
|
Tercio@11
|
52 "CreateFlashAnimation",
|
|
Tercio@11
|
53 "Fade",
|
|
Tercio@11
|
54 "NewColor",
|
|
Tercio@11
|
55 "IsHtmlColor",
|
|
Tercio@11
|
56 "ParseColors",
|
|
Tercio@11
|
57 "BuildMenu",
|
|
Tercio@11
|
58 "ShowTutorialAlertFrame",
|
|
Tercio@11
|
59 "GetNpcIdFromGuid",
|
|
Tercio@11
|
60 "ShowFeedbackPanel",
|
|
Tercio@20
|
61 "SetAsOptionsPanel",
|
|
Tercio@11
|
62
|
|
Tercio@11
|
63 "CreateDropDown",
|
|
Tercio@11
|
64 "CreateButton",
|
|
Tercio@11
|
65 "CreateColorPickButton",
|
|
Tercio@11
|
66 "CreateLabel",
|
|
Tercio@11
|
67 "CreateBar",
|
|
Tercio@11
|
68 "CreatePanel",
|
|
Tercio@11
|
69 "CreateFillPanel",
|
|
Tercio@11
|
70 "ColorPick",
|
|
Tercio@11
|
71 "IconPick",
|
|
Tercio@11
|
72 "CreateSimplePanel",
|
|
Tercio@11
|
73 "CreateChartPanel",
|
|
Tercio@11
|
74 "CreateImage",
|
|
Tercio@11
|
75 "CreateScrollBar",
|
|
Tercio@11
|
76 "CreateSwitch",
|
|
Tercio@11
|
77 "CreateSlider",
|
|
Tercio@11
|
78 "CreateSplitBar",
|
|
Tercio@11
|
79 "CreateTextEntry",
|
|
Tercio@11
|
80 "Create1PxPanel",
|
|
Tercio@11
|
81 "CreateFeedbackButton",
|
|
Tercio@20
|
82 "CreateOptionsFrame",
|
|
Tercio@20
|
83 "ShowPromptPanel",
|
|
Tercio@11
|
84 "www_icons",
|
|
Tercio@11
|
85 }
|
|
Tercio@11
|
86
|
|
Tercio@20
|
87 DF.table = {}
|
|
Tercio@20
|
88
|
|
Tercio@20
|
89 function DF.table.reverse (t)
|
|
Tercio@20
|
90 local new = {}
|
|
Tercio@20
|
91 local index = 1
|
|
Tercio@20
|
92 for i = #t, 1, -1 do
|
|
Tercio@20
|
93 new [index] = t[i]
|
|
Tercio@20
|
94 index = index + 1
|
|
Tercio@20
|
95 end
|
|
Tercio@20
|
96 return new
|
|
Tercio@20
|
97 end
|
|
Tercio@20
|
98
|
|
Tercio@20
|
99 --> copy from table2 to table1 overwriting values
|
|
Tercio@20
|
100 function DF.table.copy (t1, t2)
|
|
Tercio@20
|
101 for key, value in pairs (t2) do
|
|
Tercio@20
|
102 if (type (value) == "table") then
|
|
Tercio@20
|
103 t1 [key] = t1 [key] or {}
|
|
Tercio@20
|
104 DF.table.copy (t1 [key], t2 [key])
|
|
Tercio@20
|
105 else
|
|
Tercio@20
|
106 t1 [key] = value
|
|
Tercio@20
|
107 end
|
|
Tercio@20
|
108 end
|
|
Tercio@20
|
109 return t1
|
|
Tercio@20
|
110 end
|
|
Tercio@20
|
111
|
|
Tercio@20
|
112 --> copy values that does exist on table2 but not on table1
|
|
Tercio@20
|
113 function DF.table.deploy (t1, t2)
|
|
Tercio@20
|
114 for key, value in pairs (t2) do
|
|
Tercio@20
|
115 if (type (value) == "table") then
|
|
Tercio@20
|
116 t1 [key] = t1 [key] or {}
|
|
Tercio@20
|
117 DF.table.deploy (t1 [key], t2 [key])
|
|
Tercio@20
|
118 elseif (not t1 [key]) then
|
|
Tercio@20
|
119 t1 [key] = value
|
|
Tercio@20
|
120 end
|
|
Tercio@20
|
121 end
|
|
Tercio@20
|
122 end
|
|
Tercio@20
|
123
|
|
Tercio@20
|
124 function DF.table.dump (t, s, deep)
|
|
Tercio@20
|
125 s = s or ""
|
|
Tercio@20
|
126 deep = deep or 0
|
|
Tercio@20
|
127 local space = ""
|
|
Tercio@20
|
128 for i = 1, deep do
|
|
Tercio@20
|
129 space = space .. " "
|
|
Tercio@20
|
130 end
|
|
Tercio@20
|
131 for key, value in pairs (t) do
|
|
Tercio@20
|
132 local tpe = _type (value)
|
|
Tercio@20
|
133 if (type (key) ~= "string") then
|
|
Tercio@20
|
134 key = "unknown?"
|
|
Tercio@20
|
135 end
|
|
Tercio@20
|
136 if (tpe == "table") then
|
|
Tercio@20
|
137 s = s .. space .. "[" .. key .. "] = |cFFa9ffa9table {|r\n"
|
|
Tercio@20
|
138 s = s .. DF.table.dump (value, nil, deep+1)
|
|
Tercio@20
|
139 s = s .. space .. "|cFFa9ffa9}|r\n"
|
|
Tercio@20
|
140 elseif (tpe == "string") then
|
|
Tercio@20
|
141 s = s .. space .. "[" .. key .. "] = '|cFFfff1c1" .. value .. "|r'\n"
|
|
Tercio@20
|
142 elseif (tpe == "number") then
|
|
Tercio@20
|
143 s = s .. space .. "[" .. key .. "] = |cFFffc1f4" .. value .. "|r\n"
|
|
Tercio@20
|
144 elseif (tpe == "function") then
|
|
Tercio@20
|
145 s = s .. space .. "[" .. key .. "] = function()\n"
|
|
Tercio@20
|
146 elseif (tpe == "boolean") then
|
|
Tercio@20
|
147 s = s .. space .. "[" .. key .. "] = |cFF99d0ff" .. (value and "true" or "false") .. "|r\n"
|
|
Tercio@20
|
148 end
|
|
Tercio@20
|
149 end
|
|
Tercio@20
|
150 return s
|
|
Tercio@20
|
151 end
|
|
Tercio@20
|
152
|
|
Tercio@11
|
153 DF.www_icons = {
|
|
Tercio@11
|
154 texture = "feedback_sites",
|
|
Tercio@11
|
155 wowi = {0, 0.7890625, 0, 37/128},
|
|
Tercio@11
|
156 curse = {0, 0.7890625, 38/123, 79/128},
|
|
Tercio@11
|
157 mmoc = {0, 0.7890625, 80/123, 123/128},
|
|
Tercio@11
|
158 }
|
|
Tercio@11
|
159
|
|
Tercio@11
|
160 function DF:Embed (target)
|
|
Tercio@11
|
161 for k, v in pairs (embed_functions) do
|
|
Tercio@11
|
162 target[v] = self[v]
|
|
Tercio@11
|
163 end
|
|
Tercio@11
|
164 self.embeds [target] = true
|
|
Tercio@11
|
165 return target
|
|
Tercio@11
|
166 end
|
|
Tercio@11
|
167
|
|
Tercio@20
|
168 function DF:RemoveRealName (name)
|
|
Tercio@20
|
169 return name:gsub (("%-.*"), "")
|
|
Tercio@20
|
170 end
|
|
Tercio@20
|
171
|
|
Tercio@11
|
172 function DF:SetFontSize (fontString, ...)
|
|
Tercio@11
|
173 local fonte, _, flags = fontString:GetFont()
|
|
Tercio@11
|
174 fontString:SetFont (fonte, max (...), flags)
|
|
Tercio@11
|
175 end
|
|
Tercio@11
|
176 function DF:SetFontFace (fontString, fontface)
|
|
Tercio@11
|
177 local _, size, flags = fontString:GetFont()
|
|
Tercio@11
|
178 fontString:SetFont (fontface, size, flags)
|
|
Tercio@11
|
179 end
|
|
Tercio@11
|
180 function DF:SetFontColor (fontString, r, g, b, a)
|
|
Tercio@11
|
181 r, g, b, a = DF:ParseColors (r, g, b, a)
|
|
Tercio@11
|
182 fontString:SetTextColor (r, g, b, a)
|
|
Tercio@11
|
183 end
|
|
Tercio@11
|
184
|
|
Tercio@11
|
185 function DF:GetFontSize (fontString)
|
|
Tercio@11
|
186 local _, size = fontString:GetFont()
|
|
Tercio@11
|
187 return size
|
|
Tercio@11
|
188 end
|
|
Tercio@11
|
189 function DF:GetFontFace (fontString)
|
|
Tercio@11
|
190 local fontface = fontString:GetFont()
|
|
Tercio@11
|
191 return fontface
|
|
Tercio@11
|
192 end
|
|
Tercio@11
|
193
|
|
Tercio@11
|
194 function DF:SetFontOutline (fontString, outline)
|
|
Tercio@11
|
195 local fonte, size = fontString:GetFont()
|
|
Tercio@11
|
196 if (outline) then
|
|
Tercio@11
|
197 if (_type (outline) == "boolean" and outline) then
|
|
Tercio@11
|
198 outline = "OUTLINE"
|
|
Tercio@11
|
199 elseif (outline == 1) then
|
|
Tercio@11
|
200 outline = "OUTLINE"
|
|
Tercio@11
|
201 elseif (outline == 2) then
|
|
Tercio@11
|
202 outline = "THICKOUTLINE"
|
|
Tercio@11
|
203 end
|
|
Tercio@11
|
204 end
|
|
Tercio@11
|
205
|
|
Tercio@11
|
206 fontString:SetFont (fonte, size, outline)
|
|
Tercio@11
|
207 end
|
|
Tercio@11
|
208
|
|
Tercio@11
|
209 function DF:trim (s)
|
|
Tercio@11
|
210 local from = s:match"^%s*()"
|
|
Tercio@11
|
211 return from > #s and "" or s:match(".*%S", from)
|
|
Tercio@11
|
212 end
|
|
Tercio@11
|
213
|
|
Tercio@11
|
214 function DF:Msg (msg)
|
|
Tercio@11
|
215 print ("|cFFFFFFAA" .. self.__name .. "|r " .. msg)
|
|
Tercio@11
|
216 end
|
|
Tercio@11
|
217
|
|
Tercio@11
|
218 function DF:GetNpcIdFromGuid (guid)
|
|
Tercio@11
|
219 local NpcId = select ( 6, strsplit ( "-", guid ) )
|
|
Tercio@11
|
220 if (NpcId) then
|
|
Tercio@11
|
221 return tonumber ( NpcId )
|
|
Tercio@11
|
222 end
|
|
Tercio@11
|
223 return 0
|
|
Tercio@11
|
224 end
|
|
Tercio@11
|
225
|
|
Tercio@11
|
226 local onFinish = function (self)
|
|
Tercio@11
|
227 if (self.showWhenDone) then
|
|
Tercio@11
|
228 self.frame:SetAlpha (1)
|
|
Tercio@11
|
229 else
|
|
Tercio@11
|
230 self.frame:SetAlpha (0)
|
|
Tercio@11
|
231 self.frame:Hide()
|
|
Tercio@11
|
232 end
|
|
Tercio@11
|
233
|
|
Tercio@11
|
234 if (self.onFinishFunc) then
|
|
Tercio@11
|
235 self:onFinishFunc (self.frame)
|
|
Tercio@11
|
236 end
|
|
Tercio@11
|
237 end
|
|
Tercio@11
|
238
|
|
Tercio@11
|
239 local stop = function (self)
|
|
Tercio@11
|
240 local FlashAnimation = self.FlashAnimation
|
|
Tercio@11
|
241 FlashAnimation:Stop()
|
|
Tercio@11
|
242 end
|
|
Tercio@11
|
243
|
|
Tercio@11
|
244 local flash = function (self, fadeInTime, fadeOutTime, flashDuration, showWhenDone, flashInHoldTime, flashOutHoldTime, loopType)
|
|
Tercio@11
|
245
|
|
Tercio@11
|
246 local FlashAnimation = self.FlashAnimation
|
|
Tercio@11
|
247
|
|
Tercio@11
|
248 local fadeIn = FlashAnimation.fadeIn
|
|
Tercio@11
|
249 local fadeOut = FlashAnimation.fadeOut
|
|
Tercio@11
|
250
|
|
Tercio@11
|
251 fadeIn:Stop()
|
|
Tercio@11
|
252 fadeOut:Stop()
|
|
Tercio@11
|
253
|
|
Tercio@11
|
254 fadeIn:SetDuration (fadeInTime or 1)
|
|
Tercio@11
|
255 fadeIn:SetEndDelay (flashInHoldTime or 0)
|
|
Tercio@11
|
256
|
|
Tercio@11
|
257 fadeOut:SetDuration (fadeOutTime or 1)
|
|
Tercio@11
|
258 fadeOut:SetEndDelay (flashOutHoldTime or 0)
|
|
Tercio@11
|
259
|
|
Tercio@11
|
260 FlashAnimation.duration = flashDuration
|
|
Tercio@11
|
261 FlashAnimation.loopTime = FlashAnimation:GetDuration()
|
|
Tercio@11
|
262 FlashAnimation.finishAt = GetTime() + flashDuration
|
|
Tercio@11
|
263 FlashAnimation.showWhenDone = showWhenDone
|
|
Tercio@11
|
264
|
|
Tercio@11
|
265 FlashAnimation:SetLooping (loopType or "REPEAT")
|
|
Tercio@11
|
266
|
|
Tercio@11
|
267 self:Show()
|
|
Tercio@11
|
268 self:SetAlpha (0)
|
|
Tercio@11
|
269 FlashAnimation:Play()
|
|
Tercio@11
|
270 end
|
|
Tercio@11
|
271
|
|
Tercio@11
|
272 function DF:CreateFlashAnimation (frame, onFinishFunc, onLoopFunc)
|
|
Tercio@11
|
273 local FlashAnimation = frame:CreateAnimationGroup()
|
|
Tercio@11
|
274
|
|
Tercio@11
|
275 FlashAnimation.fadeOut = FlashAnimation:CreateAnimation ("Alpha") --> fade out anime
|
|
Tercio@11
|
276 FlashAnimation.fadeOut:SetOrder (1)
|
|
Tercio@11
|
277 FlashAnimation.fadeOut:SetChange (1)
|
|
Tercio@11
|
278
|
|
Tercio@11
|
279 FlashAnimation.fadeIn = FlashAnimation:CreateAnimation ("Alpha") --> fade in anime
|
|
Tercio@11
|
280 FlashAnimation.fadeIn:SetOrder (2)
|
|
Tercio@11
|
281 FlashAnimation.fadeIn:SetChange (-1)
|
|
Tercio@11
|
282
|
|
Tercio@11
|
283 frame.FlashAnimation = FlashAnimation
|
|
Tercio@11
|
284 FlashAnimation.frame = frame
|
|
Tercio@11
|
285 FlashAnimation.onFinishFunc = onFinishFunc
|
|
Tercio@11
|
286
|
|
Tercio@11
|
287 FlashAnimation:SetScript ("OnLoop", onLoopFunc)
|
|
Tercio@11
|
288 FlashAnimation:SetScript ("OnFinished", onFinish)
|
|
Tercio@11
|
289
|
|
Tercio@11
|
290 frame.Flash = flash
|
|
Tercio@11
|
291 frame.Stop = stop
|
|
Tercio@11
|
292 end
|
|
Tercio@11
|
293
|
|
Tercio@11
|
294 -----------------------------------------
|
|
Tercio@11
|
295
|
|
Tercio@11
|
296 local fade_IN_finished_func = function (frame)
|
|
Tercio@11
|
297 if (frame.fading_in) then
|
|
Tercio@11
|
298 frame.hidden = true
|
|
Tercio@11
|
299 frame.faded = true
|
|
Tercio@11
|
300 frame.fading_in = false
|
|
Tercio@11
|
301 frame:Hide()
|
|
Tercio@11
|
302 end
|
|
Tercio@11
|
303 end
|
|
Tercio@11
|
304
|
|
Tercio@11
|
305 local fade_OUT_finished_func = function (frame)
|
|
Tercio@11
|
306 if (frame:IsShown() and frame.fading_out) then
|
|
Tercio@11
|
307 frame.hidden = false
|
|
Tercio@11
|
308 frame.faded = false
|
|
Tercio@11
|
309 frame.fading_out = false
|
|
Tercio@11
|
310 else
|
|
Tercio@11
|
311 frame:SetAlpha(0)
|
|
Tercio@11
|
312 end
|
|
Tercio@11
|
313 end
|
|
Tercio@11
|
314
|
|
Tercio@11
|
315 local just_fade_func = function (frame)
|
|
Tercio@11
|
316 frame.hidden = false
|
|
Tercio@11
|
317 frame.faded = true
|
|
Tercio@11
|
318 frame.fading_in = false
|
|
Tercio@11
|
319 end
|
|
Tercio@11
|
320
|
|
Tercio@11
|
321 local anim_OUT_alpha_func = function (frame)
|
|
Tercio@11
|
322 frame.fading_out = false
|
|
Tercio@11
|
323 end
|
|
Tercio@11
|
324
|
|
Tercio@11
|
325 local anim_IN_alpha_func = function (frame)
|
|
Tercio@11
|
326 frame.fading_in = false
|
|
Tercio@11
|
327 end
|
|
Tercio@11
|
328
|
|
Tercio@11
|
329 function DF:Fade (frame, tipo, velocidade, parametros)
|
|
Tercio@11
|
330
|
|
Tercio@11
|
331 if (_type (frame) == "table") then
|
|
Tercio@11
|
332 if (frame.dframework) then
|
|
Tercio@11
|
333 frame = frame.widget
|
|
Tercio@11
|
334 end
|
|
Tercio@11
|
335 end
|
|
Tercio@11
|
336
|
|
Tercio@11
|
337 velocidade = velocidade or 0.3
|
|
Tercio@11
|
338
|
|
Tercio@11
|
339 if (upper (tipo) == "IN") then
|
|
Tercio@11
|
340
|
|
Tercio@11
|
341 if (frame:GetAlpha() == 0 and frame.hidden and not frame.fading_out) then --> ja esta escondida
|
|
Tercio@11
|
342 return
|
|
Tercio@11
|
343 elseif (frame.fading_in) then --> ja esta com uma animação, se for true
|
|
Tercio@11
|
344 return
|
|
Tercio@11
|
345 end
|
|
Tercio@11
|
346
|
|
Tercio@11
|
347 if (frame.fading_out) then --> se tiver uma animação de aparecer em andamento se for true
|
|
Tercio@11
|
348 frame.fading_out = false
|
|
Tercio@11
|
349 end
|
|
Tercio@11
|
350
|
|
Tercio@11
|
351 UIFrameFadeIn (frame, velocidade, frame:GetAlpha(), 0)
|
|
Tercio@11
|
352 frame.fading_in = true
|
|
Tercio@11
|
353
|
|
Tercio@11
|
354 frame.fadeInfo.finishedFunc = fade_IN_finished_func
|
|
Tercio@11
|
355 frame.fadeInfo.finishedArg1 = frame
|
|
Tercio@11
|
356
|
|
Tercio@11
|
357 elseif (upper (tipo) == "OUT") then --> aparecer
|
|
Tercio@11
|
358 if (frame:GetAlpha() == 1 and not frame.hidden and not frame.fading_in) then --> ja esta na tela
|
|
Tercio@11
|
359 return
|
|
Tercio@11
|
360 elseif (frame.fading_out) then --> já ta com fading out
|
|
Tercio@11
|
361 return
|
|
Tercio@11
|
362 end
|
|
Tercio@11
|
363
|
|
Tercio@11
|
364 if (frame.fading_in) then --> se tiver uma animação de hidar em andamento se for true
|
|
Tercio@11
|
365 frame.fading_in = false
|
|
Tercio@11
|
366 end
|
|
Tercio@11
|
367
|
|
Tercio@11
|
368 frame:Show()
|
|
Tercio@11
|
369 UIFrameFadeOut (frame, velocidade, frame:GetAlpha(), 1.0)
|
|
Tercio@11
|
370 frame.fading_out = true
|
|
Tercio@11
|
371
|
|
Tercio@11
|
372 frame.fadeInfo.finishedFunc = fade_OUT_finished_func
|
|
Tercio@11
|
373 frame.fadeInfo.finishedArg1 = frame
|
|
Tercio@11
|
374
|
|
Tercio@11
|
375 elseif (tipo == 0) then --> força o frame a ser mostrado
|
|
Tercio@11
|
376 frame.hidden = false
|
|
Tercio@11
|
377 frame.faded = false
|
|
Tercio@11
|
378 frame.fading_out = false
|
|
Tercio@11
|
379 frame.fading_in = false
|
|
Tercio@11
|
380 frame:Show()
|
|
Tercio@11
|
381 frame:SetAlpha (1)
|
|
Tercio@11
|
382
|
|
Tercio@11
|
383 elseif (tipo == 1) then --> força o frame a ser hidado
|
|
Tercio@11
|
384 frame.hidden = true
|
|
Tercio@11
|
385 frame.faded = true
|
|
Tercio@11
|
386 frame.fading_out = false
|
|
Tercio@11
|
387 frame.fading_in = false
|
|
Tercio@11
|
388 frame:SetAlpha (0)
|
|
Tercio@11
|
389 frame:Hide()
|
|
Tercio@11
|
390
|
|
Tercio@11
|
391 elseif (tipo == -1) then --> apenas da fade sem hidar
|
|
Tercio@11
|
392 if (frame:GetAlpha() == 0 and frame.hidden and not frame.fading_out) then --> ja esta escondida
|
|
Tercio@11
|
393 return
|
|
Tercio@11
|
394 elseif (frame.fading_in) then --> ja esta com uma animação, se for true
|
|
Tercio@11
|
395 return
|
|
Tercio@11
|
396 end
|
|
Tercio@11
|
397
|
|
Tercio@11
|
398 if (frame.fading_out) then --> se tiver uma animação de aparecer em andamento se for true
|
|
Tercio@11
|
399 frame.fading_out = false
|
|
Tercio@11
|
400 end
|
|
Tercio@11
|
401
|
|
Tercio@11
|
402 UIFrameFadeIn (frame, velocidade, frame:GetAlpha(), 0)
|
|
Tercio@11
|
403 frame.fading_in = true
|
|
Tercio@11
|
404 frame.fadeInfo.finishedFunc = just_fade_func
|
|
Tercio@11
|
405 frame.fadeInfo.finishedArg1 = frame
|
|
Tercio@11
|
406
|
|
Tercio@11
|
407 elseif (upper (tipo) == "ALPHAANIM") then
|
|
Tercio@11
|
408
|
|
Tercio@11
|
409 local value = velocidade
|
|
Tercio@11
|
410 local currentApha = frame:GetAlpha()
|
|
Tercio@11
|
411 frame:Show()
|
|
Tercio@11
|
412
|
|
Tercio@11
|
413 if (currentApha < value) then
|
|
Tercio@11
|
414 if (frame.fading_in) then --> se tiver uma animação de hidar em andamento se for true
|
|
Tercio@11
|
415 frame.fading_in = false
|
|
Tercio@11
|
416 frame.fadeInfo.finishedFunc = nil
|
|
Tercio@11
|
417 end
|
|
Tercio@11
|
418 UIFrameFadeOut (frame, 0.3, currentApha, value)
|
|
Tercio@11
|
419 frame.fading_out = true
|
|
Tercio@11
|
420
|
|
Tercio@11
|
421 frame.fadeInfo.finishedFunc = anim_OUT_alpha_func
|
|
Tercio@11
|
422 frame.fadeInfo.finishedArg1 = frame
|
|
Tercio@11
|
423
|
|
Tercio@11
|
424 else
|
|
Tercio@11
|
425 if (frame.fading_out) then --> se tiver uma animação de hidar em andamento se for true
|
|
Tercio@11
|
426 frame.fading_out = false
|
|
Tercio@11
|
427 frame.fadeInfo.finishedFunc = nil
|
|
Tercio@11
|
428 end
|
|
Tercio@11
|
429 UIFrameFadeIn (frame, 0.3, currentApha, value)
|
|
Tercio@11
|
430 frame.fading_in = true
|
|
Tercio@11
|
431
|
|
Tercio@11
|
432 frame.fadeInfo.finishedFunc = anim_IN_alpha_func
|
|
Tercio@11
|
433 frame.fadeInfo.finishedArg1 = frame
|
|
Tercio@11
|
434 end
|
|
Tercio@11
|
435
|
|
Tercio@11
|
436 elseif (upper (tipo) == "ALPHA") then --> setando um alpha determinado
|
|
Tercio@11
|
437 if (frame.fading_in or frame.fading_out) then
|
|
Tercio@11
|
438 frame.fadeInfo.finishedFunc = nil
|
|
Tercio@11
|
439 UIFrameFadeIn (frame, velocidade, frame:GetAlpha(), frame:GetAlpha())
|
|
Tercio@11
|
440 end
|
|
Tercio@11
|
441 frame.hidden = false
|
|
Tercio@11
|
442 frame.faded = false
|
|
Tercio@11
|
443 frame.fading_in = false
|
|
Tercio@11
|
444 frame.fading_out = false
|
|
Tercio@11
|
445 frame:Show()
|
|
Tercio@11
|
446 frame:SetAlpha (velocidade)
|
|
Tercio@11
|
447 end
|
|
Tercio@11
|
448 end
|
|
Tercio@11
|
449
|
|
Tercio@11
|
450 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@11
|
451 --> points
|
|
Tercio@11
|
452
|
|
Tercio@11
|
453 function DF:CheckPoints (v1, v2, v3, v4, v5, object)
|
|
Tercio@11
|
454
|
|
Tercio@11
|
455 if (not v1 and not v2) then
|
|
Tercio@11
|
456 return "topleft", object.widget:GetParent(), "topleft", 0, 0
|
|
Tercio@11
|
457 end
|
|
Tercio@11
|
458
|
|
Tercio@11
|
459 if (_type (v1) == "string") then
|
|
Tercio@11
|
460 local frameGlobal = _G [v1]
|
|
Tercio@11
|
461 if (frameGlobal and frameGlobal.GetObjectType) then
|
|
Tercio@11
|
462 return DF:CheckPoints (frameGlobal, v2, v3, v4, v5, object)
|
|
Tercio@11
|
463 end
|
|
Tercio@11
|
464
|
|
Tercio@11
|
465 elseif (_type (v2) == "string") then
|
|
Tercio@11
|
466 local frameGlobal = _G [v2]
|
|
Tercio@11
|
467 if (frameGlobal and frameGlobal.GetObjectType) then
|
|
Tercio@11
|
468 return DF:CheckPoints (v1, frameGlobal, v3, v4, v5, object)
|
|
Tercio@11
|
469 end
|
|
Tercio@11
|
470 end
|
|
Tercio@11
|
471
|
|
Tercio@11
|
472 if (_type (v1) == "string" and _type (v2) == "table") then --> :setpoint ("left", frame, _, _, _)
|
|
Tercio@11
|
473 if (not v3 or _type (v3) == "number") then --> :setpoint ("left", frame, 10, 10)
|
|
Tercio@11
|
474 v1, v2, v3, v4, v5 = v1, v2, v1, v3, v4
|
|
Tercio@11
|
475 end
|
|
Tercio@11
|
476
|
|
Tercio@11
|
477 elseif (_type (v1) == "string" and _type (v2) == "number") then --> :setpoint ("topleft", x, y)
|
|
Tercio@11
|
478 v1, v2, v3, v4, v5 = v1, object.widget:GetParent(), v1, v2, v3
|
|
Tercio@11
|
479
|
|
Tercio@11
|
480 elseif (_type (v1) == "number") then --> :setpoint (x, y)
|
|
Tercio@11
|
481 v1, v2, v3, v4, v5 = "topleft", object.widget:GetParent(), "topleft", v1, v2
|
|
Tercio@11
|
482
|
|
Tercio@11
|
483 elseif (_type (v1) == "table") then --> :setpoint (frame, x, y)
|
|
Tercio@11
|
484 v1, v2, v3, v4, v5 = "topleft", v1, "topleft", v2, v3
|
|
Tercio@11
|
485
|
|
Tercio@11
|
486 end
|
|
Tercio@11
|
487
|
|
Tercio@11
|
488 if (not v2) then
|
|
Tercio@11
|
489 v2 = object.widget:GetParent()
|
|
Tercio@11
|
490 elseif (v2.dframework) then
|
|
Tercio@11
|
491 v2 = v2.widget
|
|
Tercio@11
|
492 end
|
|
Tercio@11
|
493
|
|
Tercio@11
|
494 return v1 or "topleft", v2, v3 or "topleft", v4 or 0, v5 or 0
|
|
Tercio@11
|
495 end
|
|
Tercio@11
|
496
|
|
Tercio@11
|
497
|
|
Tercio@11
|
498 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@11
|
499 --> colors
|
|
Tercio@11
|
500
|
|
Tercio@11
|
501 function DF:NewColor (_colorname, _colortable, _green, _blue, _alpha)
|
|
Tercio@11
|
502 assert (_type (_colorname) == "string", "NewColor: colorname must be a string.")
|
|
Tercio@11
|
503 assert (not DF.alias_text_colors [_colorname], "NewColor: colorname already exists.")
|
|
Tercio@11
|
504
|
|
Tercio@11
|
505 if (_type (_colortable) == "table") then
|
|
Tercio@11
|
506 if (_colortable[1] and _colortable[2] and _colortable[3]) then
|
|
Tercio@11
|
507 _colortable[4] = _colortable[4] or 1
|
|
Tercio@11
|
508 DF.alias_text_colors [_colorname] = _colortable
|
|
Tercio@11
|
509 else
|
|
Tercio@11
|
510 error ("invalid color table.")
|
|
Tercio@11
|
511 end
|
|
Tercio@11
|
512 elseif (_colortable and _green and _blue) then
|
|
Tercio@11
|
513 _alpha = _alpha or 1
|
|
Tercio@11
|
514 DF.alias_text_colors [_colorname] = {_colortable, _green, _blue, _alpha}
|
|
Tercio@11
|
515 else
|
|
Tercio@11
|
516 error ("invalid parameter.")
|
|
Tercio@11
|
517 end
|
|
Tercio@11
|
518
|
|
Tercio@11
|
519 return true
|
|
Tercio@11
|
520 end
|
|
Tercio@11
|
521
|
|
Tercio@11
|
522 function DF:IsHtmlColor (color)
|
|
Tercio@11
|
523 return DF.alias_text_colors [color]
|
|
Tercio@11
|
524 end
|
|
Tercio@11
|
525
|
|
Tercio@11
|
526 local tn = tonumber
|
|
Tercio@11
|
527 function DF:ParseColors (_arg1, _arg2, _arg3, _arg4)
|
|
Tercio@11
|
528 if (_type (_arg1) == "table") then
|
|
Tercio@11
|
529 _arg1, _arg2, _arg3, _arg4 = _unpack (_arg1)
|
|
Tercio@11
|
530
|
|
Tercio@11
|
531 elseif (_type (_arg1) == "string") then
|
|
Tercio@11
|
532
|
|
Tercio@11
|
533 if (string.find (_arg1, "#")) then
|
|
Tercio@11
|
534 _arg1 = _arg1:gsub ("#","")
|
|
Tercio@11
|
535 if (string.len (_arg1) == 8) then --alpha
|
|
Tercio@11
|
536 _arg1, _arg2, _arg3, _arg4 = tn ("0x" .. _arg1:sub (3, 4))/255, tn ("0x" .. _arg1:sub (5, 6))/255, tn ("0x" .. _arg1:sub (7, 8))/255, tn ("0x" .. _arg1:sub (1, 2))/255
|
|
Tercio@11
|
537 else
|
|
Tercio@11
|
538 _arg1, _arg2, _arg3, _arg4 = tn ("0x" .. _arg1:sub (1, 2))/255, tn ("0x" .. _arg1:sub (3, 4))/255, tn ("0x" .. _arg1:sub (5, 6))/255, 1
|
|
Tercio@11
|
539 end
|
|
Tercio@11
|
540
|
|
Tercio@11
|
541 else
|
|
Tercio@11
|
542 local color = DF.alias_text_colors [_arg1]
|
|
Tercio@11
|
543 if (color) then
|
|
Tercio@11
|
544 _arg1, _arg2, _arg3, _arg4 = _unpack (color)
|
|
Tercio@11
|
545 else
|
|
Tercio@11
|
546 _arg1, _arg2, _arg3, _arg4 = _unpack (DF.alias_text_colors.none)
|
|
Tercio@11
|
547 end
|
|
Tercio@11
|
548 end
|
|
Tercio@11
|
549 end
|
|
Tercio@11
|
550
|
|
Tercio@11
|
551 if (not _arg1) then
|
|
Tercio@11
|
552 _arg1 = 1
|
|
Tercio@11
|
553 end
|
|
Tercio@11
|
554 if (not _arg2) then
|
|
Tercio@11
|
555 _arg2 = 1
|
|
Tercio@11
|
556 end
|
|
Tercio@11
|
557 if (not _arg3) then
|
|
Tercio@11
|
558 _arg3 = 1
|
|
Tercio@11
|
559 end
|
|
Tercio@11
|
560 if (not _arg4) then
|
|
Tercio@11
|
561 _arg4 = 1
|
|
Tercio@11
|
562 end
|
|
Tercio@11
|
563
|
|
Tercio@11
|
564 return _arg1, _arg2, _arg3, _arg4
|
|
Tercio@11
|
565 end
|
|
Tercio@11
|
566
|
|
Tercio@11
|
567 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@11
|
568 --> menus
|
|
Tercio@11
|
569
|
|
Tercio@20
|
570 function DF:BuildMenu (parent, menu, x_offset, y_offset, height, use_two_points)
|
|
Tercio@11
|
571
|
|
Tercio@11
|
572 local cur_x = x_offset
|
|
Tercio@11
|
573 local cur_y = y_offset
|
|
Tercio@11
|
574 local max_x = 0
|
|
Tercio@11
|
575
|
|
Tercio@11
|
576 height = abs ((height or parent:GetHeight()) - abs (y_offset) + 20)
|
|
Tercio@11
|
577 height = height*-1
|
|
Tercio@11
|
578
|
|
Tercio@11
|
579 for index, widget_table in ipairs (menu) do
|
|
Tercio@11
|
580
|
|
Tercio@20
|
581 if (widget_table.type == "blank" or widget_table.type == "space") then
|
|
Tercio@20
|
582 -- do nothing
|
|
Tercio@20
|
583
|
|
Tercio@20
|
584 elseif (widget_table.type == "label" or widget_table.type == "text") then
|
|
Tercio@20
|
585 local label = DF:CreateLabel (parent, widget_table.get() or widget_table.text, widget_table.text_template or widget_table.size, widget_table.color, widget_table.font, nil, "$parentWidget" .. index, "overlay")
|
|
Tercio@20
|
586 label._get = widget_table.get
|
|
Tercio@20
|
587 label.widget_type = "label"
|
|
Tercio@20
|
588 label:SetPoint (cur_x, cur_y)
|
|
Tercio@20
|
589 tinsert (parent.widget_list, label)
|
|
Tercio@20
|
590
|
|
Tercio@20
|
591 elseif (widget_table.type == "select" or widget_table.type == "dropdown") then
|
|
Tercio@20
|
592 local dropdown = DF:NewDropDown (parent, nil, "$parentWidget" .. index, nil, 140, 18, widget_table.values, widget_table.get())
|
|
Tercio@11
|
593 dropdown.tooltip = widget_table.desc
|
|
Tercio@20
|
594 dropdown._get = widget_table.get
|
|
Tercio@20
|
595 dropdown.widget_type = "select"
|
|
Tercio@20
|
596 local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or 12)
|
|
Tercio@11
|
597 dropdown:SetPoint ("left", label, "right", 2)
|
|
Tercio@11
|
598 label:SetPoint (cur_x, cur_y)
|
|
Tercio@11
|
599
|
|
Tercio@11
|
600 local size = label.widget:GetStringWidth() + 140 + 4
|
|
Tercio@11
|
601 if (size > max_x) then
|
|
Tercio@11
|
602 max_x = size
|
|
Tercio@11
|
603 end
|
|
Tercio@11
|
604
|
|
Tercio@20
|
605 tinsert (parent.widget_list, dropdown)
|
|
Tercio@20
|
606
|
|
Tercio@11
|
607 elseif (widget_table.type == "toggle" or widget_table.type == "switch") then
|
|
Tercio@20
|
608 local switch = DF:NewSwitch (parent, nil, "$parentWidget" .. index, nil, 60, 20, nil, nil, widget_table.get())
|
|
Tercio@11
|
609 switch.tooltip = widget_table.desc
|
|
Tercio@20
|
610 switch._get = widget_table.get
|
|
Tercio@20
|
611 switch.widget_type = "toggle"
|
|
Tercio@11
|
612 switch.OnSwitch = widget_table.set
|
|
Tercio@11
|
613
|
|
Tercio@20
|
614 local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or 12)
|
|
Tercio@11
|
615 switch:SetPoint ("left", label, "right", 2)
|
|
Tercio@11
|
616 label:SetPoint (cur_x, cur_y)
|
|
Tercio@11
|
617
|
|
Tercio@11
|
618 local size = label.widget:GetStringWidth() + 60 + 4
|
|
Tercio@11
|
619 if (size > max_x) then
|
|
Tercio@11
|
620 max_x = size
|
|
Tercio@11
|
621 end
|
|
Tercio@11
|
622
|
|
Tercio@20
|
623 tinsert (parent.widget_list, switch)
|
|
Tercio@20
|
624
|
|
Tercio@11
|
625 elseif (widget_table.type == "range" or widget_table.type == "slider") then
|
|
Tercio@11
|
626 local is_decimanls = widget_table.usedecimals
|
|
Tercio@20
|
627 local slider = DF:NewSlider (parent, nil, "$parentWidget" .. index, nil, 140, 20, widget_table.min, widget_table.max, widget_table.step, widget_table.get(), is_decimanls)
|
|
Tercio@11
|
628 slider.tooltip = widget_table.desc
|
|
Tercio@20
|
629 slider._get = widget_table.get
|
|
Tercio@20
|
630 slider.widget_type = "range"
|
|
Tercio@11
|
631 slider:SetHook ("OnValueChange", widget_table.set)
|
|
Tercio@11
|
632
|
|
Tercio@20
|
633 local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or 12)
|
|
Tercio@11
|
634 slider:SetPoint ("left", label, "right", 2)
|
|
Tercio@11
|
635 label:SetPoint (cur_x, cur_y)
|
|
Tercio@11
|
636
|
|
Tercio@11
|
637 local size = label.widget:GetStringWidth() + 140 + 6
|
|
Tercio@11
|
638 if (size > max_x) then
|
|
Tercio@11
|
639 max_x = size
|
|
Tercio@11
|
640 end
|
|
Tercio@11
|
641
|
|
Tercio@20
|
642 tinsert (parent.widget_list, slider)
|
|
Tercio@20
|
643
|
|
Tercio@11
|
644 elseif (widget_table.type == "color" or widget_table.type == "color") then
|
|
Tercio@20
|
645 local colorpick = DF:NewColorPickButton (parent, "$parentWidget" .. index, nil, widget_table.set)
|
|
Tercio@11
|
646 colorpick.tooltip = widget_table.desc
|
|
Tercio@20
|
647 colorpick._get = widget_table.get
|
|
Tercio@20
|
648 colorpick.widget_type = "color"
|
|
Tercio@11
|
649
|
|
Tercio@11
|
650 local default_value, g, b, a = widget_table.get()
|
|
Tercio@11
|
651 if (type (default_value) == "table") then
|
|
Tercio@11
|
652 colorpick:SetColor (unpack (default_value))
|
|
Tercio@11
|
653 else
|
|
Tercio@11
|
654 colorpick:SetColor (default_value, g, b, a)
|
|
Tercio@11
|
655 end
|
|
Tercio@11
|
656
|
|
Tercio@20
|
657 local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or 12)
|
|
Tercio@11
|
658 colorpick:SetPoint ("left", label, "right", 2)
|
|
Tercio@11
|
659 label:SetPoint (cur_x, cur_y)
|
|
Tercio@11
|
660
|
|
Tercio@11
|
661 local size = label.widget:GetStringWidth() + 60 + 4
|
|
Tercio@11
|
662 if (size > max_x) then
|
|
Tercio@11
|
663 max_x = size
|
|
Tercio@11
|
664 end
|
|
Tercio@11
|
665
|
|
Tercio@20
|
666 tinsert (parent.widget_list, colorpick)
|
|
Tercio@20
|
667
|
|
Tercio@11
|
668 elseif (widget_table.type == "execute" or widget_table.type == "button") then
|
|
Tercio@11
|
669
|
|
Tercio@20
|
670 local button = DF:NewButton (parent, nil, "$parentWidget", nil, 120, 18, widget_table.func, widget_table.param1, widget_table.param2, nil, widget_table.name)
|
|
Tercio@11
|
671 button:InstallCustomTexture()
|
|
Tercio@11
|
672 button:SetPoint (cur_x, cur_y)
|
|
Tercio@11
|
673 button.tooltip = widget_table.desc
|
|
Tercio@20
|
674 button.widget_type = "execute"
|
|
Tercio@11
|
675
|
|
Tercio@11
|
676 local size = button:GetWidth() + 4
|
|
Tercio@11
|
677 if (size > max_x) then
|
|
Tercio@11
|
678 max_x = size
|
|
Tercio@11
|
679 end
|
|
Tercio@11
|
680
|
|
Tercio@20
|
681 tinsert (parent.widget_list, button)
|
|
Tercio@20
|
682
|
|
Tercio@11
|
683 end
|
|
Tercio@11
|
684
|
|
Tercio@11
|
685 if (widget_table.spacement) then
|
|
Tercio@11
|
686 cur_y = cur_y - 30
|
|
Tercio@11
|
687 else
|
|
Tercio@11
|
688 cur_y = cur_y - 20
|
|
Tercio@11
|
689 end
|
|
Tercio@11
|
690
|
|
Tercio@11
|
691 if (cur_y < height) then
|
|
Tercio@11
|
692 cur_y = y_offset
|
|
Tercio@11
|
693 cur_x = cur_x + max_x + 30
|
|
Tercio@11
|
694
|
|
Tercio@11
|
695 max_x = 0
|
|
Tercio@11
|
696 end
|
|
Tercio@11
|
697
|
|
Tercio@11
|
698 end
|
|
Tercio@11
|
699
|
|
Tercio@11
|
700 end
|
|
Tercio@11
|
701
|
|
Tercio@11
|
702 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@11
|
703 --> tutorials
|
|
Tercio@11
|
704
|
|
Tercio@11
|
705 function DF:ShowTutorialAlertFrame (maintext, desctext, clickfunc)
|
|
Tercio@11
|
706
|
|
Tercio@11
|
707 local TutorialAlertFrame = _G.DetailsFrameworkTutorialAlertFrame
|
|
Tercio@11
|
708
|
|
Tercio@11
|
709 if (not TutorialAlertFrame) then
|
|
Tercio@11
|
710
|
|
Tercio@11
|
711 TutorialAlertFrame = CreateFrame ("ScrollFrame", "DetailsFrameworkTutorialAlertFrame", UIParent, "DetailsFrameworkTutorialAlertFrameTemplate")
|
|
Tercio@11
|
712 TutorialAlertFrame.isFirst = true
|
|
Tercio@11
|
713 TutorialAlertFrame:SetPoint ("left", UIParent, "left", -20, 100)
|
|
Tercio@11
|
714
|
|
Tercio@11
|
715 TutorialAlertFrame:SetWidth (290)
|
|
Tercio@11
|
716 TutorialAlertFrame.ScrollChild:SetWidth (256)
|
|
Tercio@11
|
717
|
|
Tercio@11
|
718 local scrollname = TutorialAlertFrame.ScrollChild:GetName()
|
|
Tercio@11
|
719 _G [scrollname .. "BorderTopLeft"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
720 _G [scrollname .. "BorderTopRight"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
721 _G [scrollname .. "BorderBotLeft"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
722 _G [scrollname .. "BorderBotRight"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
723 _G [scrollname .. "BorderLeft"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
724 _G [scrollname .. "BorderRight"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
725 _G [scrollname .. "BorderBottom"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
726 _G [scrollname .. "BorderTop"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
727
|
|
Tercio@11
|
728 local iconbg = _G [scrollname .. "QuestIconBg"]
|
|
Tercio@11
|
729 iconbg:SetTexture ([[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]])
|
|
Tercio@11
|
730 iconbg:SetTexCoord (0, 1, 0, 1)
|
|
Tercio@11
|
731 iconbg:SetSize (100, 100)
|
|
Tercio@11
|
732 iconbg:ClearAllPoints()
|
|
Tercio@11
|
733 iconbg:SetPoint ("bottomleft", TutorialAlertFrame.ScrollChild, "bottomleft")
|
|
Tercio@11
|
734
|
|
Tercio@11
|
735 _G [scrollname .. "Exclamation"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
736 _G [scrollname .. "QuestionMark"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
737
|
|
Tercio@11
|
738 _G [scrollname .. "TopText"]:SetText ("Details!") --string
|
|
Tercio@11
|
739 _G [scrollname .. "QuestName"]:SetText ("") --string
|
|
Tercio@11
|
740 _G [scrollname .. "BottomText"]:SetText ("") --string
|
|
Tercio@11
|
741
|
|
Tercio@11
|
742 TutorialAlertFrame.ScrollChild.IconShine:SetTexture ([[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]])
|
|
Tercio@11
|
743
|
|
Tercio@11
|
744 TutorialAlertFrame:SetScript ("OnMouseUp", function (self)
|
|
Tercio@11
|
745 if (self.clickfunc and type (self.clickfunc) == "function") then
|
|
Tercio@11
|
746 self.clickfunc()
|
|
Tercio@11
|
747 end
|
|
Tercio@11
|
748 self:Hide()
|
|
Tercio@11
|
749 end)
|
|
Tercio@11
|
750 TutorialAlertFrame:Hide()
|
|
Tercio@11
|
751 end
|
|
Tercio@11
|
752
|
|
Tercio@11
|
753 if (type (maintext) == "string") then
|
|
Tercio@11
|
754 TutorialAlertFrame.ScrollChild.QuestName:SetText (maintext)
|
|
Tercio@11
|
755 else
|
|
Tercio@11
|
756 TutorialAlertFrame.ScrollChild.QuestName:SetText ("")
|
|
Tercio@11
|
757 end
|
|
Tercio@11
|
758
|
|
Tercio@11
|
759 if (type (desctext) == "string") then
|
|
Tercio@11
|
760 TutorialAlertFrame.ScrollChild.BottomText:SetText (desctext)
|
|
Tercio@11
|
761 else
|
|
Tercio@11
|
762 TutorialAlertFrame.ScrollChild.BottomText:SetText ("")
|
|
Tercio@11
|
763 end
|
|
Tercio@11
|
764
|
|
Tercio@11
|
765 TutorialAlertFrame.clickfunc = clickfunc
|
|
Tercio@11
|
766 TutorialAlertFrame:Show()
|
|
Tercio@11
|
767 DetailsTutorialAlertFrame_SlideInFrame (TutorialAlertFrame, "AUTOQUEST")
|
|
Tercio@11
|
768 end
|
|
Tercio@11
|
769
|
|
Tercio@20
|
770 local refresh_options = function (self)
|
|
Tercio@20
|
771 for _, widget in ipairs (self.widget_list) do
|
|
Tercio@20
|
772 if (widget._get) then
|
|
Tercio@20
|
773 if (widget.widget_type == "label") then
|
|
Tercio@20
|
774 if (widget._get()) then
|
|
Tercio@20
|
775 widget:SetText (widget._get())
|
|
Tercio@20
|
776 end
|
|
Tercio@20
|
777 elseif (widget.widget_type == "select") then
|
|
Tercio@20
|
778 widget:Select (widget._get())
|
|
Tercio@20
|
779 elseif (widget.widget_type == "toggle" or widget.widget_type == "range") then
|
|
Tercio@20
|
780 widget:SetValue (widget._get())
|
|
Tercio@20
|
781 elseif (widget.widget_type == "color") then
|
|
Tercio@20
|
782 local default_value, g, b, a = widget._get()
|
|
Tercio@20
|
783 if (type (default_value) == "table") then
|
|
Tercio@20
|
784 widget:SetColor (unpack (default_value))
|
|
Tercio@20
|
785 else
|
|
Tercio@20
|
786 widget:SetColor (default_value, g, b, a)
|
|
Tercio@20
|
787 end
|
|
Tercio@20
|
788 end
|
|
Tercio@20
|
789 end
|
|
Tercio@20
|
790 end
|
|
Tercio@20
|
791 end
|
|
Tercio@20
|
792
|
|
Tercio@20
|
793 function DF:SetAsOptionsPanel (frame)
|
|
Tercio@20
|
794 frame.RefreshOptions = refresh_options
|
|
Tercio@20
|
795 frame.widget_list = {}
|
|
Tercio@20
|
796 end
|
|
Tercio@20
|
797
|
|
Tercio@11
|
798 function DF:CreateOptionsFrame (name, title, template)
|
|
Tercio@11
|
799
|
|
Tercio@11
|
800 template = template or 1
|
|
Tercio@11
|
801
|
|
Tercio@11
|
802 if (template == 2) then
|
|
Tercio@11
|
803 local options_frame = CreateFrame ("frame", name, UIParent, "ButtonFrameTemplate")
|
|
Tercio@11
|
804 tinsert (UISpecialFrames, name)
|
|
Tercio@11
|
805 options_frame:SetSize (500, 200)
|
|
Tercio@20
|
806 options_frame.RefreshOptions = refresh_options
|
|
Tercio@20
|
807 options_frame.widget_list = {}
|
|
Tercio@11
|
808
|
|
Tercio@11
|
809 options_frame:SetScript ("OnMouseDown", function(self, button)
|
|
Tercio@11
|
810 if (button == "RightButton") then
|
|
Tercio@11
|
811 if (self.moving) then
|
|
Tercio@11
|
812 self.moving = false
|
|
Tercio@11
|
813 self:StopMovingOrSizing()
|
|
Tercio@11
|
814 end
|
|
Tercio@11
|
815 return options_frame:Hide()
|
|
Tercio@11
|
816 elseif (button == "LeftButton" and not self.moving) then
|
|
Tercio@11
|
817 self.moving = true
|
|
Tercio@11
|
818 self:StartMoving()
|
|
Tercio@11
|
819 end
|
|
Tercio@11
|
820 end)
|
|
Tercio@11
|
821 options_frame:SetScript ("OnMouseUp", function(self)
|
|
Tercio@11
|
822 if (self.moving) then
|
|
Tercio@11
|
823 self.moving = false
|
|
Tercio@11
|
824 self:StopMovingOrSizing()
|
|
Tercio@11
|
825 end
|
|
Tercio@11
|
826 end)
|
|
Tercio@11
|
827
|
|
Tercio@11
|
828 options_frame:SetMovable (true)
|
|
Tercio@11
|
829 options_frame:EnableMouse (true)
|
|
Tercio@11
|
830 options_frame:SetFrameStrata ("DIALOG")
|
|
Tercio@11
|
831 options_frame:SetToplevel (true)
|
|
Tercio@11
|
832
|
|
Tercio@11
|
833 options_frame:Hide()
|
|
Tercio@11
|
834
|
|
Tercio@11
|
835 options_frame:SetPoint ("center", UIParent, "center")
|
|
Tercio@11
|
836 options_frame.TitleText:SetText (title)
|
|
Tercio@11
|
837 options_frame.portrait:SetTexture ([[Interface\CHARACTERFRAME\TEMPORARYPORTRAIT-FEMALE-BLOODELF]])
|
|
Tercio@11
|
838
|
|
Tercio@11
|
839 return options_frame
|
|
Tercio@11
|
840
|
|
Tercio@11
|
841 elseif (template == 1) then
|
|
Tercio@11
|
842
|
|
Tercio@11
|
843 local options_frame = CreateFrame ("frame", name, UIParent)
|
|
Tercio@11
|
844 tinsert (UISpecialFrames, name)
|
|
Tercio@11
|
845 options_frame:SetSize (500, 200)
|
|
Tercio@20
|
846 options_frame.RefreshOptions = refresh_options
|
|
Tercio@20
|
847 options_frame.widget_list = {}
|
|
Tercio@11
|
848
|
|
Tercio@11
|
849 options_frame:SetScript ("OnMouseDown", function(self, button)
|
|
Tercio@11
|
850 if (button == "RightButton") then
|
|
Tercio@11
|
851 if (self.moving) then
|
|
Tercio@11
|
852 self.moving = false
|
|
Tercio@11
|
853 self:StopMovingOrSizing()
|
|
Tercio@11
|
854 end
|
|
Tercio@11
|
855 return options_frame:Hide()
|
|
Tercio@11
|
856 elseif (button == "LeftButton" and not self.moving) then
|
|
Tercio@11
|
857 self.moving = true
|
|
Tercio@11
|
858 self:StartMoving()
|
|
Tercio@11
|
859 end
|
|
Tercio@11
|
860 end)
|
|
Tercio@11
|
861 options_frame:SetScript ("OnMouseUp", function(self)
|
|
Tercio@11
|
862 if (self.moving) then
|
|
Tercio@11
|
863 self.moving = false
|
|
Tercio@11
|
864 self:StopMovingOrSizing()
|
|
Tercio@11
|
865 end
|
|
Tercio@11
|
866 end)
|
|
Tercio@11
|
867
|
|
Tercio@11
|
868 options_frame:SetMovable (true)
|
|
Tercio@11
|
869 options_frame:EnableMouse (true)
|
|
Tercio@11
|
870 options_frame:SetFrameStrata ("DIALOG")
|
|
Tercio@11
|
871 options_frame:SetToplevel (true)
|
|
Tercio@11
|
872
|
|
Tercio@11
|
873 options_frame:Hide()
|
|
Tercio@11
|
874
|
|
Tercio@11
|
875 options_frame:SetPoint ("center", UIParent, "center")
|
|
Tercio@11
|
876
|
|
Tercio@11
|
877 options_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16,
|
|
Tercio@18
|
878 edgeFile = DF.folder .. "border_2", edgeSize = 32,
|
|
Tercio@11
|
879 insets = {left = 1, right = 1, top = 1, bottom = 1}})
|
|
Tercio@11
|
880 options_frame:SetBackdropColor (0, 0, 0, .7)
|
|
Tercio@11
|
881
|
|
Tercio@11
|
882 local texturetitle = options_frame:CreateTexture (nil, "artwork")
|
|
Tercio@11
|
883 texturetitle:SetTexture ([[Interface\CURSOR\Interact]])
|
|
Tercio@11
|
884 texturetitle:SetTexCoord (0, 1, 0, 1)
|
|
Tercio@11
|
885 texturetitle:SetVertexColor (1, 1, 1, 1)
|
|
Tercio@11
|
886 texturetitle:SetPoint ("topleft", options_frame, "topleft", 2, -3)
|
|
Tercio@11
|
887 texturetitle:SetWidth (36)
|
|
Tercio@11
|
888 texturetitle:SetHeight (36)
|
|
Tercio@11
|
889
|
|
Tercio@11
|
890 local title = DF:NewLabel (options_frame, nil, "$parentTitle", nil, title, nil, 20, "yellow")
|
|
Tercio@11
|
891 title:SetPoint ("left", texturetitle, "right", 2, -1)
|
|
Tercio@11
|
892 DF:SetFontOutline (title, true)
|
|
Tercio@11
|
893
|
|
Tercio@11
|
894 local c = CreateFrame ("Button", nil, options_frame, "UIPanelCloseButton")
|
|
Tercio@11
|
895 c:SetWidth (32)
|
|
Tercio@11
|
896 c:SetHeight (32)
|
|
Tercio@11
|
897 c:SetPoint ("TOPRIGHT", options_frame, "TOPRIGHT", -3, -3)
|
|
Tercio@11
|
898 c:SetFrameLevel (options_frame:GetFrameLevel()+1)
|
|
Tercio@11
|
899
|
|
Tercio@11
|
900 return options_frame
|
|
Tercio@11
|
901 end
|
|
Tercio@11
|
902 end |