annotate Libs/DF/fw.lua @ 40:a960d5372b0c

- framework update from v22 to v44.
author Tercio
date Wed, 31 Aug 2016 19:55:14 -0300
parents 7944c081e5b4
children e0a8f43009ea
rev   line source
Tercio@11 1
Tercio@40 2 local dversion = 44
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@40 113 "CreateInCombatTexture",
Tercio@40 114 "CreateAnimationHub",
Tercio@40 115 "CreateAnimation",
Tercio@40 116 "CreateScrollBox",
Tercio@40 117 "CreateBorder",
Tercio@11 118 }
Tercio@11 119
Tercio@20 120 DF.table = {}
Tercio@20 121
Tercio@22 122 function DF:GetFrameworkFolder()
Tercio@22 123 return DF.folder
Tercio@22 124 end
Tercio@22 125
Tercio@39 126 function DF:SetFrameworkDebugState (state)
Tercio@39 127 DF.debug = state
Tercio@39 128 end
Tercio@39 129
Tercio@26 130 function DF:FadeFrame (frame, t)
Tercio@26 131 if (t == 0) then
Tercio@26 132 frame.hidden = false
Tercio@26 133 frame.faded = false
Tercio@26 134 frame.fading_out = false
Tercio@26 135 frame.fading_in = false
Tercio@26 136 frame:Show()
Tercio@26 137 frame:SetAlpha (1)
Tercio@26 138
Tercio@26 139 elseif (t == 1) then
Tercio@26 140 frame.hidden = true
Tercio@26 141 frame.faded = true
Tercio@26 142 frame.fading_out = false
Tercio@26 143 frame.fading_in = false
Tercio@26 144 frame:SetAlpha (0)
Tercio@26 145 frame:Hide()
Tercio@26 146 end
Tercio@26 147 end
Tercio@26 148
Tercio@20 149 function DF.table.reverse (t)
Tercio@20 150 local new = {}
Tercio@20 151 local index = 1
Tercio@20 152 for i = #t, 1, -1 do
Tercio@20 153 new [index] = t[i]
Tercio@20 154 index = index + 1
Tercio@20 155 end
Tercio@20 156 return new
Tercio@20 157 end
Tercio@20 158
Tercio@20 159 --> copy from table2 to table1 overwriting values
Tercio@20 160 function DF.table.copy (t1, t2)
Tercio@20 161 for key, value in pairs (t2) do
Tercio@20 162 if (type (value) == "table") then
Tercio@20 163 t1 [key] = t1 [key] or {}
Tercio@20 164 DF.table.copy (t1 [key], t2 [key])
Tercio@20 165 else
Tercio@20 166 t1 [key] = value
Tercio@20 167 end
Tercio@20 168 end
Tercio@20 169 return t1
Tercio@20 170 end
Tercio@20 171
Tercio@20 172 --> copy values that does exist on table2 but not on table1
Tercio@20 173 function DF.table.deploy (t1, t2)
Tercio@20 174 for key, value in pairs (t2) do
Tercio@20 175 if (type (value) == "table") then
Tercio@20 176 t1 [key] = t1 [key] or {}
Tercio@20 177 DF.table.deploy (t1 [key], t2 [key])
Tercio@22 178 elseif (t1 [key] == nil) then
Tercio@20 179 t1 [key] = value
Tercio@20 180 end
Tercio@20 181 end
Tercio@20 182 end
Tercio@20 183
Tercio@20 184 function DF.table.dump (t, s, deep)
Tercio@20 185 s = s or ""
Tercio@20 186 deep = deep or 0
Tercio@20 187 local space = ""
Tercio@20 188 for i = 1, deep do
Tercio@20 189 space = space .. " "
Tercio@20 190 end
Tercio@20 191 for key, value in pairs (t) do
Tercio@20 192 local tpe = _type (value)
Tercio@20 193 if (type (key) ~= "string") then
Tercio@20 194 key = "unknown?"
Tercio@20 195 end
Tercio@20 196 if (tpe == "table") then
Tercio@20 197 s = s .. space .. "[" .. key .. "] = |cFFa9ffa9table {|r\n"
Tercio@20 198 s = s .. DF.table.dump (value, nil, deep+1)
Tercio@20 199 s = s .. space .. "|cFFa9ffa9}|r\n"
Tercio@20 200 elseif (tpe == "string") then
Tercio@20 201 s = s .. space .. "[" .. key .. "] = '|cFFfff1c1" .. value .. "|r'\n"
Tercio@20 202 elseif (tpe == "number") then
Tercio@20 203 s = s .. space .. "[" .. key .. "] = |cFFffc1f4" .. value .. "|r\n"
Tercio@20 204 elseif (tpe == "function") then
Tercio@20 205 s = s .. space .. "[" .. key .. "] = function()\n"
Tercio@20 206 elseif (tpe == "boolean") then
Tercio@20 207 s = s .. space .. "[" .. key .. "] = |cFF99d0ff" .. (value and "true" or "false") .. "|r\n"
Tercio@20 208 end
Tercio@20 209 end
Tercio@20 210 return s
Tercio@20 211 end
Tercio@20 212
Tercio@11 213 DF.www_icons = {
Tercio@11 214 texture = "feedback_sites",
Tercio@11 215 wowi = {0, 0.7890625, 0, 37/128},
Tercio@11 216 curse = {0, 0.7890625, 38/123, 79/128},
Tercio@11 217 mmoc = {0, 0.7890625, 80/123, 123/128},
Tercio@11 218 }
Tercio@11 219
Tercio@24 220 function DF:IntegerToTimer (value)
Tercio@24 221 return "" .. floor (value/60) .. ":" .. format ("%02.f", value%60)
Tercio@24 222 end
Tercio@24 223
Tercio@11 224 function DF:Embed (target)
Tercio@11 225 for k, v in pairs (embed_functions) do
Tercio@11 226 target[v] = self[v]
Tercio@11 227 end
Tercio@11 228 self.embeds [target] = true
Tercio@11 229 return target
Tercio@11 230 end
Tercio@11 231
Tercioo@28 232 function DF:RemoveRealmName (name)
Tercioo@28 233 return name:gsub (("%-.*"), "")
Tercioo@28 234 end
Tercioo@28 235
Tercio@20 236 function DF:RemoveRealName (name)
Tercio@20 237 return name:gsub (("%-.*"), "")
Tercio@20 238 end
Tercio@20 239
Tercio@11 240 function DF:SetFontSize (fontString, ...)
Tercio@11 241 local fonte, _, flags = fontString:GetFont()
Tercio@11 242 fontString:SetFont (fonte, max (...), flags)
Tercio@11 243 end
Tercio@11 244 function DF:SetFontFace (fontString, fontface)
Tercio@25 245 local font = SharedMedia:Fetch ("font", fontface, true)
Tercio@25 246 if (font) then
Tercio@25 247 fontface = font
Tercio@25 248 end
Tercio@25 249
Tercio@11 250 local _, size, flags = fontString:GetFont()
Tercio@11 251 fontString:SetFont (fontface, size, flags)
Tercio@11 252 end
Tercio@11 253 function DF:SetFontColor (fontString, r, g, b, a)
Tercio@11 254 r, g, b, a = DF:ParseColors (r, g, b, a)
Tercio@11 255 fontString:SetTextColor (r, g, b, a)
Tercio@11 256 end
Tercio@11 257
Tercio@11 258 function DF:GetFontSize (fontString)
Tercio@11 259 local _, size = fontString:GetFont()
Tercio@11 260 return size
Tercio@11 261 end
Tercio@11 262 function DF:GetFontFace (fontString)
Tercio@11 263 local fontface = fontString:GetFont()
Tercio@11 264 return fontface
Tercio@11 265 end
Tercio@11 266
Tercio@11 267 function DF:SetFontOutline (fontString, outline)
Tercio@11 268 local fonte, size = fontString:GetFont()
Tercio@11 269 if (outline) then
Tercio@11 270 if (_type (outline) == "boolean" and outline) then
Tercio@11 271 outline = "OUTLINE"
Tercio@11 272 elseif (outline == 1) then
Tercio@11 273 outline = "OUTLINE"
Tercio@11 274 elseif (outline == 2) then
Tercio@11 275 outline = "THICKOUTLINE"
Tercio@11 276 end
Tercio@11 277 end
Tercio@11 278
Tercio@11 279 fontString:SetFont (fonte, size, outline)
Tercio@11 280 end
Tercio@11 281
Tercio@11 282 function DF:trim (s)
Tercio@11 283 local from = s:match"^%s*()"
Tercio@11 284 return from > #s and "" or s:match(".*%S", from)
Tercio@11 285 end
Tercio@11 286
Tercio@11 287 function DF:Msg (msg)
Tercio@11 288 print ("|cFFFFFFAA" .. self.__name .. "|r " .. msg)
Tercio@11 289 end
Tercio@11 290
Tercio@11 291 function DF:GetNpcIdFromGuid (guid)
Tercio@11 292 local NpcId = select ( 6, strsplit ( "-", guid ) )
Tercio@11 293 if (NpcId) then
Tercio@11 294 return tonumber ( NpcId )
Tercio@11 295 end
Tercio@11 296 return 0
Tercio@11 297 end
Tercio@11 298
Tercio@11 299 local onFinish = function (self)
Tercio@11 300 if (self.showWhenDone) then
Tercio@11 301 self.frame:SetAlpha (1)
Tercio@11 302 else
Tercio@11 303 self.frame:SetAlpha (0)
Tercio@11 304 self.frame:Hide()
Tercio@11 305 end
Tercio@11 306
Tercio@11 307 if (self.onFinishFunc) then
Tercio@11 308 self:onFinishFunc (self.frame)
Tercio@11 309 end
Tercio@11 310 end
Tercio@11 311
Tercio@11 312 local stop = function (self)
Tercio@11 313 local FlashAnimation = self.FlashAnimation
Tercio@11 314 FlashAnimation:Stop()
Tercio@11 315 end
Tercio@11 316
Tercio@11 317 local flash = function (self, fadeInTime, fadeOutTime, flashDuration, showWhenDone, flashInHoldTime, flashOutHoldTime, loopType)
Tercio@11 318
Tercio@11 319 local FlashAnimation = self.FlashAnimation
Tercio@11 320
Tercio@11 321 local fadeIn = FlashAnimation.fadeIn
Tercio@11 322 local fadeOut = FlashAnimation.fadeOut
Tercio@11 323
Tercio@11 324 fadeIn:Stop()
Tercio@11 325 fadeOut:Stop()
Tercio@11 326
Tercio@11 327 fadeIn:SetDuration (fadeInTime or 1)
Tercio@11 328 fadeIn:SetEndDelay (flashInHoldTime or 0)
Tercio@11 329
Tercio@11 330 fadeOut:SetDuration (fadeOutTime or 1)
Tercio@11 331 fadeOut:SetEndDelay (flashOutHoldTime or 0)
Tercio@11 332
Tercio@11 333 FlashAnimation.duration = flashDuration
Tercio@11 334 FlashAnimation.loopTime = FlashAnimation:GetDuration()
Tercio@11 335 FlashAnimation.finishAt = GetTime() + flashDuration
Tercio@11 336 FlashAnimation.showWhenDone = showWhenDone
Tercio@11 337
Tercio@11 338 FlashAnimation:SetLooping (loopType or "REPEAT")
Tercio@11 339
Tercio@11 340 self:Show()
Tercio@11 341 self:SetAlpha (0)
Tercio@11 342 FlashAnimation:Play()
Tercio@11 343 end
Tercio@11 344
Tercio@11 345 function DF:CreateFlashAnimation (frame, onFinishFunc, onLoopFunc)
Tercio@11 346 local FlashAnimation = frame:CreateAnimationGroup()
Tercio@11 347
Tercio@11 348 FlashAnimation.fadeOut = FlashAnimation:CreateAnimation ("Alpha") --> fade out anime
Tercio@11 349 FlashAnimation.fadeOut:SetOrder (1)
Tercio@39 350 FlashAnimation.fadeOut:SetFromAlpha (0)
Tercio@39 351 FlashAnimation.fadeOut:SetToAlpha (1)
Tercio@11 352
Tercio@11 353 FlashAnimation.fadeIn = FlashAnimation:CreateAnimation ("Alpha") --> fade in anime
Tercio@11 354 FlashAnimation.fadeIn:SetOrder (2)
Tercio@39 355 FlashAnimation.fadeIn:SetFromAlpha (1)
Tercio@39 356 FlashAnimation.fadeIn:SetToAlpha (0)
Tercio@11 357
Tercio@11 358 frame.FlashAnimation = FlashAnimation
Tercio@11 359 FlashAnimation.frame = frame
Tercio@11 360 FlashAnimation.onFinishFunc = onFinishFunc
Tercio@11 361
Tercio@11 362 FlashAnimation:SetScript ("OnLoop", onLoopFunc)
Tercio@11 363 FlashAnimation:SetScript ("OnFinished", onFinish)
Tercio@11 364
Tercio@11 365 frame.Flash = flash
Tercio@11 366 frame.Stop = stop
Tercio@11 367 end
Tercio@11 368
Tercio@11 369 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Tercio@11 370 --> points
Tercio@11 371
Tercio@11 372 function DF:CheckPoints (v1, v2, v3, v4, v5, object)
Tercio@11 373
Tercio@11 374 if (not v1 and not v2) then
Tercio@11 375 return "topleft", object.widget:GetParent(), "topleft", 0, 0
Tercio@11 376 end
Tercio@11 377
Tercio@11 378 if (_type (v1) == "string") then
Tercio@11 379 local frameGlobal = _G [v1]
Tercio@11 380 if (frameGlobal and frameGlobal.GetObjectType) then
Tercio@11 381 return DF:CheckPoints (frameGlobal, v2, v3, v4, v5, object)
Tercio@11 382 end
Tercio@11 383
Tercio@11 384 elseif (_type (v2) == "string") then
Tercio@11 385 local frameGlobal = _G [v2]
Tercio@11 386 if (frameGlobal and frameGlobal.GetObjectType) then
Tercio@11 387 return DF:CheckPoints (v1, frameGlobal, v3, v4, v5, object)
Tercio@11 388 end
Tercio@11 389 end
Tercio@11 390
Tercio@11 391 if (_type (v1) == "string" and _type (v2) == "table") then --> :setpoint ("left", frame, _, _, _)
Tercio@11 392 if (not v3 or _type (v3) == "number") then --> :setpoint ("left", frame, 10, 10)
Tercio@11 393 v1, v2, v3, v4, v5 = v1, v2, v1, v3, v4
Tercio@11 394 end
Tercio@11 395
Tercio@11 396 elseif (_type (v1) == "string" and _type (v2) == "number") then --> :setpoint ("topleft", x, y)
Tercio@11 397 v1, v2, v3, v4, v5 = v1, object.widget:GetParent(), v1, v2, v3
Tercio@11 398
Tercio@11 399 elseif (_type (v1) == "number") then --> :setpoint (x, y)
Tercio@11 400 v1, v2, v3, v4, v5 = "topleft", object.widget:GetParent(), "topleft", v1, v2
Tercio@11 401
Tercio@11 402 elseif (_type (v1) == "table") then --> :setpoint (frame, x, y)
Tercio@11 403 v1, v2, v3, v4, v5 = "topleft", v1, "topleft", v2, v3
Tercio@11 404
Tercio@11 405 end
Tercio@11 406
Tercio@11 407 if (not v2) then
Tercio@11 408 v2 = object.widget:GetParent()
Tercio@11 409 elseif (v2.dframework) then
Tercio@11 410 v2 = v2.widget
Tercio@11 411 end
Tercio@11 412
Tercio@11 413 return v1 or "topleft", v2, v3 or "topleft", v4 or 0, v5 or 0
Tercio@11 414 end
Tercio@11 415
Tercio@11 416
Tercio@11 417 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Tercio@11 418 --> colors
Tercio@11 419
Tercio@11 420 function DF:NewColor (_colorname, _colortable, _green, _blue, _alpha)
Tercio@11 421 assert (_type (_colorname) == "string", "NewColor: colorname must be a string.")
Tercio@11 422 assert (not DF.alias_text_colors [_colorname], "NewColor: colorname already exists.")
Tercio@11 423
Tercio@11 424 if (_type (_colortable) == "table") then
Tercio@11 425 if (_colortable[1] and _colortable[2] and _colortable[3]) then
Tercio@11 426 _colortable[4] = _colortable[4] or 1
Tercio@11 427 DF.alias_text_colors [_colorname] = _colortable
Tercio@11 428 else
Tercio@11 429 error ("invalid color table.")
Tercio@11 430 end
Tercio@11 431 elseif (_colortable and _green and _blue) then
Tercio@11 432 _alpha = _alpha or 1
Tercio@11 433 DF.alias_text_colors [_colorname] = {_colortable, _green, _blue, _alpha}
Tercio@11 434 else
Tercio@11 435 error ("invalid parameter.")
Tercio@11 436 end
Tercio@11 437
Tercio@11 438 return true
Tercio@11 439 end
Tercio@11 440
Tercio@11 441 function DF:IsHtmlColor (color)
Tercio@11 442 return DF.alias_text_colors [color]
Tercio@11 443 end
Tercio@11 444
Tercio@11 445 local tn = tonumber
Tercio@11 446 function DF:ParseColors (_arg1, _arg2, _arg3, _arg4)
Tercio@11 447 if (_type (_arg1) == "table") then
Tercio@25 448 if (not _arg1[1] and _arg1.r) then
Tercio@25 449 _arg1, _arg2, _arg3, _arg4 = _arg1.r, _arg1.g, _arg1.b, _arg1.a
Tercio@25 450 else
Tercio@25 451 _arg1, _arg2, _arg3, _arg4 = _unpack (_arg1)
Tercio@25 452 end
Tercio@11 453
Tercio@11 454 elseif (_type (_arg1) == "string") then
Tercio@11 455
Tercio@11 456 if (string.find (_arg1, "#")) then
Tercio@11 457 _arg1 = _arg1:gsub ("#","")
Tercio@11 458 if (string.len (_arg1) == 8) then --alpha
Tercio@11 459 _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 460 else
Tercio@11 461 _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 462 end
Tercio@11 463
Tercio@11 464 else
Tercio@11 465 local color = DF.alias_text_colors [_arg1]
Tercio@11 466 if (color) then
Tercio@11 467 _arg1, _arg2, _arg3, _arg4 = _unpack (color)
Tercio@11 468 else
Tercio@11 469 _arg1, _arg2, _arg3, _arg4 = _unpack (DF.alias_text_colors.none)
Tercio@11 470 end
Tercio@11 471 end
Tercio@11 472 end
Tercio@11 473
Tercio@11 474 if (not _arg1) then
Tercio@11 475 _arg1 = 1
Tercio@11 476 end
Tercio@11 477 if (not _arg2) then
Tercio@11 478 _arg2 = 1
Tercio@11 479 end
Tercio@11 480 if (not _arg3) then
Tercio@11 481 _arg3 = 1
Tercio@11 482 end
Tercio@11 483 if (not _arg4) then
Tercio@11 484 _arg4 = 1
Tercio@11 485 end
Tercio@11 486
Tercio@11 487 return _arg1, _arg2, _arg3, _arg4
Tercio@11 488 end
Tercio@11 489
Tercio@11 490 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Tercio@11 491 --> menus
Tercio@11 492
Tercio@39 493 local disable_on_combat = {}
Tercio@39 494
Tercio@22 495 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 496
Tercio@22 497 if (not parent.widget_list) then
Tercio@22 498 DF:SetAsOptionsPanel (parent)
Tercio@22 499 end
Tercio@11 500
Tercio@11 501 local cur_x = x_offset
Tercio@11 502 local cur_y = y_offset
Tercio@11 503 local max_x = 0
Tercio@11 504
Tercio@11 505 height = abs ((height or parent:GetHeight()) - abs (y_offset) + 20)
Tercio@11 506 height = height*-1
Tercio@11 507
Tercio@11 508 for index, widget_table in ipairs (menu) do
Tercio@11 509
Tercio@39 510 local widget_created
Tercio@39 511
Tercio@20 512 if (widget_table.type == "blank" or widget_table.type == "space") then
Tercio@20 513 -- do nothing
Tercio@20 514
Tercio@20 515 elseif (widget_table.type == "label" or widget_table.type == "text") then
Tercio@22 516 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 517 label._get = widget_table.get
Tercio@20 518 label.widget_type = "label"
Tercio@20 519 label:SetPoint (cur_x, cur_y)
Tercio@20 520 tinsert (parent.widget_list, label)
Tercio@20 521
Tercio@20 522 elseif (widget_table.type == "select" or widget_table.type == "dropdown") then
Tercio@22 523 local dropdown = DF:NewDropDown (parent, nil, "$parentWidget" .. index, nil, 140, 18, widget_table.values, widget_table.get(), dropdown_template)
Tercio@11 524 dropdown.tooltip = widget_table.desc
Tercio@20 525 dropdown._get = widget_table.get
Tercio@20 526 dropdown.widget_type = "select"
Tercio@22 527 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 528 dropdown:SetPoint ("left", label, "right", 2)
Tercio@11 529 label:SetPoint (cur_x, cur_y)
Tercio@11 530
Tercio@11 531 local size = label.widget:GetStringWidth() + 140 + 4
Tercio@11 532 if (size > max_x) then
Tercio@11 533 max_x = size
Tercio@11 534 end
Tercio@11 535
Tercio@20 536 tinsert (parent.widget_list, dropdown)
Tercio@39 537 widget_created = dropdown
Tercio@20 538
Tercio@11 539 elseif (widget_table.type == "toggle" or widget_table.type == "switch") then
Tercio@22 540 local switch = DF:NewSwitch (parent, nil, "$parentWidget" .. index, nil, 60, 20, nil, nil, widget_table.get(), nil, nil, nil, nil, switch_template)
Tercio@11 541 switch.tooltip = widget_table.desc
Tercio@20 542 switch._get = widget_table.get
Tercio@20 543 switch.widget_type = "toggle"
Tercio@11 544 switch.OnSwitch = widget_table.set
Tercio@11 545
Tercio@22 546 if (switch_is_box) then
Tercio@22 547 switch:SetAsCheckBox()
Tercio@22 548 end
Tercio@22 549
Tercio@22 550 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 551 switch:SetPoint ("left", label, "right", 2)
Tercio@11 552 label:SetPoint (cur_x, cur_y)
Tercio@11 553
Tercio@11 554 local size = label.widget:GetStringWidth() + 60 + 4
Tercio@11 555 if (size > max_x) then
Tercio@11 556 max_x = size
Tercio@11 557 end
Tercio@11 558
Tercio@20 559 tinsert (parent.widget_list, switch)
Tercio@39 560 widget_created = switch
Tercio@20 561
Tercio@11 562 elseif (widget_table.type == "range" or widget_table.type == "slider") then
Tercio@11 563 local is_decimanls = widget_table.usedecimals
Tercio@22 564 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 565 slider.tooltip = widget_table.desc
Tercio@20 566 slider._get = widget_table.get
Tercio@20 567 slider.widget_type = "range"
Tercio@11 568 slider:SetHook ("OnValueChange", widget_table.set)
Tercio@11 569
Tercio@40 570 if (widget_table.thumbscale) then
Tercio@40 571 slider:SetThumbSize (slider.thumb:GetWidth()*widget_table.thumbscale, nil)
Tercio@40 572 end
Tercio@40 573
Tercio@22 574 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 575 slider:SetPoint ("left", label, "right", 2)
Tercio@11 576 label:SetPoint (cur_x, cur_y)
Tercio@11 577
Tercio@11 578 local size = label.widget:GetStringWidth() + 140 + 6
Tercio@11 579 if (size > max_x) then
Tercio@11 580 max_x = size
Tercio@11 581 end
Tercio@11 582
Tercio@20 583 tinsert (parent.widget_list, slider)
Tercio@39 584 widget_created = slider
Tercio@20 585
Tercio@11 586 elseif (widget_table.type == "color" or widget_table.type == "color") then
Tercio@22 587 local colorpick = DF:NewColorPickButton (parent, "$parentWidget" .. index, nil, widget_table.set, nil, button_template)
Tercio@11 588 colorpick.tooltip = widget_table.desc
Tercio@20 589 colorpick._get = widget_table.get
Tercio@20 590 colorpick.widget_type = "color"
Tercio@11 591
Tercio@11 592 local default_value, g, b, a = widget_table.get()
Tercio@11 593 if (type (default_value) == "table") then
Tercio@11 594 colorpick:SetColor (unpack (default_value))
Tercio@11 595 else
Tercio@11 596 colorpick:SetColor (default_value, g, b, a)
Tercio@11 597 end
Tercio@11 598
Tercio@22 599 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 600 colorpick:SetPoint ("left", label, "right", 2)
Tercio@11 601 label:SetPoint (cur_x, cur_y)
Tercio@11 602
Tercio@11 603 local size = label.widget:GetStringWidth() + 60 + 4
Tercio@11 604 if (size > max_x) then
Tercio@11 605 max_x = size
Tercio@11 606 end
Tercio@11 607
Tercio@20 608 tinsert (parent.widget_list, colorpick)
Tercio@39 609 widget_created = colorpick
Tercio@20 610
Tercio@11 611 elseif (widget_table.type == "execute" or widget_table.type == "button") then
Tercio@11 612
Tercio@22 613 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 614 if (not button_template) then
Tercio@22 615 button:InstallCustomTexture()
Tercio@22 616 end
Tercio@22 617
Tercio@11 618 button:SetPoint (cur_x, cur_y)
Tercio@11 619 button.tooltip = widget_table.desc
Tercio@20 620 button.widget_type = "execute"
Tercio@11 621
Tercio@11 622 local size = button:GetWidth() + 4
Tercio@11 623 if (size > max_x) then
Tercio@11 624 max_x = size
Tercio@11 625 end
Tercio@11 626
Tercio@20 627 tinsert (parent.widget_list, button)
Tercio@39 628 widget_created = button
Tercio@20 629
Tercio@11 630 end
Tercio@39 631
Tercio@39 632 if (widget_table.nocombat) then
Tercio@39 633 tinsert (disable_on_combat, widget_created)
Tercio@39 634 end
Tercio@11 635
Tercio@11 636 if (widget_table.spacement) then
Tercio@11 637 cur_y = cur_y - 30
Tercio@11 638 else
Tercio@11 639 cur_y = cur_y - 20
Tercio@11 640 end
Tercio@11 641
Tercio@39 642 if (widget_table.type == "breakline" or cur_y < height) then
Tercio@11 643 cur_y = y_offset
Tercio@11 644 cur_x = cur_x + max_x + 30
Tercio@11 645 max_x = 0
Tercio@11 646 end
Tercio@11 647
Tercio@11 648 end
Tercio@11 649
Tercio@39 650 DF.RefreshUnsafeOptionsWidgets()
Tercio@39 651
Tercio@11 652 end
Tercio@39 653
Tercio@39 654 local lock_notsafe_widgets = function()
Tercio@39 655 for _, widget in ipairs (disable_on_combat) do
Tercio@39 656 widget:Disable()
Tercio@39 657 end
Tercio@39 658 end
Tercio@39 659 local unlock_notsafe_widgets = function()
Tercio@39 660 for _, widget in ipairs (disable_on_combat) do
Tercio@39 661 widget:Enable()
Tercio@39 662 end
Tercio@39 663 end
Tercio@39 664 function DF.RefreshUnsafeOptionsWidgets()
Tercio@39 665 if (DF.PlayerHasCombatFlag) then
Tercio@39 666 lock_notsafe_widgets()
Tercio@39 667 else
Tercio@39 668 unlock_notsafe_widgets()
Tercio@39 669 end
Tercio@39 670 end
Tercio@39 671 DF.PlayerHasCombatFlag = false
Tercio@39 672 local ProtectCombatFrame = CreateFrame ("frame")
Tercio@39 673 ProtectCombatFrame:RegisterEvent ("PLAYER_REGEN_ENABLED")
Tercio@39 674 ProtectCombatFrame:RegisterEvent ("PLAYER_REGEN_DISABLED")
Tercio@39 675 ProtectCombatFrame:RegisterEvent ("PLAYER_ENTERING_WORLD")
Tercio@39 676 ProtectCombatFrame:SetScript ("OnEvent", function (self, event)
Tercio@39 677 if (event == "PLAYER_ENTERING_WORLD") then
Tercio@39 678 if (InCombatLockdown()) then
Tercio@39 679 DF.PlayerHasCombatFlag = true
Tercio@39 680 else
Tercio@39 681 DF.PlayerHasCombatFlag = false
Tercio@39 682 end
Tercio@39 683 DF.RefreshUnsafeOptionsWidgets()
Tercio@39 684
Tercio@39 685 elseif (event == "PLAYER_REGEN_ENABLED") then
Tercio@39 686 DF.PlayerHasCombatFlag = false
Tercio@39 687 DF.RefreshUnsafeOptionsWidgets()
Tercio@39 688
Tercio@39 689 elseif (event == "PLAYER_REGEN_DISABLED") then
Tercio@39 690 DF.PlayerHasCombatFlag = true
Tercio@39 691 DF.RefreshUnsafeOptionsWidgets()
Tercio@39 692
Tercio@39 693 end
Tercio@39 694 end)
Tercio@40 695
Tercio@40 696 function DF:CreateInCombatTexture (frame)
Tercio@40 697 if (DF.debug and not frame) then
Tercio@40 698 error ("Details! Framework: CreateInCombatTexture invalid frame on parameter 1.")
Tercio@40 699 end
Tercio@40 700
Tercio@40 701 local in_combat_background = DF:CreateImage (frame)
Tercio@40 702 in_combat_background:SetColorTexture (.6, 0, 0, .1)
Tercio@40 703 in_combat_background:Hide()
Tercio@40 704
Tercio@40 705 local in_combat_label = Plater:CreateLabel (frame, "you are in combat", 24, "silver")
Tercio@40 706 in_combat_label:SetPoint ("right", in_combat_background, "right", -10, 0)
Tercio@40 707 in_combat_label:Hide()
Tercio@40 708
Tercio@40 709 frame:RegisterEvent ("PLAYER_REGEN_DISABLED")
Tercio@40 710 frame:RegisterEvent ("PLAYER_REGEN_ENABLED")
Tercio@40 711 frame:SetScript ("OnEvent", function (self, event)
Tercio@40 712 if (event == "PLAYER_REGEN_DISABLED") then
Tercio@40 713 in_combat_background:Show()
Tercio@40 714 in_combat_label:Show()
Tercio@40 715 elseif (event == "PLAYER_REGEN_ENABLED") then
Tercio@40 716 in_combat_background:Hide()
Tercio@40 717 in_combat_label:Hide()
Tercio@40 718 end
Tercio@40 719 end)
Tercio@40 720
Tercio@40 721 return in_combat_background
Tercio@40 722 end
Tercio@11 723
Tercio@11 724 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Tercio@11 725 --> tutorials
Tercio@11 726
Tercio@11 727 function DF:ShowTutorialAlertFrame (maintext, desctext, clickfunc)
Tercio@11 728
Tercio@11 729 local TutorialAlertFrame = _G.DetailsFrameworkTutorialAlertFrame
Tercio@11 730
Tercio@11 731 if (not TutorialAlertFrame) then
Tercio@11 732
Tercio@11 733 TutorialAlertFrame = CreateFrame ("ScrollFrame", "DetailsFrameworkTutorialAlertFrame", UIParent, "DetailsFrameworkTutorialAlertFrameTemplate")
Tercio@11 734 TutorialAlertFrame.isFirst = true
Tercio@11 735 TutorialAlertFrame:SetPoint ("left", UIParent, "left", -20, 100)
Tercio@11 736
Tercio@11 737 TutorialAlertFrame:SetWidth (290)
Tercio@11 738 TutorialAlertFrame.ScrollChild:SetWidth (256)
Tercio@11 739
Tercio@11 740 local scrollname = TutorialAlertFrame.ScrollChild:GetName()
Tercio@11 741 _G [scrollname .. "BorderTopLeft"]:SetVertexColor (1, 0.8, 0, 1)
Tercio@11 742 _G [scrollname .. "BorderTopRight"]:SetVertexColor (1, 0.8, 0, 1)
Tercio@11 743 _G [scrollname .. "BorderBotLeft"]:SetVertexColor (1, 0.8, 0, 1)
Tercio@11 744 _G [scrollname .. "BorderBotRight"]:SetVertexColor (1, 0.8, 0, 1)
Tercio@11 745 _G [scrollname .. "BorderLeft"]:SetVertexColor (1, 0.8, 0, 1)
Tercio@11 746 _G [scrollname .. "BorderRight"]:SetVertexColor (1, 0.8, 0, 1)
Tercio@11 747 _G [scrollname .. "BorderBottom"]:SetVertexColor (1, 0.8, 0, 1)
Tercio@11 748 _G [scrollname .. "BorderTop"]:SetVertexColor (1, 0.8, 0, 1)
Tercio@11 749
Tercio@11 750 local iconbg = _G [scrollname .. "QuestIconBg"]
Tercio@11 751 iconbg:SetTexture ([[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]])
Tercio@11 752 iconbg:SetTexCoord (0, 1, 0, 1)
Tercio@11 753 iconbg:SetSize (100, 100)
Tercio@11 754 iconbg:ClearAllPoints()
Tercio@11 755 iconbg:SetPoint ("bottomleft", TutorialAlertFrame.ScrollChild, "bottomleft")
Tercio@11 756
Tercio@11 757 _G [scrollname .. "Exclamation"]:SetVertexColor (1, 0.8, 0, 1)
Tercio@11 758 _G [scrollname .. "QuestionMark"]:SetVertexColor (1, 0.8, 0, 1)
Tercio@11 759
Tercio@11 760 _G [scrollname .. "TopText"]:SetText ("Details!") --string
Tercio@11 761 _G [scrollname .. "QuestName"]:SetText ("") --string
Tercio@11 762 _G [scrollname .. "BottomText"]:SetText ("") --string
Tercio@11 763
Tercio@11 764 TutorialAlertFrame.ScrollChild.IconShine:SetTexture ([[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]])
Tercio@11 765
Tercio@11 766 TutorialAlertFrame:SetScript ("OnMouseUp", function (self)
Tercio@11 767 if (self.clickfunc and type (self.clickfunc) == "function") then
Tercio@11 768 self.clickfunc()
Tercio@11 769 end
Tercio@11 770 self:Hide()
Tercio@11 771 end)
Tercio@11 772 TutorialAlertFrame:Hide()
Tercio@11 773 end
Tercio@11 774
Tercio@11 775 if (type (maintext) == "string") then
Tercio@11 776 TutorialAlertFrame.ScrollChild.QuestName:SetText (maintext)
Tercio@11 777 else
Tercio@11 778 TutorialAlertFrame.ScrollChild.QuestName:SetText ("")
Tercio@11 779 end
Tercio@11 780
Tercio@11 781 if (type (desctext) == "string") then
Tercio@11 782 TutorialAlertFrame.ScrollChild.BottomText:SetText (desctext)
Tercio@11 783 else
Tercio@11 784 TutorialAlertFrame.ScrollChild.BottomText:SetText ("")
Tercio@11 785 end
Tercio@11 786
Tercio@11 787 TutorialAlertFrame.clickfunc = clickfunc
Tercio@11 788 TutorialAlertFrame:Show()
Tercio@11 789 DetailsTutorialAlertFrame_SlideInFrame (TutorialAlertFrame, "AUTOQUEST")
Tercio@11 790 end
Tercio@11 791
Tercio@20 792 local refresh_options = function (self)
Tercio@20 793 for _, widget in ipairs (self.widget_list) do
Tercio@20 794 if (widget._get) then
Tercio@20 795 if (widget.widget_type == "label") then
Tercio@20 796 if (widget._get()) then
Tercio@20 797 widget:SetText (widget._get())
Tercio@20 798 end
Tercio@20 799 elseif (widget.widget_type == "select") then
Tercio@20 800 widget:Select (widget._get())
Tercio@20 801 elseif (widget.widget_type == "toggle" or widget.widget_type == "range") then
Tercio@20 802 widget:SetValue (widget._get())
Tercio@20 803 elseif (widget.widget_type == "color") then
Tercio@20 804 local default_value, g, b, a = widget._get()
Tercio@20 805 if (type (default_value) == "table") then
Tercio@20 806 widget:SetColor (unpack (default_value))
Tercio@20 807 else
Tercio@20 808 widget:SetColor (default_value, g, b, a)
Tercio@20 809 end
Tercio@20 810 end
Tercio@20 811 end
Tercio@20 812 end
Tercio@20 813 end
Tercio@20 814
Tercio@20 815 function DF:SetAsOptionsPanel (frame)
Tercio@20 816 frame.RefreshOptions = refresh_options
Tercio@20 817 frame.widget_list = {}
Tercio@20 818 end
Tercio@20 819
Tercio@11 820 function DF:CreateOptionsFrame (name, title, template)
Tercio@11 821
Tercio@11 822 template = template or 1
Tercio@11 823
Tercio@11 824 if (template == 2) then
Tercio@11 825 local options_frame = CreateFrame ("frame", name, UIParent, "ButtonFrameTemplate")
Tercio@11 826 tinsert (UISpecialFrames, name)
Tercio@11 827 options_frame:SetSize (500, 200)
Tercio@20 828 options_frame.RefreshOptions = refresh_options
Tercio@20 829 options_frame.widget_list = {}
Tercio@11 830
Tercio@11 831 options_frame:SetScript ("OnMouseDown", function(self, button)
Tercio@11 832 if (button == "RightButton") then
Tercio@11 833 if (self.moving) then
Tercio@11 834 self.moving = false
Tercio@11 835 self:StopMovingOrSizing()
Tercio@11 836 end
Tercio@11 837 return options_frame:Hide()
Tercio@11 838 elseif (button == "LeftButton" and not self.moving) then
Tercio@11 839 self.moving = true
Tercio@11 840 self:StartMoving()
Tercio@11 841 end
Tercio@11 842 end)
Tercio@11 843 options_frame:SetScript ("OnMouseUp", function(self)
Tercio@11 844 if (self.moving) then
Tercio@11 845 self.moving = false
Tercio@11 846 self:StopMovingOrSizing()
Tercio@11 847 end
Tercio@11 848 end)
Tercio@11 849
Tercio@11 850 options_frame:SetMovable (true)
Tercio@11 851 options_frame:EnableMouse (true)
Tercio@11 852 options_frame:SetFrameStrata ("DIALOG")
Tercio@11 853 options_frame:SetToplevel (true)
Tercio@11 854
Tercio@11 855 options_frame:Hide()
Tercio@11 856
Tercio@11 857 options_frame:SetPoint ("center", UIParent, "center")
Tercio@11 858 options_frame.TitleText:SetText (title)
Tercio@11 859 options_frame.portrait:SetTexture ([[Interface\CHARACTERFRAME\TEMPORARYPORTRAIT-FEMALE-BLOODELF]])
Tercio@11 860
Tercio@11 861 return options_frame
Tercio@11 862
Tercio@11 863 elseif (template == 1) then
Tercio@11 864
Tercio@11 865 local options_frame = CreateFrame ("frame", name, UIParent)
Tercio@11 866 tinsert (UISpecialFrames, name)
Tercio@11 867 options_frame:SetSize (500, 200)
Tercio@20 868 options_frame.RefreshOptions = refresh_options
Tercio@20 869 options_frame.widget_list = {}
Tercio@11 870
Tercio@11 871 options_frame:SetScript ("OnMouseDown", function(self, button)
Tercio@11 872 if (button == "RightButton") then
Tercio@11 873 if (self.moving) then
Tercio@11 874 self.moving = false
Tercio@11 875 self:StopMovingOrSizing()
Tercio@11 876 end
Tercio@11 877 return options_frame:Hide()
Tercio@11 878 elseif (button == "LeftButton" and not self.moving) then
Tercio@11 879 self.moving = true
Tercio@11 880 self:StartMoving()
Tercio@11 881 end
Tercio@11 882 end)
Tercio@11 883 options_frame:SetScript ("OnMouseUp", function(self)
Tercio@11 884 if (self.moving) then
Tercio@11 885 self.moving = false
Tercio@11 886 self:StopMovingOrSizing()
Tercio@11 887 end
Tercio@11 888 end)
Tercio@11 889
Tercio@11 890 options_frame:SetMovable (true)
Tercio@11 891 options_frame:EnableMouse (true)
Tercio@11 892 options_frame:SetFrameStrata ("DIALOG")
Tercio@11 893 options_frame:SetToplevel (true)
Tercio@11 894
Tercio@11 895 options_frame:Hide()
Tercio@11 896
Tercio@11 897 options_frame:SetPoint ("center", UIParent, "center")
Tercio@11 898
Tercio@11 899 options_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16,
Tercio@18 900 edgeFile = DF.folder .. "border_2", edgeSize = 32,
Tercio@11 901 insets = {left = 1, right = 1, top = 1, bottom = 1}})
Tercio@11 902 options_frame:SetBackdropColor (0, 0, 0, .7)
Tercio@11 903
Tercio@11 904 local texturetitle = options_frame:CreateTexture (nil, "artwork")
Tercio@11 905 texturetitle:SetTexture ([[Interface\CURSOR\Interact]])
Tercio@11 906 texturetitle:SetTexCoord (0, 1, 0, 1)
Tercio@11 907 texturetitle:SetVertexColor (1, 1, 1, 1)
Tercio@11 908 texturetitle:SetPoint ("topleft", options_frame, "topleft", 2, -3)
Tercio@11 909 texturetitle:SetWidth (36)
Tercio@11 910 texturetitle:SetHeight (36)
Tercio@11 911
Tercio@11 912 local title = DF:NewLabel (options_frame, nil, "$parentTitle", nil, title, nil, 20, "yellow")
Tercio@11 913 title:SetPoint ("left", texturetitle, "right", 2, -1)
Tercio@11 914 DF:SetFontOutline (title, true)
Tercio@11 915
Tercio@11 916 local c = CreateFrame ("Button", nil, options_frame, "UIPanelCloseButton")
Tercio@11 917 c:SetWidth (32)
Tercio@11 918 c:SetHeight (32)
Tercio@11 919 c:SetPoint ("TOPRIGHT", options_frame, "TOPRIGHT", -3, -3)
Tercio@11 920 c:SetFrameLevel (options_frame:GetFrameLevel()+1)
Tercio@11 921
Tercio@11 922 return options_frame
Tercio@11 923 end
Tercio@22 924 end
Tercio@22 925
Tercio@22 926 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Tercio@22 927 --> templates
Tercio@22 928
Tercio@22 929 DF.font_templates = {}
Tercio@22 930 DF.font_templates ["ORANGE_FONT_TEMPLATE"] = {color = "orange", size = 11, font = "Accidental Presidency"}
Tercio@22 931 DF.font_templates ["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 12, font = "Accidental Presidency"}
Tercio@22 932
Tercio@22 933 DF.dropdown_templates = {}
Tercio@22 934 DF.dropdown_templates ["OPTIONS_DROPDOWN_TEMPLATE"] = {
Tercio@22 935 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
Tercio@22 936 backdropcolor = {1, 1, 1, .5},
Tercio@22 937 backdropbordercolor = {0, 0, 0, 1},
Tercio@22 938 onentercolor = {1, 1, 1, .5},
Tercio@22 939 onenterbordercolor = {1, 1, 1, 1},
Tercio@22 940 }
Tercio@22 941
Tercio@22 942 DF.switch_templates = {}
Tercio@22 943 DF.switch_templates ["OPTIONS_CHECKBOX_TEMPLATE"] = {
Tercio@22 944 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
Tercio@22 945 backdropcolor = {1, 1, 1, .5},
Tercio@22 946 backdropbordercolor = {0, 0, 0, 1},
Tercio@22 947 width = 18,
Tercio@22 948 height = 18,
Tercio@22 949 enabled_backdropcolor = {1, 1, 1, .5},
Tercio@22 950 disabled_backdropcolor = {1, 1, 1, .2},
Tercio@22 951 onenterbordercolor = {1, 1, 1, 1},
Tercio@22 952 }
Tercio@22 953 DF.switch_templates ["OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"] = {
Tercio@22 954 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
Tercio@22 955 backdropcolor = {1, 1, 1, .5},
Tercio@22 956 backdropbordercolor = {0, 0, 0, 1},
Tercio@22 957 width = 18,
Tercio@22 958 height = 18,
Tercio@22 959 enabled_backdropcolor = {1, 1, 1, .5},
Tercio@22 960 disabled_backdropcolor = {1, 1, 1, .5},
Tercio@22 961 onenterbordercolor = {1, 1, 1, 1},
Tercio@22 962 }
Tercio@22 963
Tercio@22 964 DF.button_templates = {}
Tercio@22 965 DF.button_templates ["OPTIONS_BUTTON_TEMPLATE"] = {
Tercio@22 966 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
Tercio@22 967 backdropcolor = {1, 1, 1, .5},
Tercio@22 968 backdropbordercolor = {0, 0, 0, 1},
Tercio@22 969 }
Tercio@22 970
Tercio@22 971 DF.slider_templates = {}
Tercio@22 972 DF.slider_templates ["OPTIONS_SLIDER_TEMPLATE"] = {
Tercio@22 973 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
Tercio@22 974 backdropcolor = {1, 1, 1, .5},
Tercio@22 975 backdropbordercolor = {0, 0, 0, 1},
Tercio@22 976 onentercolor = {1, 1, 1, .5},
Tercio@22 977 onenterbordercolor = {1, 1, 1, 1},
Tercio@22 978 thumbtexture = [[Interface\Tooltips\UI-Tooltip-Background]],
Tercio@22 979 thumbwidth = 16,
Tercio@22 980 thumbheight = 14,
Tercio@22 981 thumbcolor = {0, 0, 0, 0.5},
Tercio@22 982 }
Tercio@22 983
Tercioo@29 984 function DF:InstallTemplate (widget_type, template_name, template)
Tercioo@29 985 widget_type = string.lower (widget_type)
Tercioo@29 986
Tercio@22 987 local template_table
Tercioo@29 988 if (widget_type == "font") then
Tercio@22 989 template_table = DF.font_templates
Tercioo@29 990 elseif (widget_type == "dropdown") then
Tercio@22 991 template_table = DF.dropdown_templates
Tercioo@29 992 elseif (widget_type == "button") then
Tercio@22 993 template_table = DF.button_templates
Tercioo@29 994 elseif (widget_type == "switch") then
Tercio@22 995 template_table = DF.switch_templates
Tercioo@29 996 elseif (widget_type == "slider") then
Tercioo@29 997 template_table = DF.slider_templates
Tercioo@29 998 end
Tercioo@29 999
Tercioo@29 1000 template_table [template_name] = template
Tercioo@29 1001
Tercioo@29 1002 return template
Tercioo@29 1003 end
Tercioo@29 1004
Tercioo@29 1005 function DF:GetTemplate (widget_type, template_name)
Tercioo@29 1006 widget_type = string.lower (widget_type)
Tercioo@29 1007
Tercioo@29 1008 local template_table
Tercioo@29 1009 if (widget_type == "font") then
Tercioo@29 1010 template_table = DF.font_templates
Tercioo@29 1011 elseif (widget_type == "dropdown") then
Tercioo@29 1012 template_table = DF.dropdown_templates
Tercioo@29 1013 elseif (widget_type == "button") then
Tercioo@29 1014 template_table = DF.button_templates
Tercioo@29 1015 elseif (widget_type == "switch") then
Tercioo@29 1016 template_table = DF.switch_templates
Tercioo@29 1017 elseif (widget_type == "slider") then
Tercio@22 1018 template_table = DF.slider_templates
Tercio@22 1019 end
Tercio@22 1020 return template_table [template_name]
Tercio@22 1021 end
Tercioo@28 1022
Tercioo@28 1023 function DF.GetParentName (frame)
Tercioo@28 1024 local parentName = frame:GetName()
Tercioo@28 1025 if (not parentName) then
Tercioo@28 1026 error ("Details! FrameWork: called $parent but parent was no name.", 2)
Tercioo@28 1027 end
Tercioo@28 1028 return parentName
Tercioo@28 1029 end
Tercio@39 1030
Tercio@39 1031 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Tercio@39 1032 --> widget scripts and hooks
Tercio@39 1033
Tercio@39 1034 function DF:RunHooksForWidget (event, ...)
Tercio@39 1035 local hooks = self.HookList [event]
Tercio@39 1036
Tercio@39 1037 if (not hooks) then
Tercio@39 1038 print (self.widget:GetName(), "sem hook para", event)
Tercio@39 1039 return
Tercio@39 1040 end
Tercio@39 1041
Tercio@39 1042 for i, func in ipairs (hooks) do
Tercio@39 1043 local success, canInterrupt = pcall (func, ...)
Tercio@39 1044 if (not success) then
Tercio@39 1045 error ("Details! Framework: " .. event .. " hook for " .. self:GetName() .. ": " .. canInterrupt)
Tercio@39 1046 elseif (canInterrupt) then
Tercio@39 1047 return true
Tercio@39 1048 end
Tercio@39 1049 end
Tercio@39 1050 end
Tercio@39 1051
Tercio@39 1052 function DF:SetHook (hookType, func)
Tercio@39 1053 if (self.HookList [hookType]) then
Tercio@39 1054 if (type (func) == "function") then
Tercio@39 1055 local isRemoval = false
Tercio@39 1056 for i = #self.HookList [hookType], 1, -1 do
Tercio@39 1057 if (self.HookList [hookType] [i] == func) then
Tercio@39 1058 tremove (self.HookList [hookType], i)
Tercio@39 1059 isRemoval = true
Tercio@39 1060 break
Tercio@39 1061 end
Tercio@39 1062 end
Tercio@39 1063 if (not isRemoval) then
Tercio@39 1064 tinsert (self.HookList [hookType], func)
Tercio@39 1065 end
Tercio@39 1066 else
Tercio@39 1067 if (DF.debug) then
Tercio@39 1068 error ("Details! Framework: invalid function for widget " .. self.WidgetType .. ".")
Tercio@39 1069 end
Tercio@39 1070 end
Tercio@39 1071 else
Tercio@39 1072 if (DF.debug) then
Tercio@39 1073 error ("Details! Framework: unknown hook type for widget " .. self.WidgetType .. ": '" .. hookType .. "'.")
Tercio@39 1074 end
Tercio@39 1075 end
Tercio@39 1076 end
Tercio@39 1077
Tercio@39 1078 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Tercio@39 1079 --> members
Tercio@39 1080
Tercio@39 1081 DF.GlobalWidgetControlNames = {
Tercio@39 1082 textentry = "DF_TextEntryMetaFunctions",
Tercio@39 1083 button = "DF_ButtonMetaFunctions",
Tercio@39 1084 panel = "DF_PanelMetaFunctions",
Tercio@39 1085 dropdown = "DF_DropdownMetaFunctions",
Tercio@39 1086 label = "DF_LabelMetaFunctions",
Tercio@39 1087 normal_bar = "DF_NormalBarMetaFunctions",
Tercio@39 1088 image = "DF_ImageMetaFunctions",
Tercio@39 1089 slider = "DF_SliderMetaFunctions",
Tercio@39 1090 split_bar = "DF_SplitBarMetaFunctions",
Tercio@40 1091 aura_tracker = "DF_AuraTracker",
Tercio@39 1092 }
Tercio@39 1093
Tercio@39 1094 function DF:AddMemberForWidget (widgetName, memberType, memberName, func)
Tercio@39 1095 if (DF.GlobalWidgetControlNames [widgetName]) then
Tercio@39 1096 if (type (memberName) == "string" and (memberType == "SET" or memberType == "GET")) then
Tercio@39 1097 if (func) then
Tercio@39 1098 local widgetControlObject = _G [DF.GlobalWidgetControlNames [widgetName]]
Tercio@39 1099
Tercio@39 1100 if (memberType == "SET") then
Tercio@39 1101 widgetControlObject ["SetMembers"] [memberName] = func
Tercio@39 1102 elseif (memberType == "GET") then
Tercio@39 1103 widgetControlObject ["GetMembers"] [memberName] = func
Tercio@39 1104 end
Tercio@39 1105 else
Tercio@39 1106 if (DF.debug) then
Tercio@39 1107 error ("Details! Framework: AddMemberForWidget invalid function.")
Tercio@39 1108 end
Tercio@39 1109 end
Tercio@39 1110 else
Tercio@39 1111 if (DF.debug) then
Tercio@39 1112 error ("Details! Framework: AddMemberForWidget unknown memberName or memberType.")
Tercio@39 1113 end
Tercio@39 1114 end
Tercio@39 1115 else
Tercio@39 1116 if (DF.debug) then
Tercio@39 1117 error ("Details! Framework: AddMemberForWidget unknown widget type: " .. (widgetName or "") .. ".")
Tercio@39 1118 end
Tercio@39 1119 end
Tercio@39 1120 end
Tercio@39 1121
Tercio@39 1122 -----------------------------
Tercio@39 1123
Tercio@39 1124 function DF:OpenInterfaceProfile()
Tercio@39 1125 InterfaceOptionsFrame_OpenToCategory (self.__name)
Tercio@39 1126 InterfaceOptionsFrame_OpenToCategory (self.__name)
Tercio@39 1127 for i = 1, 100 do
Tercio@39 1128 local button = _G ["InterfaceOptionsFrameAddOnsButton" .. i]
Tercio@39 1129 if (button) then
Tercio@39 1130 local text = _G ["InterfaceOptionsFrameAddOnsButton" .. i .. "Text"]
Tercio@39 1131 if (text) then
Tercio@39 1132 text = text:GetText()
Tercio@39 1133 if (text == self.__name) then
Tercio@39 1134 local toggle = _G ["InterfaceOptionsFrameAddOnsButton" .. i .. "Toggle"]
Tercio@39 1135 if (toggle) then
Tercio@39 1136 if (toggle:GetNormalTexture():GetTexture():find ("PlusButton")) then
Tercio@39 1137 --is minimized, need expand
Tercio@39 1138 toggle:Click()
Tercio@39 1139 _G ["InterfaceOptionsFrameAddOnsButton" .. i+1]:Click()
Tercio@39 1140 elseif (toggle:GetNormalTexture():GetTexture():find ("MinusButton")) then
Tercio@39 1141 --isn't minimized
Tercio@39 1142 _G ["InterfaceOptionsFrameAddOnsButton" .. i+1]:Click()
Tercio@39 1143 end
Tercio@39 1144 end
Tercio@39 1145 break
Tercio@39 1146 end
Tercio@39 1147 end
Tercio@39 1148 else
Tercio@39 1149 self:Msg ("Couldn't not find the profile panel.")
Tercio@39 1150 break
Tercio@39 1151 end
Tercio@39 1152 end
Tercio@39 1153 end
Tercio@39 1154
Tercio@39 1155 -----------------------------
Tercio@39 1156 --safe copy from blizz api
Tercio@39 1157 function DF:Mixin (object, ...)
Tercio@39 1158 for i = 1, select("#", ...) do
Tercio@39 1159 local mixin = select(i, ...);
Tercio@39 1160 for k, v in pairs(mixin) do
Tercio@39 1161 object[k] = v;
Tercio@39 1162 end
Tercio@39 1163 end
Tercio@39 1164
Tercio@39 1165 return object;
Tercio@39 1166 end
Tercio@40 1167
Tercio@40 1168 -----------------------------
Tercio@40 1169 --> animations
Tercio@40 1170
Tercio@40 1171 function DF:CreateAnimationHub (parent, onPlay, onFinished)
Tercio@40 1172 local newAnimation = parent:CreateAnimationGroup()
Tercio@40 1173 newAnimation:SetScript ("OnPlay", onPlay)
Tercio@40 1174 newAnimation:SetScript ("OnFinished", onFinished)
Tercio@40 1175 newAnimation.NextAnimation = 1
Tercio@40 1176 return newAnimation
Tercio@40 1177 end
Tercio@40 1178
Tercio@40 1179 function DF:CreateAnimation (animation, type, order, duration, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
Tercio@40 1180 local anim = animation:CreateAnimation (type)
Tercio@40 1181
Tercio@40 1182 anim:SetOrder (order or animation.NextAnimation)
Tercio@40 1183 anim:SetDuration (duration)
Tercio@40 1184
Tercio@40 1185 type = string.upper (type)
Tercio@40 1186
Tercio@40 1187 if (type == "ALPHA") then
Tercio@40 1188 anim:SetFromAlpha (arg1)
Tercio@40 1189 anim:SetToAlpha (arg2)
Tercio@40 1190
Tercio@40 1191 elseif (type == "SCALE") then
Tercio@40 1192 anim:SetFromScale (arg1, arg2)
Tercio@40 1193 anim:SetToScale (arg3, arg4)
Tercio@40 1194 anim:SetOrigin (arg5 or "center", arg6 or 0, arg7 or 0) --point, x, y
Tercio@40 1195
Tercio@40 1196 elseif (type == "ROTATION") then
Tercio@40 1197 anim:SetDegrees (arg1) --degree
Tercio@40 1198 anim:SetOrigin (arg2 or "center", arg3 or 0, arg4 or 0) --point, x, y
Tercio@40 1199
Tercio@40 1200 elseif (type == "TRANSLATION") then
Tercio@40 1201 anim:SetOffset (arg1, arg2)
Tercio@40 1202
Tercio@40 1203 end
Tercio@40 1204
Tercio@40 1205 animation.NextAnimation = animation.NextAnimation + 1
Tercio@40 1206 return anim
Tercio@40 1207 end
Tercio@40 1208
Tercio@40 1209
Tercio@40 1210 -----------------------------
Tercio@40 1211 --> borders
Tercio@40 1212
Tercio@40 1213 local default_border_color1 = .5
Tercio@40 1214 local default_border_color2 = .3
Tercio@40 1215 local default_border_color3 = .1
Tercio@40 1216
Tercio@40 1217 local SetBorderAlpha = function (self, alpha1, alpha2, alpha3)
Tercio@40 1218 self.Borders.Alpha1 = alpha1 or self.Borders.Alpha1
Tercio@40 1219 self.Borders.Alpha2 = alpha2 or self.Borders.Alpha2
Tercio@40 1220 self.Borders.Alpha3 = alpha3 or self.Borders.Alpha3
Tercio@40 1221
Tercio@40 1222 for _, texture in ipairs (self.Borders.Layer1) do
Tercio@40 1223 texture:SetAlpha (self.Borders.Alpha1)
Tercio@40 1224 end
Tercio@40 1225 for _, texture in ipairs (self.Borders.Layer2) do
Tercio@40 1226 texture:SetAlpha (self.Borders.Alpha2)
Tercio@40 1227 end
Tercio@40 1228 for _, texture in ipairs (self.Borders.Layer3) do
Tercio@40 1229 texture:SetAlpha (self.Borders.Alpha3)
Tercio@40 1230 end
Tercio@40 1231 end
Tercio@40 1232
Tercio@40 1233 function DF:CreateBorder (parent, alpha1, alpha2, alpha3)
Tercio@40 1234
Tercio@40 1235 parent.Borders = {
Tercio@40 1236 Layer1 = {},
Tercio@40 1237 Layer2 = {},
Tercio@40 1238 Layer3 = {},
Tercio@40 1239 Alpha1 = alpha1 or default_border_color1,
Tercio@40 1240 Alpha2 = alpha2 or default_border_color2,
Tercio@40 1241 Alpha3 = alpha3 or default_border_color3,
Tercio@40 1242 }
Tercio@40 1243
Tercio@40 1244 parent.SetBorderAlpha = SetBorderAlpha
Tercio@40 1245
Tercio@40 1246 local border1 = parent:CreateTexture (nil, "background")
Tercio@40 1247 border1:SetPoint ("topleft", parent, "topleft", -1, 1)
Tercio@40 1248 border1:SetPoint ("bottomleft", parent, "bottomleft", -1, -1)
Tercio@40 1249 border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1)
Tercio@40 1250 local border2 = parent:CreateTexture (nil, "background")
Tercio@40 1251 border2:SetPoint ("topleft", parent, "topleft", -2, 2)
Tercio@40 1252 border2:SetPoint ("bottomleft", parent, "bottomleft", -2, -2)
Tercio@40 1253 border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2)
Tercio@40 1254 local border3 = parent:CreateTexture (nil, "background")
Tercio@40 1255 border3:SetPoint ("topleft", parent, "topleft", -3, 3)
Tercio@40 1256 border3:SetPoint ("bottomleft", parent, "bottomleft", -3, -3)
Tercio@40 1257 border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3)
Tercio@40 1258
Tercio@40 1259 tinsert (parent.Borders.Layer1, border1)
Tercio@40 1260 tinsert (parent.Borders.Layer2, border2)
Tercio@40 1261 tinsert (parent.Borders.Layer3, border3)
Tercio@40 1262
Tercio@40 1263 local border1 = parent:CreateTexture (nil, "background")
Tercio@40 1264 border1:SetPoint ("topleft", parent, "topleft", 0, 1)
Tercio@40 1265 border1:SetPoint ("topright", parent, "topright", 1, 1)
Tercio@40 1266 border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1)
Tercio@40 1267 local border2 = parent:CreateTexture (nil, "background")
Tercio@40 1268 border2:SetPoint ("topleft", parent, "topleft", -1, 2)
Tercio@40 1269 border2:SetPoint ("topright", parent, "topright", 2, 2)
Tercio@40 1270 border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2)
Tercio@40 1271 local border3 = parent:CreateTexture (nil, "background")
Tercio@40 1272 border3:SetPoint ("topleft", parent, "topleft", -2, 3)
Tercio@40 1273 border3:SetPoint ("topright", parent, "topright", 3, 3)
Tercio@40 1274 border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3)
Tercio@40 1275
Tercio@40 1276 tinsert (parent.Borders.Layer1, border1)
Tercio@40 1277 tinsert (parent.Borders.Layer2, border2)
Tercio@40 1278 tinsert (parent.Borders.Layer3, border3)
Tercio@40 1279
Tercio@40 1280 local border1 = parent:CreateTexture (nil, "background")
Tercio@40 1281 border1:SetPoint ("topright", parent, "topright", 1, 0)
Tercio@40 1282 border1:SetPoint ("bottomright", parent, "bottomright", 1, -1)
Tercio@40 1283 border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1)
Tercio@40 1284 local border2 = parent:CreateTexture (nil, "background")
Tercio@40 1285 border2:SetPoint ("topright", parent, "topright", 2, 1)
Tercio@40 1286 border2:SetPoint ("bottomright", parent, "bottomright", 2, -2)
Tercio@40 1287 border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2)
Tercio@40 1288 local border3 = parent:CreateTexture (nil, "background")
Tercio@40 1289 border3:SetPoint ("topright", parent, "topright", 3, 2)
Tercio@40 1290 border3:SetPoint ("bottomright", parent, "bottomright", 3, -3)
Tercio@40 1291 border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3)
Tercio@40 1292
Tercio@40 1293 tinsert (parent.Borders.Layer1, border1)
Tercio@40 1294 tinsert (parent.Borders.Layer2, border2)
Tercio@40 1295 tinsert (parent.Borders.Layer3, border3)
Tercio@40 1296
Tercio@40 1297 local border1 = parent:CreateTexture (nil, "background")
Tercio@40 1298 border1:SetPoint ("bottomleft", parent, "bottomleft", 0, -1)
Tercio@40 1299 border1:SetPoint ("bottomright", parent, "bottomright", 0, -1)
Tercio@40 1300 border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1)
Tercio@40 1301 local border2 = parent:CreateTexture (nil, "background")
Tercio@40 1302 border2:SetPoint ("bottomleft", parent, "bottomleft", -1, -2)
Tercio@40 1303 border2:SetPoint ("bottomright", parent, "bottomright", 1, -2)
Tercio@40 1304 border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2)
Tercio@40 1305 local border3 = parent:CreateTexture (nil, "background")
Tercio@40 1306 border3:SetPoint ("bottomleft", parent, "bottomleft", -2, -3)
Tercio@40 1307 border3:SetPoint ("bottomright", parent, "bottomright", 2, -3)
Tercio@40 1308 border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3)
Tercio@40 1309
Tercio@40 1310 tinsert (parent.Borders.Layer1, border1)
Tercio@40 1311 tinsert (parent.Borders.Layer2, border2)
Tercio@40 1312 tinsert (parent.Borders.Layer3, border3)
Tercio@40 1313
Tercio@40 1314 end
Tercio@40 1315
Tercio@40 1316 function DF:ReskinSlider (slider, heightOffset)
Tercio@40 1317 if (slider.slider) then
Tercio@40 1318 slider.cima:SetNormalTexture ([[Interface\Buttons\Arrow-Up-Up]])
Tercio@40 1319 slider.cima:SetPushedTexture ([[Interface\Buttons\Arrow-Up-Down]])
Tercio@40 1320 slider.cima:SetDisabledTexture ([[Interface\Buttons\Arrow-Up-Disabled]])
Tercio@40 1321 slider.cima:GetNormalTexture():ClearAllPoints()
Tercio@40 1322 slider.cima:GetPushedTexture():ClearAllPoints()
Tercio@40 1323 slider.cima:GetDisabledTexture():ClearAllPoints()
Tercio@40 1324 slider.cima:GetNormalTexture():SetPoint ("center", slider.cima, "center", 1, 1)
Tercio@40 1325 slider.cima:GetPushedTexture():SetPoint ("center", slider.cima, "center", 1, 1)
Tercio@40 1326 slider.cima:GetDisabledTexture():SetPoint ("center", slider.cima, "center", 1, 1)
Tercio@40 1327 slider.cima:SetSize (16, 16)
Tercio@40 1328 slider.cima:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]})
Tercio@40 1329 slider.cima:SetBackdropColor (0, 0, 0, 0.3)
Tercio@40 1330 slider.cima:SetBackdropBorderColor (0, 0, 0, 1)
Tercio@40 1331
Tercio@40 1332 slider.baixo:SetNormalTexture ([[Interface\Buttons\Arrow-Down-Up]])
Tercio@40 1333 slider.baixo:SetPushedTexture ([[Interface\Buttons\Arrow-Down-Down]])
Tercio@40 1334 slider.baixo:SetDisabledTexture ([[Interface\Buttons\Arrow-Down-Disabled]])
Tercio@40 1335 slider.baixo:GetNormalTexture():ClearAllPoints()
Tercio@40 1336 slider.baixo:GetPushedTexture():ClearAllPoints()
Tercio@40 1337 slider.baixo:GetDisabledTexture():ClearAllPoints()
Tercio@40 1338 slider.baixo:GetNormalTexture():SetPoint ("center", slider.baixo, "center", 1, -5)
Tercio@40 1339 slider.baixo:GetPushedTexture():SetPoint ("center", slider.baixo, "center", 1, -5)
Tercio@40 1340 slider.baixo:GetDisabledTexture():SetPoint ("center", slider.baixo, "center", 1, -5)
Tercio@40 1341 slider.baixo:SetSize (16, 16)
Tercio@40 1342 slider.baixo:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]})
Tercio@40 1343 slider.baixo:SetBackdropColor (0, 0, 0, 0.35)
Tercio@40 1344 slider.baixo:SetBackdropBorderColor (0, 0, 0, 1)
Tercio@40 1345
Tercio@40 1346 slider.slider:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]})
Tercio@40 1347 slider.slider:SetBackdropColor (0, 0, 0, 0.35)
Tercio@40 1348 slider.slider:SetBackdropBorderColor (0, 0, 0, 1)
Tercio@40 1349
Tercio@40 1350 --slider.slider:Altura (164)
Tercio@40 1351 slider.slider:cimaPoint (0, 13)
Tercio@40 1352 slider.slider:baixoPoint (0, -13)
Tercio@40 1353 slider.slider.thumb:SetTexture ([[Interface\AddOns\Details\images\icons2]])
Tercio@40 1354 slider.slider.thumb:SetTexCoord (482/512, 492/512, 104/512, 120/512)
Tercio@40 1355 slider.slider.thumb:SetSize (12, 12)
Tercio@40 1356 slider.slider.thumb:SetVertexColor (0.6, 0.6, 0.6, 0.95)
Tercio@40 1357 else
Tercio@40 1358
Tercio@40 1359 slider.ScrollBar.ScrollUpButton:SetNormalTexture ([[Interface\Buttons\Arrow-Up-Up]])
Tercio@40 1360 slider.ScrollBar.ScrollUpButton:GetNormalTexture():SetTexCoord (0, 1, 0, 1)
Tercio@40 1361 slider.ScrollBar.ScrollUpButton:SetPushedTexture ([[Interface\Buttons\Arrow-Up-Down]])
Tercio@40 1362 slider.ScrollBar.ScrollUpButton:GetPushedTexture():SetTexCoord (0, 1, 0, 1)
Tercio@40 1363 slider.ScrollBar.ScrollUpButton:SetDisabledTexture ([[Interface\Buttons\Arrow-Up-Disabled]])
Tercio@40 1364 slider.ScrollBar.ScrollUpButton:GetDisabledTexture():SetTexCoord (0, 1, 0, 1)
Tercio@40 1365
Tercio@40 1366 slider.ScrollBar.ScrollUpButton:SetSize (16, 16)
Tercio@40 1367 slider.ScrollBar.ScrollUpButton:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"})
Tercio@40 1368 slider.ScrollBar.ScrollUpButton:SetBackdropColor (0, 0, 0, 0.3)
Tercio@40 1369 slider.ScrollBar.ScrollUpButton:SetBackdropBorderColor (0, 0, 0, 1)
Tercio@40 1370
Tercio@40 1371 slider.ScrollBar.ScrollUpButton:GetNormalTexture():ClearAllPoints()
Tercio@40 1372 slider.ScrollBar.ScrollUpButton:GetPushedTexture():ClearAllPoints()
Tercio@40 1373 slider.ScrollBar.ScrollUpButton:GetDisabledTexture():ClearAllPoints()
Tercio@40 1374 slider.ScrollBar.ScrollUpButton:GetNormalTexture():SetPoint ("center", slider.ScrollBar.ScrollUpButton, "center", 1, 1)
Tercio@40 1375 slider.ScrollBar.ScrollUpButton:GetPushedTexture():SetPoint ("center", slider.ScrollBar.ScrollUpButton, "center", 1, 1)
Tercio@40 1376 slider.ScrollBar.ScrollUpButton:GetDisabledTexture():SetPoint ("center", slider.ScrollBar.ScrollUpButton, "center", 1, 1)
Tercio@40 1377
Tercio@40 1378 --
Tercio@40 1379
Tercio@40 1380 slider.ScrollBar.ScrollDownButton:SetNormalTexture ([[Interface\Buttons\Arrow-Down-Up]])
Tercio@40 1381 slider.ScrollBar.ScrollDownButton:GetNormalTexture():SetTexCoord (0, 1, 0, 1)
Tercio@40 1382 slider.ScrollBar.ScrollDownButton:SetPushedTexture ([[Interface\Buttons\Arrow-Down-Down]])
Tercio@40 1383 slider.ScrollBar.ScrollDownButton:GetPushedTexture():SetTexCoord (0, 1, 0, 1)
Tercio@40 1384 slider.ScrollBar.ScrollDownButton:SetDisabledTexture ([[Interface\Buttons\Arrow-Down-Disabled]])
Tercio@40 1385 slider.ScrollBar.ScrollDownButton:GetDisabledTexture():SetTexCoord (0, 1, 0, 1)
Tercio@40 1386
Tercio@40 1387 slider.ScrollBar.ScrollDownButton:SetSize (16, 16)
Tercio@40 1388 slider.ScrollBar.ScrollDownButton:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"})
Tercio@40 1389 slider.ScrollBar.ScrollDownButton:SetBackdropColor (0, 0, 0, 0.3)
Tercio@40 1390 slider.ScrollBar.ScrollDownButton:SetBackdropBorderColor (0, 0, 0, 1)
Tercio@40 1391
Tercio@40 1392 slider.ScrollBar.ScrollDownButton:GetNormalTexture():ClearAllPoints()
Tercio@40 1393 slider.ScrollBar.ScrollDownButton:GetPushedTexture():ClearAllPoints()
Tercio@40 1394 slider.ScrollBar.ScrollDownButton:GetDisabledTexture():ClearAllPoints()
Tercio@40 1395 slider.ScrollBar.ScrollDownButton:GetNormalTexture():SetPoint ("center", slider.ScrollBar.ScrollDownButton, "center", 1, -5)
Tercio@40 1396 slider.ScrollBar.ScrollDownButton:GetPushedTexture():SetPoint ("center", slider.ScrollBar.ScrollDownButton, "center", 1, -5)
Tercio@40 1397 slider.ScrollBar.ScrollDownButton:GetDisabledTexture():SetPoint ("center", slider.ScrollBar.ScrollDownButton, "center", 1, -5)
Tercio@40 1398
Tercio@40 1399 --
Tercio@40 1400 slider.ScrollBar:SetPoint ("TOPLEFT", slider, "TOPRIGHT", 6, -16)
Tercio@40 1401 slider.ScrollBar:SetPoint ("BOTTOMLEFT", slider, "BOTTOMRIGHT", 6, 16 + (heightOffset and heightOffset*-1 or 0))
Tercio@40 1402
Tercio@40 1403 slider.ScrollBar.ThumbTexture:SetColorTexture (.5, .5, .5, .3)
Tercio@40 1404 slider.ScrollBar.ThumbTexture:SetSize (12, 8)
Tercio@40 1405
Tercio@40 1406 --
Tercio@40 1407
Tercio@40 1408 slider.ScrollBar:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"})
Tercio@40 1409 slider.ScrollBar:SetBackdropColor (0, 0, 0, 0.35)
Tercio@40 1410 slider.ScrollBar:SetBackdropBorderColor (0, 0, 0, 1)
Tercio@40 1411 end
Tercio@40 1412 end
Tercio@40 1413
Tercio@40 1414 --doo elsee