6 WidgetWarlock
.TooltipBorderBG
= {
7 bgFile
= "Interface\\ChatFrame\\ChatFrameBackground",
8 edgeFile
= "Interface\\Tooltips\\UI-Tooltip-Border",
10 insets
= {left
= 4, right
= 4, top
= 4, bottom
= 4}
14 function WidgetWarlock
.SummonCheckBox(size
, parent
, ...)
15 local check
= CreateFrame("CheckButton", nil, parent
)
18 if select(1, ...) then check
:SetPoint(...) end
20 check
:SetNormalTexture("Interface\\Buttons\\UI-CheckBox-Up")
21 check
:SetPushedTexture("Interface\\Buttons\\UI-CheckBox-Down")
22 check
:SetHighlightTexture("Interface\\Buttons\\UI-CheckBox-Highlight")
23 check
:SetDisabledCheckedTexture("Interface\\Buttons\\UI-CheckBox-Check-Disabled")
24 check
:SetCheckedTexture("Interface\\Buttons\\UI-CheckBox-Check")
30 function WidgetWarlock
.SummonTexture(parent
, layer
, w
, h
, texture
, ...)
31 local tex
= parent
:CreateTexture(nil, layer
)
32 if w
then tex
:SetWidth(w
) end
33 if h
then tex
:SetHeight(h
) end
34 tex
:SetTexture(texture
)
35 if select(1, ...) then tex
:SetPoint(...) end
40 function WidgetWarlock
.SummonFontString(parent
, layer
, inherit
, text
, ...)
41 local fs
= parent
:CreateFontString(nil, layer
, inherit
)
43 if select(1, ...) then fs
:SetPoint(...) end
48 -----------------------
50 -----------------------
52 local fadetimes
= setmetatable({}, {__index
= function() return 1 end})
53 local elapsed
= setmetatable({}, {__index
= function() return 0 end})
56 function WidgetWarlock
.SetFadeTime(frame
, time
)
57 assert(frame
, "No frame passed")
58 assert(type(time
) == "number", "Time must be a number")
59 assert(time
> 0, "Time must be positive")
60 fadetimes
[frame
] = time
64 function WidgetWarlock
.FadeIn(frame
, elap
)
65 elapsed
[frame
] = elapsed
[frame
] + elap
66 if elapsed
[frame
] > fadetimes
[frame
] then
67 frame
:SetScript("OnUpdate", nil)
70 else frame
:SetAlpha(elapsed
[frame
]/fadetimes
[frame
]) end