|
Tercio@11
|
1
|
|
Tercio@39
|
2 local dversion = 22
|
|
Tercio@25
|
3 local major, minor = "DetailsFramework-1.0", dversion
|
|
Tercio@11
|
4 local DF, oldminor = LibStub:NewLibrary (major, minor)
|
|
Tercio@11
|
5
|
|
Tercio@18
|
6 if (not DF) then
|
|
Tercio@20
|
7 DetailsFrameworkCanLoad = false
|
|
Tercio@11
|
8 return
|
|
Tercio@11
|
9 end
|
|
Tercio@11
|
10
|
|
Tercio@20
|
11 DetailsFrameworkCanLoad = true
|
|
Tercio@25
|
12 local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0")
|
|
Tercio@18
|
13
|
|
Tercioo@29
|
14 local _
|
|
Tercio@11
|
15 local _type = type
|
|
Tercio@11
|
16 local _unpack = unpack
|
|
Tercio@11
|
17 local upper = string.upper
|
|
Tercio@11
|
18
|
|
Tercioo@29
|
19 --> will always give a very random name for our widgets
|
|
Tercioo@29
|
20 local init_counter = math.random (1, 1000000)
|
|
Tercioo@29
|
21
|
|
Tercioo@29
|
22 DF.LabelNameCounter = DF.LabelNameCounter or init_counter
|
|
Tercioo@29
|
23 DF.PictureNameCounter = DF.PictureNameCounter or init_counter
|
|
Tercioo@29
|
24 DF.BarNameCounter = DF.BarNameCounter or init_counter
|
|
Tercioo@29
|
25 DF.DropDownCounter = DF.DropDownCounter or init_counter
|
|
Tercioo@29
|
26 DF.PanelCounter = DF.PanelCounter or init_counter
|
|
Tercioo@29
|
27 DF.SimplePanelCounter = DF.SimplePanelCounter or init_counter
|
|
Tercioo@29
|
28 DF.ButtonCounter = DF.ButtonCounter or init_counter
|
|
Tercioo@29
|
29 DF.SliderCounter = DF.SliderCounter or init_counter
|
|
Tercioo@29
|
30 DF.SwitchCounter = DF.SwitchCounter or init_counter
|
|
Tercioo@29
|
31 DF.SplitBarCounter = DF.SplitBarCounter or init_counter
|
|
Tercio@11
|
32
|
|
Tercio@39
|
33 DF.FRAMELEVEL_OVERLAY = 750
|
|
Tercio@39
|
34 DF.FRAMELEVEL_BACKGROUND = 150
|
|
Tercio@39
|
35
|
|
Tercio@25
|
36 DF.FrameWorkVersion = tostring (dversion)
|
|
Tercio@25
|
37 function DF:PrintVersion()
|
|
Tercio@25
|
38 print ("Details! Framework Version:", DF.FrameWorkVersion)
|
|
Tercio@25
|
39 end
|
|
Tercio@25
|
40
|
|
Tercio@22
|
41 LibStub:GetLibrary("AceTimer-3.0"):Embed (DF)
|
|
Tercio@22
|
42
|
|
Tercioo@29
|
43 --> get the working folder
|
|
Tercio@11
|
44 do
|
|
Tercio@11
|
45 local path = string.match (debugstack (1, 1, 0), "AddOns\\(.+)fw.lua")
|
|
Tercio@11
|
46 if (path) then
|
|
Tercio@11
|
47 DF.folder = "Interface\\AddOns\\" .. path
|
|
Tercio@11
|
48 else
|
|
Tercioo@29
|
49 --> if not found, try to use the last valid one
|
|
Tercioo@29
|
50 DF.folder = DF.folder or ""
|
|
Tercio@11
|
51 end
|
|
Tercio@11
|
52 end
|
|
Tercio@11
|
53
|
|
Tercio@11
|
54 DF.debug = false
|
|
Tercio@11
|
55
|
|
Tercio@11
|
56 _G ["DetailsFramework"] = DF
|
|
Tercio@11
|
57
|
|
Tercio@11
|
58 DF.embeds = DF.embeds or {}
|
|
Tercio@11
|
59 local embed_functions = {
|
|
Tercio@20
|
60 "RemoveRealName",
|
|
Tercio@20
|
61 "table",
|
|
Tercio@20
|
62 "BuildDropDownFontList",
|
|
Tercio@11
|
63 "SetFontSize",
|
|
Tercio@11
|
64 "SetFontFace",
|
|
Tercio@11
|
65 "SetFontColor",
|
|
Tercio@11
|
66 "GetFontSize",
|
|
Tercio@11
|
67 "GetFontFace",
|
|
Tercio@17
|
68 "SetFontOutline",
|
|
Tercio@11
|
69 "trim",
|
|
Tercio@11
|
70 "Msg",
|
|
Tercio@11
|
71 "CreateFlashAnimation",
|
|
Tercio@11
|
72 "Fade",
|
|
Tercio@11
|
73 "NewColor",
|
|
Tercio@11
|
74 "IsHtmlColor",
|
|
Tercio@11
|
75 "ParseColors",
|
|
Tercio@11
|
76 "BuildMenu",
|
|
Tercio@11
|
77 "ShowTutorialAlertFrame",
|
|
Tercio@11
|
78 "GetNpcIdFromGuid",
|
|
Tercio@11
|
79 "ShowFeedbackPanel",
|
|
Tercio@20
|
80 "SetAsOptionsPanel",
|
|
Tercio@11
|
81
|
|
Tercio@11
|
82 "CreateDropDown",
|
|
Tercio@11
|
83 "CreateButton",
|
|
Tercio@11
|
84 "CreateColorPickButton",
|
|
Tercio@11
|
85 "CreateLabel",
|
|
Tercio@11
|
86 "CreateBar",
|
|
Tercio@11
|
87 "CreatePanel",
|
|
Tercio@11
|
88 "CreateFillPanel",
|
|
Tercio@11
|
89 "ColorPick",
|
|
Tercio@11
|
90 "IconPick",
|
|
Tercio@11
|
91 "CreateSimplePanel",
|
|
Tercio@11
|
92 "CreateChartPanel",
|
|
Tercio@11
|
93 "CreateImage",
|
|
Tercio@11
|
94 "CreateScrollBar",
|
|
Tercio@11
|
95 "CreateSwitch",
|
|
Tercio@11
|
96 "CreateSlider",
|
|
Tercio@11
|
97 "CreateSplitBar",
|
|
Tercio@11
|
98 "CreateTextEntry",
|
|
Tercio@11
|
99 "Create1PxPanel",
|
|
Tercio@11
|
100 "CreateFeedbackButton",
|
|
Tercio@20
|
101 "CreateOptionsFrame",
|
|
Tercio@22
|
102 "NewSpecialLuaEditorEntry",
|
|
Tercio@20
|
103 "ShowPromptPanel",
|
|
Tercio@22
|
104 "ShowTextPromptPanel",
|
|
Tercio@11
|
105 "www_icons",
|
|
Tercio@22
|
106 "GetTemplate",
|
|
Tercioo@29
|
107 "InstallTemplate",
|
|
Tercio@22
|
108 "GetFrameworkFolder",
|
|
Tercioo@29
|
109 "ShowPanicWarning",
|
|
Tercio@39
|
110 "SetFrameworkDebugState",
|
|
Tercio@39
|
111 "FindHighestParent",
|
|
Tercio@39
|
112 "OpenInterfaceProfile",
|
|
Tercio@11
|
113 }
|
|
Tercio@11
|
114
|
|
Tercio@20
|
115 DF.table = {}
|
|
Tercio@20
|
116
|
|
Tercio@22
|
117 function DF:GetFrameworkFolder()
|
|
Tercio@22
|
118 return DF.folder
|
|
Tercio@22
|
119 end
|
|
Tercio@22
|
120
|
|
Tercio@39
|
121 function DF:SetFrameworkDebugState (state)
|
|
Tercio@39
|
122 DF.debug = state
|
|
Tercio@39
|
123 end
|
|
Tercio@39
|
124
|
|
Tercio@26
|
125 function DF:FadeFrame (frame, t)
|
|
Tercio@26
|
126 if (t == 0) then
|
|
Tercio@26
|
127 frame.hidden = false
|
|
Tercio@26
|
128 frame.faded = false
|
|
Tercio@26
|
129 frame.fading_out = false
|
|
Tercio@26
|
130 frame.fading_in = false
|
|
Tercio@26
|
131 frame:Show()
|
|
Tercio@26
|
132 frame:SetAlpha (1)
|
|
Tercio@26
|
133
|
|
Tercio@26
|
134 elseif (t == 1) then
|
|
Tercio@26
|
135 frame.hidden = true
|
|
Tercio@26
|
136 frame.faded = true
|
|
Tercio@26
|
137 frame.fading_out = false
|
|
Tercio@26
|
138 frame.fading_in = false
|
|
Tercio@26
|
139 frame:SetAlpha (0)
|
|
Tercio@26
|
140 frame:Hide()
|
|
Tercio@26
|
141 end
|
|
Tercio@26
|
142 end
|
|
Tercio@26
|
143
|
|
Tercio@20
|
144 function DF.table.reverse (t)
|
|
Tercio@20
|
145 local new = {}
|
|
Tercio@20
|
146 local index = 1
|
|
Tercio@20
|
147 for i = #t, 1, -1 do
|
|
Tercio@20
|
148 new [index] = t[i]
|
|
Tercio@20
|
149 index = index + 1
|
|
Tercio@20
|
150 end
|
|
Tercio@20
|
151 return new
|
|
Tercio@20
|
152 end
|
|
Tercio@20
|
153
|
|
Tercio@20
|
154 --> copy from table2 to table1 overwriting values
|
|
Tercio@20
|
155 function DF.table.copy (t1, t2)
|
|
Tercio@20
|
156 for key, value in pairs (t2) do
|
|
Tercio@20
|
157 if (type (value) == "table") then
|
|
Tercio@20
|
158 t1 [key] = t1 [key] or {}
|
|
Tercio@20
|
159 DF.table.copy (t1 [key], t2 [key])
|
|
Tercio@20
|
160 else
|
|
Tercio@20
|
161 t1 [key] = value
|
|
Tercio@20
|
162 end
|
|
Tercio@20
|
163 end
|
|
Tercio@20
|
164 return t1
|
|
Tercio@20
|
165 end
|
|
Tercio@20
|
166
|
|
Tercio@20
|
167 --> copy values that does exist on table2 but not on table1
|
|
Tercio@20
|
168 function DF.table.deploy (t1, t2)
|
|
Tercio@20
|
169 for key, value in pairs (t2) do
|
|
Tercio@20
|
170 if (type (value) == "table") then
|
|
Tercio@20
|
171 t1 [key] = t1 [key] or {}
|
|
Tercio@20
|
172 DF.table.deploy (t1 [key], t2 [key])
|
|
Tercio@22
|
173 elseif (t1 [key] == nil) then
|
|
Tercio@20
|
174 t1 [key] = value
|
|
Tercio@20
|
175 end
|
|
Tercio@20
|
176 end
|
|
Tercio@20
|
177 end
|
|
Tercio@20
|
178
|
|
Tercio@20
|
179 function DF.table.dump (t, s, deep)
|
|
Tercio@20
|
180 s = s or ""
|
|
Tercio@20
|
181 deep = deep or 0
|
|
Tercio@20
|
182 local space = ""
|
|
Tercio@20
|
183 for i = 1, deep do
|
|
Tercio@20
|
184 space = space .. " "
|
|
Tercio@20
|
185 end
|
|
Tercio@20
|
186 for key, value in pairs (t) do
|
|
Tercio@20
|
187 local tpe = _type (value)
|
|
Tercio@20
|
188 if (type (key) ~= "string") then
|
|
Tercio@20
|
189 key = "unknown?"
|
|
Tercio@20
|
190 end
|
|
Tercio@20
|
191 if (tpe == "table") then
|
|
Tercio@20
|
192 s = s .. space .. "[" .. key .. "] = |cFFa9ffa9table {|r\n"
|
|
Tercio@20
|
193 s = s .. DF.table.dump (value, nil, deep+1)
|
|
Tercio@20
|
194 s = s .. space .. "|cFFa9ffa9}|r\n"
|
|
Tercio@20
|
195 elseif (tpe == "string") then
|
|
Tercio@20
|
196 s = s .. space .. "[" .. key .. "] = '|cFFfff1c1" .. value .. "|r'\n"
|
|
Tercio@20
|
197 elseif (tpe == "number") then
|
|
Tercio@20
|
198 s = s .. space .. "[" .. key .. "] = |cFFffc1f4" .. value .. "|r\n"
|
|
Tercio@20
|
199 elseif (tpe == "function") then
|
|
Tercio@20
|
200 s = s .. space .. "[" .. key .. "] = function()\n"
|
|
Tercio@20
|
201 elseif (tpe == "boolean") then
|
|
Tercio@20
|
202 s = s .. space .. "[" .. key .. "] = |cFF99d0ff" .. (value and "true" or "false") .. "|r\n"
|
|
Tercio@20
|
203 end
|
|
Tercio@20
|
204 end
|
|
Tercio@20
|
205 return s
|
|
Tercio@20
|
206 end
|
|
Tercio@20
|
207
|
|
Tercio@11
|
208 DF.www_icons = {
|
|
Tercio@11
|
209 texture = "feedback_sites",
|
|
Tercio@11
|
210 wowi = {0, 0.7890625, 0, 37/128},
|
|
Tercio@11
|
211 curse = {0, 0.7890625, 38/123, 79/128},
|
|
Tercio@11
|
212 mmoc = {0, 0.7890625, 80/123, 123/128},
|
|
Tercio@11
|
213 }
|
|
Tercio@11
|
214
|
|
Tercio@24
|
215 function DF:IntegerToTimer (value)
|
|
Tercio@24
|
216 return "" .. floor (value/60) .. ":" .. format ("%02.f", value%60)
|
|
Tercio@24
|
217 end
|
|
Tercio@24
|
218
|
|
Tercio@11
|
219 function DF:Embed (target)
|
|
Tercio@11
|
220 for k, v in pairs (embed_functions) do
|
|
Tercio@11
|
221 target[v] = self[v]
|
|
Tercio@11
|
222 end
|
|
Tercio@11
|
223 self.embeds [target] = true
|
|
Tercio@11
|
224 return target
|
|
Tercio@11
|
225 end
|
|
Tercio@11
|
226
|
|
Tercioo@28
|
227 function DF:RemoveRealmName (name)
|
|
Tercioo@28
|
228 return name:gsub (("%-.*"), "")
|
|
Tercioo@28
|
229 end
|
|
Tercioo@28
|
230
|
|
Tercio@20
|
231 function DF:RemoveRealName (name)
|
|
Tercio@20
|
232 return name:gsub (("%-.*"), "")
|
|
Tercio@20
|
233 end
|
|
Tercio@20
|
234
|
|
Tercio@11
|
235 function DF:SetFontSize (fontString, ...)
|
|
Tercio@11
|
236 local fonte, _, flags = fontString:GetFont()
|
|
Tercio@11
|
237 fontString:SetFont (fonte, max (...), flags)
|
|
Tercio@11
|
238 end
|
|
Tercio@11
|
239 function DF:SetFontFace (fontString, fontface)
|
|
Tercio@25
|
240 local font = SharedMedia:Fetch ("font", fontface, true)
|
|
Tercio@25
|
241 if (font) then
|
|
Tercio@25
|
242 fontface = font
|
|
Tercio@25
|
243 end
|
|
Tercio@25
|
244
|
|
Tercio@11
|
245 local _, size, flags = fontString:GetFont()
|
|
Tercio@11
|
246 fontString:SetFont (fontface, size, flags)
|
|
Tercio@11
|
247 end
|
|
Tercio@11
|
248 function DF:SetFontColor (fontString, r, g, b, a)
|
|
Tercio@11
|
249 r, g, b, a = DF:ParseColors (r, g, b, a)
|
|
Tercio@11
|
250 fontString:SetTextColor (r, g, b, a)
|
|
Tercio@11
|
251 end
|
|
Tercio@11
|
252
|
|
Tercio@11
|
253 function DF:GetFontSize (fontString)
|
|
Tercio@11
|
254 local _, size = fontString:GetFont()
|
|
Tercio@11
|
255 return size
|
|
Tercio@11
|
256 end
|
|
Tercio@11
|
257 function DF:GetFontFace (fontString)
|
|
Tercio@11
|
258 local fontface = fontString:GetFont()
|
|
Tercio@11
|
259 return fontface
|
|
Tercio@11
|
260 end
|
|
Tercio@11
|
261
|
|
Tercio@11
|
262 function DF:SetFontOutline (fontString, outline)
|
|
Tercio@11
|
263 local fonte, size = fontString:GetFont()
|
|
Tercio@11
|
264 if (outline) then
|
|
Tercio@11
|
265 if (_type (outline) == "boolean" and outline) then
|
|
Tercio@11
|
266 outline = "OUTLINE"
|
|
Tercio@11
|
267 elseif (outline == 1) then
|
|
Tercio@11
|
268 outline = "OUTLINE"
|
|
Tercio@11
|
269 elseif (outline == 2) then
|
|
Tercio@11
|
270 outline = "THICKOUTLINE"
|
|
Tercio@11
|
271 end
|
|
Tercio@11
|
272 end
|
|
Tercio@11
|
273
|
|
Tercio@11
|
274 fontString:SetFont (fonte, size, outline)
|
|
Tercio@11
|
275 end
|
|
Tercio@11
|
276
|
|
Tercio@11
|
277 function DF:trim (s)
|
|
Tercio@11
|
278 local from = s:match"^%s*()"
|
|
Tercio@11
|
279 return from > #s and "" or s:match(".*%S", from)
|
|
Tercio@11
|
280 end
|
|
Tercio@11
|
281
|
|
Tercio@11
|
282 function DF:Msg (msg)
|
|
Tercio@11
|
283 print ("|cFFFFFFAA" .. self.__name .. "|r " .. msg)
|
|
Tercio@11
|
284 end
|
|
Tercio@11
|
285
|
|
Tercio@11
|
286 function DF:GetNpcIdFromGuid (guid)
|
|
Tercio@11
|
287 local NpcId = select ( 6, strsplit ( "-", guid ) )
|
|
Tercio@11
|
288 if (NpcId) then
|
|
Tercio@11
|
289 return tonumber ( NpcId )
|
|
Tercio@11
|
290 end
|
|
Tercio@11
|
291 return 0
|
|
Tercio@11
|
292 end
|
|
Tercio@11
|
293
|
|
Tercio@11
|
294 local onFinish = function (self)
|
|
Tercio@11
|
295 if (self.showWhenDone) then
|
|
Tercio@11
|
296 self.frame:SetAlpha (1)
|
|
Tercio@11
|
297 else
|
|
Tercio@11
|
298 self.frame:SetAlpha (0)
|
|
Tercio@11
|
299 self.frame:Hide()
|
|
Tercio@11
|
300 end
|
|
Tercio@11
|
301
|
|
Tercio@11
|
302 if (self.onFinishFunc) then
|
|
Tercio@11
|
303 self:onFinishFunc (self.frame)
|
|
Tercio@11
|
304 end
|
|
Tercio@11
|
305 end
|
|
Tercio@11
|
306
|
|
Tercio@11
|
307 local stop = function (self)
|
|
Tercio@11
|
308 local FlashAnimation = self.FlashAnimation
|
|
Tercio@11
|
309 FlashAnimation:Stop()
|
|
Tercio@11
|
310 end
|
|
Tercio@11
|
311
|
|
Tercio@11
|
312 local flash = function (self, fadeInTime, fadeOutTime, flashDuration, showWhenDone, flashInHoldTime, flashOutHoldTime, loopType)
|
|
Tercio@11
|
313
|
|
Tercio@11
|
314 local FlashAnimation = self.FlashAnimation
|
|
Tercio@11
|
315
|
|
Tercio@11
|
316 local fadeIn = FlashAnimation.fadeIn
|
|
Tercio@11
|
317 local fadeOut = FlashAnimation.fadeOut
|
|
Tercio@11
|
318
|
|
Tercio@11
|
319 fadeIn:Stop()
|
|
Tercio@11
|
320 fadeOut:Stop()
|
|
Tercio@11
|
321
|
|
Tercio@11
|
322 fadeIn:SetDuration (fadeInTime or 1)
|
|
Tercio@11
|
323 fadeIn:SetEndDelay (flashInHoldTime or 0)
|
|
Tercio@11
|
324
|
|
Tercio@11
|
325 fadeOut:SetDuration (fadeOutTime or 1)
|
|
Tercio@11
|
326 fadeOut:SetEndDelay (flashOutHoldTime or 0)
|
|
Tercio@11
|
327
|
|
Tercio@11
|
328 FlashAnimation.duration = flashDuration
|
|
Tercio@11
|
329 FlashAnimation.loopTime = FlashAnimation:GetDuration()
|
|
Tercio@11
|
330 FlashAnimation.finishAt = GetTime() + flashDuration
|
|
Tercio@11
|
331 FlashAnimation.showWhenDone = showWhenDone
|
|
Tercio@11
|
332
|
|
Tercio@11
|
333 FlashAnimation:SetLooping (loopType or "REPEAT")
|
|
Tercio@11
|
334
|
|
Tercio@11
|
335 self:Show()
|
|
Tercio@11
|
336 self:SetAlpha (0)
|
|
Tercio@11
|
337 FlashAnimation:Play()
|
|
Tercio@11
|
338 end
|
|
Tercio@11
|
339
|
|
Tercio@11
|
340 function DF:CreateFlashAnimation (frame, onFinishFunc, onLoopFunc)
|
|
Tercio@11
|
341 local FlashAnimation = frame:CreateAnimationGroup()
|
|
Tercio@11
|
342
|
|
Tercio@11
|
343 FlashAnimation.fadeOut = FlashAnimation:CreateAnimation ("Alpha") --> fade out anime
|
|
Tercio@11
|
344 FlashAnimation.fadeOut:SetOrder (1)
|
|
Tercio@39
|
345 FlashAnimation.fadeOut:SetFromAlpha (0)
|
|
Tercio@39
|
346 FlashAnimation.fadeOut:SetToAlpha (1)
|
|
Tercio@11
|
347
|
|
Tercio@11
|
348 FlashAnimation.fadeIn = FlashAnimation:CreateAnimation ("Alpha") --> fade in anime
|
|
Tercio@11
|
349 FlashAnimation.fadeIn:SetOrder (2)
|
|
Tercio@39
|
350 FlashAnimation.fadeIn:SetFromAlpha (1)
|
|
Tercio@39
|
351 FlashAnimation.fadeIn:SetToAlpha (0)
|
|
Tercio@11
|
352
|
|
Tercio@11
|
353 frame.FlashAnimation = FlashAnimation
|
|
Tercio@11
|
354 FlashAnimation.frame = frame
|
|
Tercio@11
|
355 FlashAnimation.onFinishFunc = onFinishFunc
|
|
Tercio@11
|
356
|
|
Tercio@11
|
357 FlashAnimation:SetScript ("OnLoop", onLoopFunc)
|
|
Tercio@11
|
358 FlashAnimation:SetScript ("OnFinished", onFinish)
|
|
Tercio@11
|
359
|
|
Tercio@11
|
360 frame.Flash = flash
|
|
Tercio@11
|
361 frame.Stop = stop
|
|
Tercio@11
|
362 end
|
|
Tercio@11
|
363
|
|
Tercio@11
|
364 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@11
|
365 --> points
|
|
Tercio@11
|
366
|
|
Tercio@11
|
367 function DF:CheckPoints (v1, v2, v3, v4, v5, object)
|
|
Tercio@11
|
368
|
|
Tercio@11
|
369 if (not v1 and not v2) then
|
|
Tercio@11
|
370 return "topleft", object.widget:GetParent(), "topleft", 0, 0
|
|
Tercio@11
|
371 end
|
|
Tercio@11
|
372
|
|
Tercio@11
|
373 if (_type (v1) == "string") then
|
|
Tercio@11
|
374 local frameGlobal = _G [v1]
|
|
Tercio@11
|
375 if (frameGlobal and frameGlobal.GetObjectType) then
|
|
Tercio@11
|
376 return DF:CheckPoints (frameGlobal, v2, v3, v4, v5, object)
|
|
Tercio@11
|
377 end
|
|
Tercio@11
|
378
|
|
Tercio@11
|
379 elseif (_type (v2) == "string") then
|
|
Tercio@11
|
380 local frameGlobal = _G [v2]
|
|
Tercio@11
|
381 if (frameGlobal and frameGlobal.GetObjectType) then
|
|
Tercio@11
|
382 return DF:CheckPoints (v1, frameGlobal, v3, v4, v5, object)
|
|
Tercio@11
|
383 end
|
|
Tercio@11
|
384 end
|
|
Tercio@11
|
385
|
|
Tercio@11
|
386 if (_type (v1) == "string" and _type (v2) == "table") then --> :setpoint ("left", frame, _, _, _)
|
|
Tercio@11
|
387 if (not v3 or _type (v3) == "number") then --> :setpoint ("left", frame, 10, 10)
|
|
Tercio@11
|
388 v1, v2, v3, v4, v5 = v1, v2, v1, v3, v4
|
|
Tercio@11
|
389 end
|
|
Tercio@11
|
390
|
|
Tercio@11
|
391 elseif (_type (v1) == "string" and _type (v2) == "number") then --> :setpoint ("topleft", x, y)
|
|
Tercio@11
|
392 v1, v2, v3, v4, v5 = v1, object.widget:GetParent(), v1, v2, v3
|
|
Tercio@11
|
393
|
|
Tercio@11
|
394 elseif (_type (v1) == "number") then --> :setpoint (x, y)
|
|
Tercio@11
|
395 v1, v2, v3, v4, v5 = "topleft", object.widget:GetParent(), "topleft", v1, v2
|
|
Tercio@11
|
396
|
|
Tercio@11
|
397 elseif (_type (v1) == "table") then --> :setpoint (frame, x, y)
|
|
Tercio@11
|
398 v1, v2, v3, v4, v5 = "topleft", v1, "topleft", v2, v3
|
|
Tercio@11
|
399
|
|
Tercio@11
|
400 end
|
|
Tercio@11
|
401
|
|
Tercio@11
|
402 if (not v2) then
|
|
Tercio@11
|
403 v2 = object.widget:GetParent()
|
|
Tercio@11
|
404 elseif (v2.dframework) then
|
|
Tercio@11
|
405 v2 = v2.widget
|
|
Tercio@11
|
406 end
|
|
Tercio@11
|
407
|
|
Tercio@11
|
408 return v1 or "topleft", v2, v3 or "topleft", v4 or 0, v5 or 0
|
|
Tercio@11
|
409 end
|
|
Tercio@11
|
410
|
|
Tercio@11
|
411
|
|
Tercio@11
|
412 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@11
|
413 --> colors
|
|
Tercio@11
|
414
|
|
Tercio@11
|
415 function DF:NewColor (_colorname, _colortable, _green, _blue, _alpha)
|
|
Tercio@11
|
416 assert (_type (_colorname) == "string", "NewColor: colorname must be a string.")
|
|
Tercio@11
|
417 assert (not DF.alias_text_colors [_colorname], "NewColor: colorname already exists.")
|
|
Tercio@11
|
418
|
|
Tercio@11
|
419 if (_type (_colortable) == "table") then
|
|
Tercio@11
|
420 if (_colortable[1] and _colortable[2] and _colortable[3]) then
|
|
Tercio@11
|
421 _colortable[4] = _colortable[4] or 1
|
|
Tercio@11
|
422 DF.alias_text_colors [_colorname] = _colortable
|
|
Tercio@11
|
423 else
|
|
Tercio@11
|
424 error ("invalid color table.")
|
|
Tercio@11
|
425 end
|
|
Tercio@11
|
426 elseif (_colortable and _green and _blue) then
|
|
Tercio@11
|
427 _alpha = _alpha or 1
|
|
Tercio@11
|
428 DF.alias_text_colors [_colorname] = {_colortable, _green, _blue, _alpha}
|
|
Tercio@11
|
429 else
|
|
Tercio@11
|
430 error ("invalid parameter.")
|
|
Tercio@11
|
431 end
|
|
Tercio@11
|
432
|
|
Tercio@11
|
433 return true
|
|
Tercio@11
|
434 end
|
|
Tercio@11
|
435
|
|
Tercio@11
|
436 function DF:IsHtmlColor (color)
|
|
Tercio@11
|
437 return DF.alias_text_colors [color]
|
|
Tercio@11
|
438 end
|
|
Tercio@11
|
439
|
|
Tercio@11
|
440 local tn = tonumber
|
|
Tercio@11
|
441 function DF:ParseColors (_arg1, _arg2, _arg3, _arg4)
|
|
Tercio@11
|
442 if (_type (_arg1) == "table") then
|
|
Tercio@25
|
443 if (not _arg1[1] and _arg1.r) then
|
|
Tercio@25
|
444 _arg1, _arg2, _arg3, _arg4 = _arg1.r, _arg1.g, _arg1.b, _arg1.a
|
|
Tercio@25
|
445 else
|
|
Tercio@25
|
446 _arg1, _arg2, _arg3, _arg4 = _unpack (_arg1)
|
|
Tercio@25
|
447 end
|
|
Tercio@11
|
448
|
|
Tercio@11
|
449 elseif (_type (_arg1) == "string") then
|
|
Tercio@11
|
450
|
|
Tercio@11
|
451 if (string.find (_arg1, "#")) then
|
|
Tercio@11
|
452 _arg1 = _arg1:gsub ("#","")
|
|
Tercio@11
|
453 if (string.len (_arg1) == 8) then --alpha
|
|
Tercio@11
|
454 _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
|
455 else
|
|
Tercio@11
|
456 _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
|
457 end
|
|
Tercio@11
|
458
|
|
Tercio@11
|
459 else
|
|
Tercio@11
|
460 local color = DF.alias_text_colors [_arg1]
|
|
Tercio@11
|
461 if (color) then
|
|
Tercio@11
|
462 _arg1, _arg2, _arg3, _arg4 = _unpack (color)
|
|
Tercio@11
|
463 else
|
|
Tercio@11
|
464 _arg1, _arg2, _arg3, _arg4 = _unpack (DF.alias_text_colors.none)
|
|
Tercio@11
|
465 end
|
|
Tercio@11
|
466 end
|
|
Tercio@11
|
467 end
|
|
Tercio@11
|
468
|
|
Tercio@11
|
469 if (not _arg1) then
|
|
Tercio@11
|
470 _arg1 = 1
|
|
Tercio@11
|
471 end
|
|
Tercio@11
|
472 if (not _arg2) then
|
|
Tercio@11
|
473 _arg2 = 1
|
|
Tercio@11
|
474 end
|
|
Tercio@11
|
475 if (not _arg3) then
|
|
Tercio@11
|
476 _arg3 = 1
|
|
Tercio@11
|
477 end
|
|
Tercio@11
|
478 if (not _arg4) then
|
|
Tercio@11
|
479 _arg4 = 1
|
|
Tercio@11
|
480 end
|
|
Tercio@11
|
481
|
|
Tercio@11
|
482 return _arg1, _arg2, _arg3, _arg4
|
|
Tercio@11
|
483 end
|
|
Tercio@11
|
484
|
|
Tercio@11
|
485 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@11
|
486 --> menus
|
|
Tercio@11
|
487
|
|
Tercio@39
|
488 local disable_on_combat = {}
|
|
Tercio@39
|
489
|
|
Tercio@22
|
490 function DF:BuildMenu (parent, menu, x_offset, y_offset, height, use_two_points, text_template, dropdown_template, switch_template, switch_is_box, slider_template, button_template)
|
|
Tercio@22
|
491
|
|
Tercio@22
|
492 if (not parent.widget_list) then
|
|
Tercio@22
|
493 DF:SetAsOptionsPanel (parent)
|
|
Tercio@22
|
494 end
|
|
Tercio@11
|
495
|
|
Tercio@11
|
496 local cur_x = x_offset
|
|
Tercio@11
|
497 local cur_y = y_offset
|
|
Tercio@11
|
498 local max_x = 0
|
|
Tercio@11
|
499
|
|
Tercio@11
|
500 height = abs ((height or parent:GetHeight()) - abs (y_offset) + 20)
|
|
Tercio@11
|
501 height = height*-1
|
|
Tercio@11
|
502
|
|
Tercio@11
|
503 for index, widget_table in ipairs (menu) do
|
|
Tercio@11
|
504
|
|
Tercio@39
|
505 local widget_created
|
|
Tercio@39
|
506
|
|
Tercio@20
|
507 if (widget_table.type == "blank" or widget_table.type == "space") then
|
|
Tercio@20
|
508 -- do nothing
|
|
Tercio@20
|
509
|
|
Tercio@20
|
510 elseif (widget_table.type == "label" or widget_table.type == "text") then
|
|
Tercio@22
|
511 local label = DF:CreateLabel (parent, widget_table.get() or widget_table.text, widget_table.text_template or text_template or widget_table.size, widget_table.color, widget_table.font, nil, "$parentWidget" .. index, "overlay")
|
|
Tercio@20
|
512 label._get = widget_table.get
|
|
Tercio@20
|
513 label.widget_type = "label"
|
|
Tercio@20
|
514 label:SetPoint (cur_x, cur_y)
|
|
Tercio@20
|
515 tinsert (parent.widget_list, label)
|
|
Tercio@20
|
516
|
|
Tercio@20
|
517 elseif (widget_table.type == "select" or widget_table.type == "dropdown") then
|
|
Tercio@22
|
518 local dropdown = DF:NewDropDown (parent, nil, "$parentWidget" .. index, nil, 140, 18, widget_table.values, widget_table.get(), dropdown_template)
|
|
Tercio@11
|
519 dropdown.tooltip = widget_table.desc
|
|
Tercio@20
|
520 dropdown._get = widget_table.get
|
|
Tercio@20
|
521 dropdown.widget_type = "select"
|
|
Tercio@22
|
522 local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12)
|
|
Tercio@11
|
523 dropdown:SetPoint ("left", label, "right", 2)
|
|
Tercio@11
|
524 label:SetPoint (cur_x, cur_y)
|
|
Tercio@11
|
525
|
|
Tercio@11
|
526 local size = label.widget:GetStringWidth() + 140 + 4
|
|
Tercio@11
|
527 if (size > max_x) then
|
|
Tercio@11
|
528 max_x = size
|
|
Tercio@11
|
529 end
|
|
Tercio@11
|
530
|
|
Tercio@20
|
531 tinsert (parent.widget_list, dropdown)
|
|
Tercio@39
|
532 widget_created = dropdown
|
|
Tercio@20
|
533
|
|
Tercio@11
|
534 elseif (widget_table.type == "toggle" or widget_table.type == "switch") then
|
|
Tercio@22
|
535 local switch = DF:NewSwitch (parent, nil, "$parentWidget" .. index, nil, 60, 20, nil, nil, widget_table.get(), nil, nil, nil, nil, switch_template)
|
|
Tercio@11
|
536 switch.tooltip = widget_table.desc
|
|
Tercio@20
|
537 switch._get = widget_table.get
|
|
Tercio@20
|
538 switch.widget_type = "toggle"
|
|
Tercio@11
|
539 switch.OnSwitch = widget_table.set
|
|
Tercio@11
|
540
|
|
Tercio@22
|
541 if (switch_is_box) then
|
|
Tercio@22
|
542 switch:SetAsCheckBox()
|
|
Tercio@22
|
543 end
|
|
Tercio@22
|
544
|
|
Tercio@22
|
545 local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12)
|
|
Tercio@11
|
546 switch:SetPoint ("left", label, "right", 2)
|
|
Tercio@11
|
547 label:SetPoint (cur_x, cur_y)
|
|
Tercio@11
|
548
|
|
Tercio@11
|
549 local size = label.widget:GetStringWidth() + 60 + 4
|
|
Tercio@11
|
550 if (size > max_x) then
|
|
Tercio@11
|
551 max_x = size
|
|
Tercio@11
|
552 end
|
|
Tercio@11
|
553
|
|
Tercio@20
|
554 tinsert (parent.widget_list, switch)
|
|
Tercio@39
|
555 widget_created = switch
|
|
Tercio@20
|
556
|
|
Tercio@11
|
557 elseif (widget_table.type == "range" or widget_table.type == "slider") then
|
|
Tercio@11
|
558 local is_decimanls = widget_table.usedecimals
|
|
Tercio@22
|
559 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, nil, nil, slider_template)
|
|
Tercio@11
|
560 slider.tooltip = widget_table.desc
|
|
Tercio@20
|
561 slider._get = widget_table.get
|
|
Tercio@20
|
562 slider.widget_type = "range"
|
|
Tercio@11
|
563 slider:SetHook ("OnValueChange", widget_table.set)
|
|
Tercio@11
|
564
|
|
Tercio@22
|
565 local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12)
|
|
Tercio@11
|
566 slider:SetPoint ("left", label, "right", 2)
|
|
Tercio@11
|
567 label:SetPoint (cur_x, cur_y)
|
|
Tercio@11
|
568
|
|
Tercio@11
|
569 local size = label.widget:GetStringWidth() + 140 + 6
|
|
Tercio@11
|
570 if (size > max_x) then
|
|
Tercio@11
|
571 max_x = size
|
|
Tercio@11
|
572 end
|
|
Tercio@11
|
573
|
|
Tercio@20
|
574 tinsert (parent.widget_list, slider)
|
|
Tercio@39
|
575 widget_created = slider
|
|
Tercio@20
|
576
|
|
Tercio@11
|
577 elseif (widget_table.type == "color" or widget_table.type == "color") then
|
|
Tercio@22
|
578 local colorpick = DF:NewColorPickButton (parent, "$parentWidget" .. index, nil, widget_table.set, nil, button_template)
|
|
Tercio@11
|
579 colorpick.tooltip = widget_table.desc
|
|
Tercio@20
|
580 colorpick._get = widget_table.get
|
|
Tercio@20
|
581 colorpick.widget_type = "color"
|
|
Tercio@11
|
582
|
|
Tercio@11
|
583 local default_value, g, b, a = widget_table.get()
|
|
Tercio@11
|
584 if (type (default_value) == "table") then
|
|
Tercio@11
|
585 colorpick:SetColor (unpack (default_value))
|
|
Tercio@11
|
586 else
|
|
Tercio@11
|
587 colorpick:SetColor (default_value, g, b, a)
|
|
Tercio@11
|
588 end
|
|
Tercio@11
|
589
|
|
Tercio@22
|
590 local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12)
|
|
Tercio@11
|
591 colorpick:SetPoint ("left", label, "right", 2)
|
|
Tercio@11
|
592 label:SetPoint (cur_x, cur_y)
|
|
Tercio@11
|
593
|
|
Tercio@11
|
594 local size = label.widget:GetStringWidth() + 60 + 4
|
|
Tercio@11
|
595 if (size > max_x) then
|
|
Tercio@11
|
596 max_x = size
|
|
Tercio@11
|
597 end
|
|
Tercio@11
|
598
|
|
Tercio@20
|
599 tinsert (parent.widget_list, colorpick)
|
|
Tercio@39
|
600 widget_created = colorpick
|
|
Tercio@20
|
601
|
|
Tercio@11
|
602 elseif (widget_table.type == "execute" or widget_table.type == "button") then
|
|
Tercio@11
|
603
|
|
Tercio@22
|
604 local button = DF:NewButton (parent, nil, "$parentWidget" .. index, nil, 120, 18, widget_table.func, widget_table.param1, widget_table.param2, nil, widget_table.name, nil, button_template)
|
|
Tercio@22
|
605 if (not button_template) then
|
|
Tercio@22
|
606 button:InstallCustomTexture()
|
|
Tercio@22
|
607 end
|
|
Tercio@22
|
608
|
|
Tercio@11
|
609 button:SetPoint (cur_x, cur_y)
|
|
Tercio@11
|
610 button.tooltip = widget_table.desc
|
|
Tercio@20
|
611 button.widget_type = "execute"
|
|
Tercio@11
|
612
|
|
Tercio@11
|
613 local size = button:GetWidth() + 4
|
|
Tercio@11
|
614 if (size > max_x) then
|
|
Tercio@11
|
615 max_x = size
|
|
Tercio@11
|
616 end
|
|
Tercio@11
|
617
|
|
Tercio@20
|
618 tinsert (parent.widget_list, button)
|
|
Tercio@39
|
619 widget_created = button
|
|
Tercio@20
|
620
|
|
Tercio@11
|
621 end
|
|
Tercio@39
|
622
|
|
Tercio@39
|
623 if (widget_table.nocombat) then
|
|
Tercio@39
|
624 tinsert (disable_on_combat, widget_created)
|
|
Tercio@39
|
625 end
|
|
Tercio@11
|
626
|
|
Tercio@11
|
627 if (widget_table.spacement) then
|
|
Tercio@11
|
628 cur_y = cur_y - 30
|
|
Tercio@11
|
629 else
|
|
Tercio@11
|
630 cur_y = cur_y - 20
|
|
Tercio@11
|
631 end
|
|
Tercio@11
|
632
|
|
Tercio@39
|
633 if (widget_table.type == "breakline" or cur_y < height) then
|
|
Tercio@11
|
634 cur_y = y_offset
|
|
Tercio@11
|
635 cur_x = cur_x + max_x + 30
|
|
Tercio@11
|
636 max_x = 0
|
|
Tercio@11
|
637 end
|
|
Tercio@11
|
638
|
|
Tercio@11
|
639 end
|
|
Tercio@11
|
640
|
|
Tercio@39
|
641 DF.RefreshUnsafeOptionsWidgets()
|
|
Tercio@39
|
642
|
|
Tercio@11
|
643 end
|
|
Tercio@39
|
644
|
|
Tercio@39
|
645 local lock_notsafe_widgets = function()
|
|
Tercio@39
|
646 for _, widget in ipairs (disable_on_combat) do
|
|
Tercio@39
|
647 widget:Disable()
|
|
Tercio@39
|
648 end
|
|
Tercio@39
|
649 end
|
|
Tercio@39
|
650 local unlock_notsafe_widgets = function()
|
|
Tercio@39
|
651 for _, widget in ipairs (disable_on_combat) do
|
|
Tercio@39
|
652 widget:Enable()
|
|
Tercio@39
|
653 end
|
|
Tercio@39
|
654 end
|
|
Tercio@39
|
655 function DF.RefreshUnsafeOptionsWidgets()
|
|
Tercio@39
|
656 if (DF.PlayerHasCombatFlag) then
|
|
Tercio@39
|
657 lock_notsafe_widgets()
|
|
Tercio@39
|
658 else
|
|
Tercio@39
|
659 unlock_notsafe_widgets()
|
|
Tercio@39
|
660 end
|
|
Tercio@39
|
661 end
|
|
Tercio@39
|
662 DF.PlayerHasCombatFlag = false
|
|
Tercio@39
|
663 local ProtectCombatFrame = CreateFrame ("frame")
|
|
Tercio@39
|
664 ProtectCombatFrame:RegisterEvent ("PLAYER_REGEN_ENABLED")
|
|
Tercio@39
|
665 ProtectCombatFrame:RegisterEvent ("PLAYER_REGEN_DISABLED")
|
|
Tercio@39
|
666 ProtectCombatFrame:RegisterEvent ("PLAYER_ENTERING_WORLD")
|
|
Tercio@39
|
667 ProtectCombatFrame:SetScript ("OnEvent", function (self, event)
|
|
Tercio@39
|
668 if (event == "PLAYER_ENTERING_WORLD") then
|
|
Tercio@39
|
669 if (InCombatLockdown()) then
|
|
Tercio@39
|
670 DF.PlayerHasCombatFlag = true
|
|
Tercio@39
|
671 else
|
|
Tercio@39
|
672 DF.PlayerHasCombatFlag = false
|
|
Tercio@39
|
673 end
|
|
Tercio@39
|
674 DF.RefreshUnsafeOptionsWidgets()
|
|
Tercio@39
|
675
|
|
Tercio@39
|
676 elseif (event == "PLAYER_REGEN_ENABLED") then
|
|
Tercio@39
|
677 DF.PlayerHasCombatFlag = false
|
|
Tercio@39
|
678 DF.RefreshUnsafeOptionsWidgets()
|
|
Tercio@39
|
679
|
|
Tercio@39
|
680 elseif (event == "PLAYER_REGEN_DISABLED") then
|
|
Tercio@39
|
681 DF.PlayerHasCombatFlag = true
|
|
Tercio@39
|
682 DF.RefreshUnsafeOptionsWidgets()
|
|
Tercio@39
|
683
|
|
Tercio@39
|
684 end
|
|
Tercio@39
|
685 end)
|
|
Tercio@11
|
686
|
|
Tercio@11
|
687 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@11
|
688 --> tutorials
|
|
Tercio@11
|
689
|
|
Tercio@11
|
690 function DF:ShowTutorialAlertFrame (maintext, desctext, clickfunc)
|
|
Tercio@11
|
691
|
|
Tercio@11
|
692 local TutorialAlertFrame = _G.DetailsFrameworkTutorialAlertFrame
|
|
Tercio@11
|
693
|
|
Tercio@11
|
694 if (not TutorialAlertFrame) then
|
|
Tercio@11
|
695
|
|
Tercio@11
|
696 TutorialAlertFrame = CreateFrame ("ScrollFrame", "DetailsFrameworkTutorialAlertFrame", UIParent, "DetailsFrameworkTutorialAlertFrameTemplate")
|
|
Tercio@11
|
697 TutorialAlertFrame.isFirst = true
|
|
Tercio@11
|
698 TutorialAlertFrame:SetPoint ("left", UIParent, "left", -20, 100)
|
|
Tercio@11
|
699
|
|
Tercio@11
|
700 TutorialAlertFrame:SetWidth (290)
|
|
Tercio@11
|
701 TutorialAlertFrame.ScrollChild:SetWidth (256)
|
|
Tercio@11
|
702
|
|
Tercio@11
|
703 local scrollname = TutorialAlertFrame.ScrollChild:GetName()
|
|
Tercio@11
|
704 _G [scrollname .. "BorderTopLeft"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
705 _G [scrollname .. "BorderTopRight"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
706 _G [scrollname .. "BorderBotLeft"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
707 _G [scrollname .. "BorderBotRight"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
708 _G [scrollname .. "BorderLeft"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
709 _G [scrollname .. "BorderRight"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
710 _G [scrollname .. "BorderBottom"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
711 _G [scrollname .. "BorderTop"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
712
|
|
Tercio@11
|
713 local iconbg = _G [scrollname .. "QuestIconBg"]
|
|
Tercio@11
|
714 iconbg:SetTexture ([[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]])
|
|
Tercio@11
|
715 iconbg:SetTexCoord (0, 1, 0, 1)
|
|
Tercio@11
|
716 iconbg:SetSize (100, 100)
|
|
Tercio@11
|
717 iconbg:ClearAllPoints()
|
|
Tercio@11
|
718 iconbg:SetPoint ("bottomleft", TutorialAlertFrame.ScrollChild, "bottomleft")
|
|
Tercio@11
|
719
|
|
Tercio@11
|
720 _G [scrollname .. "Exclamation"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
721 _G [scrollname .. "QuestionMark"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
722
|
|
Tercio@11
|
723 _G [scrollname .. "TopText"]:SetText ("Details!") --string
|
|
Tercio@11
|
724 _G [scrollname .. "QuestName"]:SetText ("") --string
|
|
Tercio@11
|
725 _G [scrollname .. "BottomText"]:SetText ("") --string
|
|
Tercio@11
|
726
|
|
Tercio@11
|
727 TutorialAlertFrame.ScrollChild.IconShine:SetTexture ([[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]])
|
|
Tercio@11
|
728
|
|
Tercio@11
|
729 TutorialAlertFrame:SetScript ("OnMouseUp", function (self)
|
|
Tercio@11
|
730 if (self.clickfunc and type (self.clickfunc) == "function") then
|
|
Tercio@11
|
731 self.clickfunc()
|
|
Tercio@11
|
732 end
|
|
Tercio@11
|
733 self:Hide()
|
|
Tercio@11
|
734 end)
|
|
Tercio@11
|
735 TutorialAlertFrame:Hide()
|
|
Tercio@11
|
736 end
|
|
Tercio@11
|
737
|
|
Tercio@11
|
738 if (type (maintext) == "string") then
|
|
Tercio@11
|
739 TutorialAlertFrame.ScrollChild.QuestName:SetText (maintext)
|
|
Tercio@11
|
740 else
|
|
Tercio@11
|
741 TutorialAlertFrame.ScrollChild.QuestName:SetText ("")
|
|
Tercio@11
|
742 end
|
|
Tercio@11
|
743
|
|
Tercio@11
|
744 if (type (desctext) == "string") then
|
|
Tercio@11
|
745 TutorialAlertFrame.ScrollChild.BottomText:SetText (desctext)
|
|
Tercio@11
|
746 else
|
|
Tercio@11
|
747 TutorialAlertFrame.ScrollChild.BottomText:SetText ("")
|
|
Tercio@11
|
748 end
|
|
Tercio@11
|
749
|
|
Tercio@11
|
750 TutorialAlertFrame.clickfunc = clickfunc
|
|
Tercio@11
|
751 TutorialAlertFrame:Show()
|
|
Tercio@11
|
752 DetailsTutorialAlertFrame_SlideInFrame (TutorialAlertFrame, "AUTOQUEST")
|
|
Tercio@11
|
753 end
|
|
Tercio@11
|
754
|
|
Tercio@20
|
755 local refresh_options = function (self)
|
|
Tercio@20
|
756 for _, widget in ipairs (self.widget_list) do
|
|
Tercio@20
|
757 if (widget._get) then
|
|
Tercio@20
|
758 if (widget.widget_type == "label") then
|
|
Tercio@20
|
759 if (widget._get()) then
|
|
Tercio@20
|
760 widget:SetText (widget._get())
|
|
Tercio@20
|
761 end
|
|
Tercio@20
|
762 elseif (widget.widget_type == "select") then
|
|
Tercio@20
|
763 widget:Select (widget._get())
|
|
Tercio@20
|
764 elseif (widget.widget_type == "toggle" or widget.widget_type == "range") then
|
|
Tercio@20
|
765 widget:SetValue (widget._get())
|
|
Tercio@20
|
766 elseif (widget.widget_type == "color") then
|
|
Tercio@20
|
767 local default_value, g, b, a = widget._get()
|
|
Tercio@20
|
768 if (type (default_value) == "table") then
|
|
Tercio@20
|
769 widget:SetColor (unpack (default_value))
|
|
Tercio@20
|
770 else
|
|
Tercio@20
|
771 widget:SetColor (default_value, g, b, a)
|
|
Tercio@20
|
772 end
|
|
Tercio@20
|
773 end
|
|
Tercio@20
|
774 end
|
|
Tercio@20
|
775 end
|
|
Tercio@20
|
776 end
|
|
Tercio@20
|
777
|
|
Tercio@20
|
778 function DF:SetAsOptionsPanel (frame)
|
|
Tercio@20
|
779 frame.RefreshOptions = refresh_options
|
|
Tercio@20
|
780 frame.widget_list = {}
|
|
Tercio@20
|
781 end
|
|
Tercio@20
|
782
|
|
Tercio@11
|
783 function DF:CreateOptionsFrame (name, title, template)
|
|
Tercio@11
|
784
|
|
Tercio@11
|
785 template = template or 1
|
|
Tercio@11
|
786
|
|
Tercio@11
|
787 if (template == 2) then
|
|
Tercio@11
|
788 local options_frame = CreateFrame ("frame", name, UIParent, "ButtonFrameTemplate")
|
|
Tercio@11
|
789 tinsert (UISpecialFrames, name)
|
|
Tercio@11
|
790 options_frame:SetSize (500, 200)
|
|
Tercio@20
|
791 options_frame.RefreshOptions = refresh_options
|
|
Tercio@20
|
792 options_frame.widget_list = {}
|
|
Tercio@11
|
793
|
|
Tercio@11
|
794 options_frame:SetScript ("OnMouseDown", function(self, button)
|
|
Tercio@11
|
795 if (button == "RightButton") then
|
|
Tercio@11
|
796 if (self.moving) then
|
|
Tercio@11
|
797 self.moving = false
|
|
Tercio@11
|
798 self:StopMovingOrSizing()
|
|
Tercio@11
|
799 end
|
|
Tercio@11
|
800 return options_frame:Hide()
|
|
Tercio@11
|
801 elseif (button == "LeftButton" and not self.moving) then
|
|
Tercio@11
|
802 self.moving = true
|
|
Tercio@11
|
803 self:StartMoving()
|
|
Tercio@11
|
804 end
|
|
Tercio@11
|
805 end)
|
|
Tercio@11
|
806 options_frame:SetScript ("OnMouseUp", function(self)
|
|
Tercio@11
|
807 if (self.moving) then
|
|
Tercio@11
|
808 self.moving = false
|
|
Tercio@11
|
809 self:StopMovingOrSizing()
|
|
Tercio@11
|
810 end
|
|
Tercio@11
|
811 end)
|
|
Tercio@11
|
812
|
|
Tercio@11
|
813 options_frame:SetMovable (true)
|
|
Tercio@11
|
814 options_frame:EnableMouse (true)
|
|
Tercio@11
|
815 options_frame:SetFrameStrata ("DIALOG")
|
|
Tercio@11
|
816 options_frame:SetToplevel (true)
|
|
Tercio@11
|
817
|
|
Tercio@11
|
818 options_frame:Hide()
|
|
Tercio@11
|
819
|
|
Tercio@11
|
820 options_frame:SetPoint ("center", UIParent, "center")
|
|
Tercio@11
|
821 options_frame.TitleText:SetText (title)
|
|
Tercio@11
|
822 options_frame.portrait:SetTexture ([[Interface\CHARACTERFRAME\TEMPORARYPORTRAIT-FEMALE-BLOODELF]])
|
|
Tercio@11
|
823
|
|
Tercio@11
|
824 return options_frame
|
|
Tercio@11
|
825
|
|
Tercio@11
|
826 elseif (template == 1) then
|
|
Tercio@11
|
827
|
|
Tercio@11
|
828 local options_frame = CreateFrame ("frame", name, UIParent)
|
|
Tercio@11
|
829 tinsert (UISpecialFrames, name)
|
|
Tercio@11
|
830 options_frame:SetSize (500, 200)
|
|
Tercio@20
|
831 options_frame.RefreshOptions = refresh_options
|
|
Tercio@20
|
832 options_frame.widget_list = {}
|
|
Tercio@11
|
833
|
|
Tercio@11
|
834 options_frame:SetScript ("OnMouseDown", function(self, button)
|
|
Tercio@11
|
835 if (button == "RightButton") then
|
|
Tercio@11
|
836 if (self.moving) then
|
|
Tercio@11
|
837 self.moving = false
|
|
Tercio@11
|
838 self:StopMovingOrSizing()
|
|
Tercio@11
|
839 end
|
|
Tercio@11
|
840 return options_frame:Hide()
|
|
Tercio@11
|
841 elseif (button == "LeftButton" and not self.moving) then
|
|
Tercio@11
|
842 self.moving = true
|
|
Tercio@11
|
843 self:StartMoving()
|
|
Tercio@11
|
844 end
|
|
Tercio@11
|
845 end)
|
|
Tercio@11
|
846 options_frame:SetScript ("OnMouseUp", function(self)
|
|
Tercio@11
|
847 if (self.moving) then
|
|
Tercio@11
|
848 self.moving = false
|
|
Tercio@11
|
849 self:StopMovingOrSizing()
|
|
Tercio@11
|
850 end
|
|
Tercio@11
|
851 end)
|
|
Tercio@11
|
852
|
|
Tercio@11
|
853 options_frame:SetMovable (true)
|
|
Tercio@11
|
854 options_frame:EnableMouse (true)
|
|
Tercio@11
|
855 options_frame:SetFrameStrata ("DIALOG")
|
|
Tercio@11
|
856 options_frame:SetToplevel (true)
|
|
Tercio@11
|
857
|
|
Tercio@11
|
858 options_frame:Hide()
|
|
Tercio@11
|
859
|
|
Tercio@11
|
860 options_frame:SetPoint ("center", UIParent, "center")
|
|
Tercio@11
|
861
|
|
Tercio@11
|
862 options_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16,
|
|
Tercio@18
|
863 edgeFile = DF.folder .. "border_2", edgeSize = 32,
|
|
Tercio@11
|
864 insets = {left = 1, right = 1, top = 1, bottom = 1}})
|
|
Tercio@11
|
865 options_frame:SetBackdropColor (0, 0, 0, .7)
|
|
Tercio@11
|
866
|
|
Tercio@11
|
867 local texturetitle = options_frame:CreateTexture (nil, "artwork")
|
|
Tercio@11
|
868 texturetitle:SetTexture ([[Interface\CURSOR\Interact]])
|
|
Tercio@11
|
869 texturetitle:SetTexCoord (0, 1, 0, 1)
|
|
Tercio@11
|
870 texturetitle:SetVertexColor (1, 1, 1, 1)
|
|
Tercio@11
|
871 texturetitle:SetPoint ("topleft", options_frame, "topleft", 2, -3)
|
|
Tercio@11
|
872 texturetitle:SetWidth (36)
|
|
Tercio@11
|
873 texturetitle:SetHeight (36)
|
|
Tercio@11
|
874
|
|
Tercio@11
|
875 local title = DF:NewLabel (options_frame, nil, "$parentTitle", nil, title, nil, 20, "yellow")
|
|
Tercio@11
|
876 title:SetPoint ("left", texturetitle, "right", 2, -1)
|
|
Tercio@11
|
877 DF:SetFontOutline (title, true)
|
|
Tercio@11
|
878
|
|
Tercio@11
|
879 local c = CreateFrame ("Button", nil, options_frame, "UIPanelCloseButton")
|
|
Tercio@11
|
880 c:SetWidth (32)
|
|
Tercio@11
|
881 c:SetHeight (32)
|
|
Tercio@11
|
882 c:SetPoint ("TOPRIGHT", options_frame, "TOPRIGHT", -3, -3)
|
|
Tercio@11
|
883 c:SetFrameLevel (options_frame:GetFrameLevel()+1)
|
|
Tercio@11
|
884
|
|
Tercio@11
|
885 return options_frame
|
|
Tercio@11
|
886 end
|
|
Tercio@22
|
887 end
|
|
Tercio@22
|
888
|
|
Tercio@22
|
889 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@22
|
890 --> templates
|
|
Tercio@22
|
891
|
|
Tercio@22
|
892 DF.font_templates = {}
|
|
Tercio@22
|
893 DF.font_templates ["ORANGE_FONT_TEMPLATE"] = {color = "orange", size = 11, font = "Accidental Presidency"}
|
|
Tercio@22
|
894 DF.font_templates ["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 12, font = "Accidental Presidency"}
|
|
Tercio@22
|
895
|
|
Tercio@22
|
896 DF.dropdown_templates = {}
|
|
Tercio@22
|
897 DF.dropdown_templates ["OPTIONS_DROPDOWN_TEMPLATE"] = {
|
|
Tercio@22
|
898 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
|
|
Tercio@22
|
899 backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
900 backdropbordercolor = {0, 0, 0, 1},
|
|
Tercio@22
|
901 onentercolor = {1, 1, 1, .5},
|
|
Tercio@22
|
902 onenterbordercolor = {1, 1, 1, 1},
|
|
Tercio@22
|
903 }
|
|
Tercio@22
|
904
|
|
Tercio@22
|
905 DF.switch_templates = {}
|
|
Tercio@22
|
906 DF.switch_templates ["OPTIONS_CHECKBOX_TEMPLATE"] = {
|
|
Tercio@22
|
907 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
|
|
Tercio@22
|
908 backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
909 backdropbordercolor = {0, 0, 0, 1},
|
|
Tercio@22
|
910 width = 18,
|
|
Tercio@22
|
911 height = 18,
|
|
Tercio@22
|
912 enabled_backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
913 disabled_backdropcolor = {1, 1, 1, .2},
|
|
Tercio@22
|
914 onenterbordercolor = {1, 1, 1, 1},
|
|
Tercio@22
|
915 }
|
|
Tercio@22
|
916 DF.switch_templates ["OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"] = {
|
|
Tercio@22
|
917 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
|
|
Tercio@22
|
918 backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
919 backdropbordercolor = {0, 0, 0, 1},
|
|
Tercio@22
|
920 width = 18,
|
|
Tercio@22
|
921 height = 18,
|
|
Tercio@22
|
922 enabled_backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
923 disabled_backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
924 onenterbordercolor = {1, 1, 1, 1},
|
|
Tercio@22
|
925 }
|
|
Tercio@22
|
926
|
|
Tercio@22
|
927 DF.button_templates = {}
|
|
Tercio@22
|
928 DF.button_templates ["OPTIONS_BUTTON_TEMPLATE"] = {
|
|
Tercio@22
|
929 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
|
|
Tercio@22
|
930 backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
931 backdropbordercolor = {0, 0, 0, 1},
|
|
Tercio@22
|
932 }
|
|
Tercio@22
|
933
|
|
Tercio@22
|
934 DF.slider_templates = {}
|
|
Tercio@22
|
935 DF.slider_templates ["OPTIONS_SLIDER_TEMPLATE"] = {
|
|
Tercio@22
|
936 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
|
|
Tercio@22
|
937 backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
938 backdropbordercolor = {0, 0, 0, 1},
|
|
Tercio@22
|
939 onentercolor = {1, 1, 1, .5},
|
|
Tercio@22
|
940 onenterbordercolor = {1, 1, 1, 1},
|
|
Tercio@22
|
941 thumbtexture = [[Interface\Tooltips\UI-Tooltip-Background]],
|
|
Tercio@22
|
942 thumbwidth = 16,
|
|
Tercio@22
|
943 thumbheight = 14,
|
|
Tercio@22
|
944 thumbcolor = {0, 0, 0, 0.5},
|
|
Tercio@22
|
945 }
|
|
Tercio@22
|
946
|
|
Tercioo@29
|
947 function DF:InstallTemplate (widget_type, template_name, template)
|
|
Tercioo@29
|
948 widget_type = string.lower (widget_type)
|
|
Tercioo@29
|
949
|
|
Tercio@22
|
950 local template_table
|
|
Tercioo@29
|
951 if (widget_type == "font") then
|
|
Tercio@22
|
952 template_table = DF.font_templates
|
|
Tercioo@29
|
953 elseif (widget_type == "dropdown") then
|
|
Tercio@22
|
954 template_table = DF.dropdown_templates
|
|
Tercioo@29
|
955 elseif (widget_type == "button") then
|
|
Tercio@22
|
956 template_table = DF.button_templates
|
|
Tercioo@29
|
957 elseif (widget_type == "switch") then
|
|
Tercio@22
|
958 template_table = DF.switch_templates
|
|
Tercioo@29
|
959 elseif (widget_type == "slider") then
|
|
Tercioo@29
|
960 template_table = DF.slider_templates
|
|
Tercioo@29
|
961 end
|
|
Tercioo@29
|
962
|
|
Tercioo@29
|
963 template_table [template_name] = template
|
|
Tercioo@29
|
964
|
|
Tercioo@29
|
965 return template
|
|
Tercioo@29
|
966 end
|
|
Tercioo@29
|
967
|
|
Tercioo@29
|
968 function DF:GetTemplate (widget_type, template_name)
|
|
Tercioo@29
|
969 widget_type = string.lower (widget_type)
|
|
Tercioo@29
|
970
|
|
Tercioo@29
|
971 local template_table
|
|
Tercioo@29
|
972 if (widget_type == "font") then
|
|
Tercioo@29
|
973 template_table = DF.font_templates
|
|
Tercioo@29
|
974 elseif (widget_type == "dropdown") then
|
|
Tercioo@29
|
975 template_table = DF.dropdown_templates
|
|
Tercioo@29
|
976 elseif (widget_type == "button") then
|
|
Tercioo@29
|
977 template_table = DF.button_templates
|
|
Tercioo@29
|
978 elseif (widget_type == "switch") then
|
|
Tercioo@29
|
979 template_table = DF.switch_templates
|
|
Tercioo@29
|
980 elseif (widget_type == "slider") then
|
|
Tercio@22
|
981 template_table = DF.slider_templates
|
|
Tercio@22
|
982 end
|
|
Tercio@22
|
983 return template_table [template_name]
|
|
Tercio@22
|
984 end
|
|
Tercioo@28
|
985
|
|
Tercioo@28
|
986 function DF.GetParentName (frame)
|
|
Tercioo@28
|
987 local parentName = frame:GetName()
|
|
Tercioo@28
|
988 if (not parentName) then
|
|
Tercioo@28
|
989 error ("Details! FrameWork: called $parent but parent was no name.", 2)
|
|
Tercioo@28
|
990 end
|
|
Tercioo@28
|
991 return parentName
|
|
Tercioo@28
|
992 end
|
|
Tercio@39
|
993
|
|
Tercio@39
|
994 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@39
|
995 --> widget scripts and hooks
|
|
Tercio@39
|
996
|
|
Tercio@39
|
997 function DF:RunHooksForWidget (event, ...)
|
|
Tercio@39
|
998 local hooks = self.HookList [event]
|
|
Tercio@39
|
999
|
|
Tercio@39
|
1000 if (not hooks) then
|
|
Tercio@39
|
1001 print (self.widget:GetName(), "sem hook para", event)
|
|
Tercio@39
|
1002 return
|
|
Tercio@39
|
1003 end
|
|
Tercio@39
|
1004
|
|
Tercio@39
|
1005 for i, func in ipairs (hooks) do
|
|
Tercio@39
|
1006 local success, canInterrupt = pcall (func, ...)
|
|
Tercio@39
|
1007 if (not success) then
|
|
Tercio@39
|
1008 error ("Details! Framework: " .. event .. " hook for " .. self:GetName() .. ": " .. canInterrupt)
|
|
Tercio@39
|
1009 elseif (canInterrupt) then
|
|
Tercio@39
|
1010 return true
|
|
Tercio@39
|
1011 end
|
|
Tercio@39
|
1012 end
|
|
Tercio@39
|
1013 end
|
|
Tercio@39
|
1014
|
|
Tercio@39
|
1015 function DF:SetHook (hookType, func)
|
|
Tercio@39
|
1016 if (self.HookList [hookType]) then
|
|
Tercio@39
|
1017 if (type (func) == "function") then
|
|
Tercio@39
|
1018 local isRemoval = false
|
|
Tercio@39
|
1019 for i = #self.HookList [hookType], 1, -1 do
|
|
Tercio@39
|
1020 if (self.HookList [hookType] [i] == func) then
|
|
Tercio@39
|
1021 tremove (self.HookList [hookType], i)
|
|
Tercio@39
|
1022 isRemoval = true
|
|
Tercio@39
|
1023 break
|
|
Tercio@39
|
1024 end
|
|
Tercio@39
|
1025 end
|
|
Tercio@39
|
1026 if (not isRemoval) then
|
|
Tercio@39
|
1027 tinsert (self.HookList [hookType], func)
|
|
Tercio@39
|
1028 end
|
|
Tercio@39
|
1029 else
|
|
Tercio@39
|
1030 if (DF.debug) then
|
|
Tercio@39
|
1031 error ("Details! Framework: invalid function for widget " .. self.WidgetType .. ".")
|
|
Tercio@39
|
1032 end
|
|
Tercio@39
|
1033 end
|
|
Tercio@39
|
1034 else
|
|
Tercio@39
|
1035 if (DF.debug) then
|
|
Tercio@39
|
1036 error ("Details! Framework: unknown hook type for widget " .. self.WidgetType .. ": '" .. hookType .. "'.")
|
|
Tercio@39
|
1037 end
|
|
Tercio@39
|
1038 end
|
|
Tercio@39
|
1039 end
|
|
Tercio@39
|
1040
|
|
Tercio@39
|
1041 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@39
|
1042 --> members
|
|
Tercio@39
|
1043
|
|
Tercio@39
|
1044 DF.GlobalWidgetControlNames = {
|
|
Tercio@39
|
1045 textentry = "DF_TextEntryMetaFunctions",
|
|
Tercio@39
|
1046 button = "DF_ButtonMetaFunctions",
|
|
Tercio@39
|
1047 panel = "DF_PanelMetaFunctions",
|
|
Tercio@39
|
1048 dropdown = "DF_DropdownMetaFunctions",
|
|
Tercio@39
|
1049 label = "DF_LabelMetaFunctions",
|
|
Tercio@39
|
1050 normal_bar = "DF_NormalBarMetaFunctions",
|
|
Tercio@39
|
1051 image = "DF_ImageMetaFunctions",
|
|
Tercio@39
|
1052 slider = "DF_SliderMetaFunctions",
|
|
Tercio@39
|
1053 split_bar = "DF_SplitBarMetaFunctions",
|
|
Tercio@39
|
1054 }
|
|
Tercio@39
|
1055
|
|
Tercio@39
|
1056 function DF:AddMemberForWidget (widgetName, memberType, memberName, func)
|
|
Tercio@39
|
1057 if (DF.GlobalWidgetControlNames [widgetName]) then
|
|
Tercio@39
|
1058 if (type (memberName) == "string" and (memberType == "SET" or memberType == "GET")) then
|
|
Tercio@39
|
1059 if (func) then
|
|
Tercio@39
|
1060 local widgetControlObject = _G [DF.GlobalWidgetControlNames [widgetName]]
|
|
Tercio@39
|
1061
|
|
Tercio@39
|
1062 if (memberType == "SET") then
|
|
Tercio@39
|
1063 widgetControlObject ["SetMembers"] [memberName] = func
|
|
Tercio@39
|
1064 elseif (memberType == "GET") then
|
|
Tercio@39
|
1065 widgetControlObject ["GetMembers"] [memberName] = func
|
|
Tercio@39
|
1066 end
|
|
Tercio@39
|
1067 else
|
|
Tercio@39
|
1068 if (DF.debug) then
|
|
Tercio@39
|
1069 error ("Details! Framework: AddMemberForWidget invalid function.")
|
|
Tercio@39
|
1070 end
|
|
Tercio@39
|
1071 end
|
|
Tercio@39
|
1072 else
|
|
Tercio@39
|
1073 if (DF.debug) then
|
|
Tercio@39
|
1074 error ("Details! Framework: AddMemberForWidget unknown memberName or memberType.")
|
|
Tercio@39
|
1075 end
|
|
Tercio@39
|
1076 end
|
|
Tercio@39
|
1077 else
|
|
Tercio@39
|
1078 if (DF.debug) then
|
|
Tercio@39
|
1079 error ("Details! Framework: AddMemberForWidget unknown widget type: " .. (widgetName or "") .. ".")
|
|
Tercio@39
|
1080 end
|
|
Tercio@39
|
1081 end
|
|
Tercio@39
|
1082 end
|
|
Tercio@39
|
1083
|
|
Tercio@39
|
1084 -----------------------------
|
|
Tercio@39
|
1085
|
|
Tercio@39
|
1086 function DF:OpenInterfaceProfile()
|
|
Tercio@39
|
1087 InterfaceOptionsFrame_OpenToCategory (self.__name)
|
|
Tercio@39
|
1088 InterfaceOptionsFrame_OpenToCategory (self.__name)
|
|
Tercio@39
|
1089 for i = 1, 100 do
|
|
Tercio@39
|
1090 local button = _G ["InterfaceOptionsFrameAddOnsButton" .. i]
|
|
Tercio@39
|
1091 if (button) then
|
|
Tercio@39
|
1092 local text = _G ["InterfaceOptionsFrameAddOnsButton" .. i .. "Text"]
|
|
Tercio@39
|
1093 if (text) then
|
|
Tercio@39
|
1094 text = text:GetText()
|
|
Tercio@39
|
1095 if (text == self.__name) then
|
|
Tercio@39
|
1096 local toggle = _G ["InterfaceOptionsFrameAddOnsButton" .. i .. "Toggle"]
|
|
Tercio@39
|
1097 if (toggle) then
|
|
Tercio@39
|
1098 if (toggle:GetNormalTexture():GetTexture():find ("PlusButton")) then
|
|
Tercio@39
|
1099 --is minimized, need expand
|
|
Tercio@39
|
1100 toggle:Click()
|
|
Tercio@39
|
1101 _G ["InterfaceOptionsFrameAddOnsButton" .. i+1]:Click()
|
|
Tercio@39
|
1102 elseif (toggle:GetNormalTexture():GetTexture():find ("MinusButton")) then
|
|
Tercio@39
|
1103 --isn't minimized
|
|
Tercio@39
|
1104 _G ["InterfaceOptionsFrameAddOnsButton" .. i+1]:Click()
|
|
Tercio@39
|
1105 end
|
|
Tercio@39
|
1106 end
|
|
Tercio@39
|
1107 break
|
|
Tercio@39
|
1108 end
|
|
Tercio@39
|
1109 end
|
|
Tercio@39
|
1110 else
|
|
Tercio@39
|
1111 self:Msg ("Couldn't not find the profile panel.")
|
|
Tercio@39
|
1112 break
|
|
Tercio@39
|
1113 end
|
|
Tercio@39
|
1114 end
|
|
Tercio@39
|
1115 end
|
|
Tercio@39
|
1116
|
|
Tercio@39
|
1117 -----------------------------
|
|
Tercio@39
|
1118 --safe copy from blizz api
|
|
Tercio@39
|
1119 function DF:Mixin (object, ...)
|
|
Tercio@39
|
1120 for i = 1, select("#", ...) do
|
|
Tercio@39
|
1121 local mixin = select(i, ...);
|
|
Tercio@39
|
1122 for k, v in pairs(mixin) do
|
|
Tercio@39
|
1123 object[k] = v;
|
|
Tercio@39
|
1124 end
|
|
Tercio@39
|
1125 end
|
|
Tercio@39
|
1126
|
|
Tercio@39
|
1127 return object;
|
|
Tercio@39
|
1128 end
|