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
74 --------------------------
76 --------------------------
78 function WidgetWarlock
.ConjureScrollBar(parent
, hasborder
)
79 local f
= CreateFrame("Slider", nil, parent
)
82 local upbutt
= CreateFrame("Button", nil, f
, "UIPanelScrollUpButtonTemplate")
83 upbutt
:SetPoint("BOTTOM", f
, "TOP")
85 local downbutt
= CreateFrame("Button", nil, f
, "UIPanelScrollDownButtonTemplate")
86 downbutt
:SetPoint("TOP", f
, "BOTTOM")
88 f
:SetThumbTexture("Interface\\Buttons\\UI-ScrollBar-Knob")
89 local thumb
= f
:GetThumbTexture()
92 thumb
:SetTexCoord(0.25, 0.75, 0.25, 0.75)
95 local uptext
= f
:CreateTexture(nil, "BACKGROUND")
98 uptext
:SetPoint("TOPLEFT", upbutt
, "TOPLEFT", -7, 5)
99 uptext
:SetTexture("Interface\\PaperDollInfoFrame\\UI-Character-ScrollBar")
100 uptext
:SetTexCoord(0, 0.484375, 0, 1.0)
102 local downtex
= f
:CreateTexture(nil, "BACKGROUND")
104 downtex
:SetHeight(106)
105 downtex
:SetPoint("BOTTOMLEFT", downbutt
, "BOTTOMLEFT", -7, -3)
106 downtex
:SetTexture("Interface\\PaperDollInfoFrame\\UI-Character-ScrollBar")
107 downtex
:SetTexCoord(0.515625, 1.0, 0, 0.4140625)
110 return f
, upbutt
, downbutt