|
Tercio@11
|
1
|
|
Tercio@11
|
2 local DF = _G ["DetailsFramework"]
|
|
Tercio@20
|
3 if (not DF or not DetailsFrameworkCanLoad) then
|
|
Tercio@20
|
4 return
|
|
Tercio@20
|
5 end
|
|
Tercio@20
|
6
|
|
Tercio@11
|
7 local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0")
|
|
Tercio@11
|
8 local _
|
|
Tercio@11
|
9 --lua locals
|
|
Tercio@11
|
10 local _math_floor= math.floor
|
|
Tercio@11
|
11 local _type = type
|
|
Tercio@11
|
12 local _math_abs = math.abs
|
|
Tercio@11
|
13 local _tinsert = tinsert
|
|
Tercio@11
|
14 local _unpack = unpack
|
|
Tercio@11
|
15 local _ipairs = ipairs
|
|
Tercio@11
|
16 local _table_wipe = table.wipe
|
|
Tercio@11
|
17 local _table_insert = table.insert
|
|
Tercio@11
|
18 local _math_max = math.max
|
|
Tercio@11
|
19 --api locals
|
|
Tercio@11
|
20 local _GetScreenWidth = GetScreenWidth
|
|
Tercio@11
|
21 local _GetScreenHeight = GetScreenHeight
|
|
Tercio@11
|
22 local _UIParent = UIParent
|
|
Tercio@11
|
23 local _CreateFrame = CreateFrame
|
|
Tercio@11
|
24
|
|
Tercio@20
|
25 local version = 2
|
|
Tercio@11
|
26
|
|
Tercio@11
|
27 function DF:CreateCoolTip()
|
|
Tercio@11
|
28
|
|
Tercio@11
|
29 ----------------------------------------------------------------------
|
|
Tercio@11
|
30 --> Cooltip Startup
|
|
Tercio@11
|
31 ----------------------------------------------------------------------
|
|
Tercio@11
|
32
|
|
Tercio@11
|
33 if (_G.GameCooltip2 and _G.GameCooltip2.version >= version) then
|
|
Tercio@11
|
34 return
|
|
Tercio@11
|
35 end
|
|
Tercio@11
|
36
|
|
Tercio@11
|
37 --> Start Cooltip Table
|
|
Tercio@11
|
38 local CoolTip = {version = version}
|
|
Tercio@11
|
39 _G.GameCooltip2 = CoolTip
|
|
Tercio@11
|
40
|
|
Tercio@11
|
41 --> Containers
|
|
Tercio@11
|
42 CoolTip.LeftTextTable = {}
|
|
Tercio@11
|
43 CoolTip.LeftTextTableSub = {}
|
|
Tercio@11
|
44 CoolTip.RightTextTable = {}
|
|
Tercio@11
|
45 CoolTip.RightTextTableSub = {}
|
|
Tercio@11
|
46 CoolTip.LeftIconTable = {}
|
|
Tercio@11
|
47 CoolTip.LeftIconTableSub = {}
|
|
Tercio@11
|
48 CoolTip.RightIconTable = {}
|
|
Tercio@11
|
49 CoolTip.RightIconTableSub = {}
|
|
Tercio@11
|
50 CoolTip.Banner = {false, false, false}
|
|
Tercio@11
|
51 CoolTip.TopIconTableSub = {}
|
|
Tercio@11
|
52 CoolTip.StatusBarTable = {}
|
|
Tercio@11
|
53 CoolTip.StatusBarTableSub = {}
|
|
Tercio@11
|
54 CoolTip.WallpaperTable = {}
|
|
Tercio@11
|
55 CoolTip.WallpaperTableSub = {}
|
|
Tercio@11
|
56
|
|
Tercio@20
|
57 CoolTip.PopupFrameTable = {}
|
|
Tercio@20
|
58
|
|
Tercio@11
|
59 CoolTip.FunctionsTableMain = {} --> menus
|
|
Tercio@11
|
60 CoolTip.FunctionsTableSub = {} --> menus
|
|
Tercio@11
|
61 CoolTip.ParametersTableMain = {} --> menus
|
|
Tercio@11
|
62 CoolTip.ParametersTableSub = {} --> menus
|
|
Tercio@11
|
63
|
|
Tercio@11
|
64 CoolTip.FixedValue = nil --> menus
|
|
Tercio@11
|
65 CoolTip.SelectedIndexMain = nil --> menus
|
|
Tercio@11
|
66 CoolTip.SelectedIndexSec = {} --> menus
|
|
Tercio@11
|
67
|
|
Tercio@11
|
68 --options table
|
|
Tercio@11
|
69 CoolTip.OptionsList = {
|
|
Tercioo@30
|
70 ["RightTextMargin"] = true,
|
|
Tercio@11
|
71 ["IconSize"] = true,
|
|
Tercio@11
|
72 ["HeightAnchorMod"] = true,
|
|
Tercio@11
|
73 ["WidthAnchorMod"] = true,
|
|
Tercio@11
|
74 ["MinWidth"] = true,
|
|
Tercio@11
|
75 ["FixedWidth"] = true,
|
|
Tercio@11
|
76 ["FixedHeight"] = true,
|
|
Tercio@11
|
77 ["FixedWidthSub"] = true,
|
|
Tercio@11
|
78 ["FixedHeightSub"] = true,
|
|
Tercio@11
|
79 ["AlignAsBlizzTooltip"] = true,
|
|
Tercio@11
|
80 ["IgnoreSubMenu"] = true,
|
|
Tercio@11
|
81 ["IgnoreButtonAutoHeight"] = true,
|
|
Tercio@11
|
82 ["TextHeightMod"] = true,
|
|
Tercio@11
|
83 ["ButtonHeightMod"] = true,
|
|
Tercio@11
|
84 ["ButtonHeightModSub"] = true,
|
|
Tercio@11
|
85 ["YSpacingMod"] = true,
|
|
Tercio@11
|
86 ["YSpacingModSub"] = true,
|
|
Tercio@11
|
87 ["ButtonsYMod"] = true,
|
|
Tercio@11
|
88 ["ButtonsYModSub"] = true,
|
|
Tercio@11
|
89 ["IconHeightMod"] = true,
|
|
Tercio@11
|
90 ["StatusBarHeightMod"] = true,
|
|
Tercio@11
|
91 ["StatusBarTexture"] = true,
|
|
Tercio@11
|
92 ["TextSize"] = true,
|
|
Tercio@11
|
93 ["TextFont"] = true,
|
|
Tercio@11
|
94 ["TextColor"] = true,
|
|
Tercio@11
|
95 ["TextColorRight"] = true,
|
|
Tercio@11
|
96 ["TextShadow"] = true,
|
|
Tercio@11
|
97 ["LeftTextWidth"] = true,
|
|
Tercio@11
|
98 ["RightTextWidth"] = true,
|
|
Tercio@11
|
99 ["LeftTextHeight"] = true,
|
|
Tercio@11
|
100 ["RightTextHeight"] = true,
|
|
Tercio@11
|
101 ["NoFade"] = true,
|
|
Tercio@11
|
102 ["MyAnchor"] = true,
|
|
Tercio@11
|
103 ["Anchor"] = true,
|
|
Tercio@11
|
104 ["RelativeAnchor"] = true,
|
|
Tercio@11
|
105 ["NoLastSelectedBar"] = true,
|
|
Tercio@11
|
106 ["SubMenuIsTooltip"] = true,
|
|
Tercio@11
|
107 ["LeftBorderSize"] = true,
|
|
Tercio@11
|
108 ["RightBorderSize"] = true,
|
|
Tercio@11
|
109 ["HeighMod"] = true,
|
|
Tercio@11
|
110 ["HeighModSub"] = true,
|
|
Tercio@11
|
111 ["IconBlendMode"] = true,
|
|
Tercio@11
|
112 ["IconBlendModeHover"] = true,
|
|
Tercio@11
|
113 ["SubFollowButton"] = true,
|
|
Tercio@11
|
114 ["IgnoreArrows"] = true,
|
|
Tercio@11
|
115 ["SelectedTopAnchorMod"] = true,
|
|
Tercio@11
|
116 ["SelectedBottomAnchorMod"] = true,
|
|
Tercio@11
|
117 ["SelectedLeftAnchorMod"] = true,
|
|
Tercio@11
|
118 ["SelectedRightAnchorMod"] = true,
|
|
Tercio@11
|
119 }
|
|
Tercio@11
|
120
|
|
Tercio@11
|
121 CoolTip.OptionsTable = {}
|
|
Tercio@11
|
122
|
|
Tercio@11
|
123 --cprops
|
|
Tercio@11
|
124 CoolTip.Indexes = 0 --> amount of lines current on shown
|
|
Tercio@11
|
125 CoolTip.IndexesSub = {} --> amount of lines current on shown
|
|
Tercio@11
|
126 CoolTip.HaveSubMenu = false --> amount of lines current on shown
|
|
Tercio@11
|
127 CoolTip.SubIndexes = 0 --> amount of lines current on shown on sub menu
|
|
Tercio@11
|
128 CoolTip.Type = 1 --> 1 tooltip 2 tooltip with bars 3 menu 4 menu + submenus
|
|
Tercio@11
|
129 CoolTip.Host = nil --> frame to anchor
|
|
Tercio@11
|
130 CoolTip.LastSize = 0 --> last size
|
|
Tercio@11
|
131
|
|
Tercio@11
|
132 CoolTip.LastIndex = 0
|
|
Tercio@11
|
133
|
|
Tercio@11
|
134 CoolTip.internal_x_mod = 0
|
|
Tercio@11
|
135 CoolTip.internal_y_mod = 0
|
|
Tercio@11
|
136 CoolTip.overlap_checked = false
|
|
Tercio@11
|
137
|
|
Tercio@11
|
138 --defaults
|
|
Tercio@11
|
139 CoolTip.default_height = 20
|
|
Tercio@11
|
140 CoolTip.default_text_size = 10.5
|
|
Tercio@11
|
141 CoolTip.default_text_font = "GameFontHighlight"
|
|
Tercio@11
|
142
|
|
Tercio@11
|
143 CoolTip.selected_anchor = {}
|
|
Tercio@11
|
144 CoolTip.selected_anchor.left = 2
|
|
Tercio@11
|
145 CoolTip.selected_anchor.right = 0
|
|
Tercio@11
|
146 CoolTip.selected_anchor.top = 0
|
|
Tercio@11
|
147 CoolTip.selected_anchor.bottom = 0
|
|
Tercio@11
|
148
|
|
Tercio@11
|
149 CoolTip._default_font = SharedMedia:Fetch ("font", "Friz Quadrata TT")
|
|
Tercio@11
|
150
|
|
Tercio@11
|
151 --> Create Frames
|
|
Tercio@11
|
152
|
|
Tercio@11
|
153 --> main frame
|
|
Tercio@11
|
154 local frame1
|
|
Tercio@11
|
155 if (not GameCooltipFrame1) then
|
|
Tercio@11
|
156 frame1 = CreateFrame ("Frame", "GameCooltipFrame1", UIParent, "DFCooltipMainFrameTemplate")
|
|
Tercio@11
|
157 tinsert (UISpecialFrames, "GameCooltipFrame1")
|
|
Tercio@11
|
158 DF:CreateFlashAnimation (frame1)
|
|
Tercio@40
|
159
|
|
Tercio@40
|
160 if (DF.CreateBorder) then
|
|
Tercio@40
|
161 DF:CreateBorder (frame1, .3, .1, .03)
|
|
Tercio@40
|
162 end
|
|
Tercio@11
|
163 else
|
|
Tercio@11
|
164 frame1 = GameCooltipFrame1
|
|
Tercio@11
|
165 end
|
|
Tercio@11
|
166
|
|
Tercio@11
|
167 GameCooltipFrame1_FrameBackgroundCenter:SetTexture (DF.folder .. "cooltip_background")
|
|
Tercio@11
|
168 GameCooltipFrame1_FrameBackgroundCenter:SetTexCoord (0.10546875, 0.89453125, 0, 1)
|
|
Tercio@11
|
169 GameCooltipFrame1_FrameBackgroundLeft:SetTexture (DF.folder .. "cooltip_background")
|
|
Tercio@11
|
170 GameCooltipFrame1_FrameBackgroundLeft:SetTexCoord (0, 0.103515625, 0, 1)
|
|
Tercio@11
|
171 GameCooltipFrame1_FrameBackgroundRight:SetTexture (DF.folder .. "cooltip_background")
|
|
Tercio@11
|
172 GameCooltipFrame1_FrameBackgroundRight:SetTexCoord (0.896484375, 1, 0, 1)
|
|
Tercio@11
|
173
|
|
Tercio@11
|
174 --> secondary frame
|
|
Tercio@11
|
175 local frame2
|
|
Tercio@11
|
176 if (not GameCooltipFrame2) then
|
|
Tercio@11
|
177 frame2 = CreateFrame ("Frame", "GameCooltipFrame2", UIParent, "DFCooltipMainFrameTemplate")
|
|
Tercio@11
|
178 tinsert (UISpecialFrames, "GameCooltipFrame2")
|
|
Tercio@11
|
179 DF:CreateFlashAnimation (frame2)
|
|
Tercio@11
|
180 frame2:SetClampedToScreen (true)
|
|
Tercio@40
|
181
|
|
Tercio@40
|
182 if (DF.CreateBorder) then
|
|
Tercio@40
|
183 DF:CreateBorder (frame2, .3, .1, .03)
|
|
Tercio@40
|
184 end
|
|
Tercio@11
|
185 else
|
|
Tercio@11
|
186 frame2 = GameCooltipFrame2
|
|
Tercio@11
|
187 end
|
|
Tercio@11
|
188
|
|
Tercio@40
|
189 frame2:SetPoint ("bottomleft", frame1, "bottomright", 4, 0)
|
|
Tercio@11
|
190
|
|
Tercio@11
|
191 GameCooltipFrame2_FrameBackgroundCenter:SetTexture (DF.folder .. "cooltip_background")
|
|
Tercio@11
|
192 GameCooltipFrame2_FrameBackgroundCenter:SetTexCoord (0.10546875, 0.89453125, 0, 1)
|
|
Tercio@11
|
193 GameCooltipFrame2_FrameBackgroundLeft:SetTexture (DF.folder .. "cooltip_background")
|
|
Tercio@11
|
194 GameCooltipFrame2_FrameBackgroundLeft:SetTexCoord (0, 0.103515625, 0, 1)
|
|
Tercio@11
|
195 GameCooltipFrame2_FrameBackgroundRight:SetTexture (DF.folder .. "cooltip_background")
|
|
Tercio@11
|
196 GameCooltipFrame2_FrameBackgroundRight:SetTexCoord (0.896484375, 1, 0, 1)
|
|
Tercio@11
|
197
|
|
Tercio@11
|
198 CoolTip.frame1 = frame1
|
|
Tercio@11
|
199 CoolTip.frame2 = frame2
|
|
Tercio@26
|
200 DF:FadeFrame (frame1, 0)
|
|
Tercio@26
|
201 DF:FadeFrame (frame2, 0)
|
|
Tercio@11
|
202
|
|
Tercio@11
|
203 --> button containers
|
|
Tercio@11
|
204 frame1.Lines = {}
|
|
Tercio@11
|
205 frame2.Lines = {}
|
|
Tercio@11
|
206
|
|
Tercio@11
|
207 ----------------------------------------------------------------------
|
|
Tercio@11
|
208 --> Title Function
|
|
Tercio@11
|
209 ----------------------------------------------------------------------
|
|
Tercio@11
|
210
|
|
Tercio@11
|
211 function CoolTip:SetTitle (_f, text)
|
|
Tercio@11
|
212 if (_f == 1) then
|
|
Tercio@11
|
213 CoolTip.title1 = true
|
|
Tercio@11
|
214 CoolTip.title_text = text
|
|
Tercio@11
|
215 end
|
|
Tercio@11
|
216 end
|
|
Tercio@11
|
217
|
|
Tercio@11
|
218 function CoolTip:SetTitleAnchor (_f, _anchor, ...)
|
|
Tercio@11
|
219 _anchor = string.lower (_anchor)
|
|
Tercio@11
|
220 if (_f == 1) then
|
|
Tercio@11
|
221 self.frame1.titleIcon:ClearAllPoints()
|
|
Tercio@11
|
222 self.frame1.titleText:ClearAllPoints()
|
|
Tercio@11
|
223
|
|
Tercio@11
|
224 if (_anchor == "left") then
|
|
Tercio@11
|
225 self.frame1.titleIcon:SetPoint ("left", frame1, "left", ...)
|
|
Tercio@11
|
226 self.frame1.titleText:SetPoint ("left", frame1.titleIcon, "right")
|
|
Tercio@11
|
227
|
|
Tercio@11
|
228 elseif (_anchor == "center") then
|
|
Tercio@11
|
229 self.frame1.titleIcon:SetPoint ("center", frame1, "center")
|
|
Tercio@11
|
230 self.frame1.titleIcon:SetPoint ("bottom", frame1, "top")
|
|
Tercio@11
|
231 self.frame1.titleText:SetPoint ("left", frame1.titleIcon, "right")
|
|
Tercio@11
|
232 self.frame1.titleText:SetText ("TESTE")
|
|
Tercio@11
|
233
|
|
Tercio@11
|
234 self.frame1.titleText:Show()
|
|
Tercio@11
|
235 self.frame1.titleIcon:Show()
|
|
Tercio@11
|
236
|
|
Tercio@11
|
237 elseif (_anchor == "right") then
|
|
Tercio@11
|
238 self.frame1.titleIcon:SetPoint ("right", frame1, "right", ...)
|
|
Tercio@11
|
239 self.frame1.titleText:SetPoint ("right", frame1.titleIcon, "left")
|
|
Tercio@11
|
240
|
|
Tercio@11
|
241 end
|
|
Tercio@11
|
242 elseif (_f == 2) then
|
|
Tercio@11
|
243 self.frame2.titleIcon:ClearAllPoints()
|
|
Tercio@11
|
244 self.frame2.titleText:ClearAllPoints()
|
|
Tercio@11
|
245 if (_anchor == "left") then
|
|
Tercio@11
|
246 self.frame2.titleIcon:SetPoint ("left", frame2, "left", ...)
|
|
Tercio@11
|
247 self.frame2.titleText:SetPoint ("left", frame2.titleIcon, "right")
|
|
Tercio@11
|
248 elseif (_anchor == "center") then
|
|
Tercio@11
|
249 self.frame2.titleIcon:SetPoint ("center", frame2, "center", ...)
|
|
Tercio@11
|
250 self.frame2.titleText:SetPoint ("left", frame2.titleIcon, "right")
|
|
Tercio@11
|
251 elseif (_anchor == "right") then
|
|
Tercio@11
|
252 self.frame2.titleIcon:SetPoint ("right", frame2, "right", ...)
|
|
Tercio@11
|
253 self.frame2.titleText:SetPoint ("right", frame2.titleIcon, "left")
|
|
Tercio@11
|
254 end
|
|
Tercio@11
|
255 end
|
|
Tercio@11
|
256 end
|
|
Tercio@11
|
257
|
|
Tercio@11
|
258 ----------------------------------------------------------------------
|
|
Tercio@11
|
259 --> Button Hide and Show Functions
|
|
Tercio@11
|
260 ----------------------------------------------------------------------
|
|
Tercio@11
|
261
|
|
Tercio@11
|
262 local elapsedTime = 0
|
|
Tercio@11
|
263
|
|
Tercio@11
|
264 CoolTip.mouseOver = false
|
|
Tercio@11
|
265 CoolTip.buttonClicked = false
|
|
Tercio@11
|
266
|
|
Tercio@11
|
267 frame1:SetScript ("OnEnter", function (self)
|
|
Tercio@11
|
268 if (CoolTip.Type ~= 1 and CoolTip.Type ~= 2) then --> menu
|
|
Tercio@11
|
269 CoolTip.active = true
|
|
Tercio@11
|
270 CoolTip.mouseOver = true
|
|
Tercio@20
|
271 CoolTip.had_interaction = true
|
|
Tercio@11
|
272 self:SetScript ("OnUpdate", nil)
|
|
Tercio@26
|
273 DF:FadeFrame (self, 0)
|
|
Tercio@11
|
274 --rever
|
|
Tercio@11
|
275 if (CoolTip.sub_menus) then
|
|
Tercio@26
|
276 DF:FadeFrame (frame2, 0)
|
|
Tercio@11
|
277 end
|
|
Tercio@11
|
278 end
|
|
Tercio@11
|
279 end)
|
|
Tercio@11
|
280
|
|
Tercio@11
|
281 frame2:SetScript ("OnEnter", function (self)
|
|
Tercio@11
|
282 if (CoolTip.OptionsTable.SubMenuIsTooltip) then
|
|
Tercio@11
|
283 return CoolTip:Close()
|
|
Tercio@11
|
284 end
|
|
Tercio@11
|
285 if (CoolTip.Type ~= 1 and CoolTip.Type ~= 2) then
|
|
Tercio@11
|
286 CoolTip.active = true
|
|
Tercio@11
|
287 CoolTip.mouseOver = true
|
|
Tercio@20
|
288 CoolTip.had_interaction = true
|
|
Tercio@11
|
289 self:SetScript ("OnUpdate", nil)
|
|
Tercio@26
|
290 DF:FadeFrame (self, 0)
|
|
Tercio@26
|
291 DF:FadeFrame (frame1, 0)
|
|
Tercio@11
|
292 end
|
|
Tercio@11
|
293 end)
|
|
Tercio@11
|
294
|
|
Tercio@11
|
295 local OnLeaveUpdateFrame1 = function (self, elapsed)
|
|
Tercio@11
|
296 elapsedTime = elapsedTime+elapsed
|
|
Tercio@11
|
297 if (elapsedTime > 0.7) then
|
|
Tercio@11
|
298 if (not CoolTip.active and not CoolTip.buttonClicked and self == CoolTip.Host) then
|
|
Tercio@26
|
299 DF:FadeFrame (self, 1)
|
|
Tercio@26
|
300 DF:FadeFrame (frame2, 1)
|
|
Tercio@11
|
301 elseif (not CoolTip.active) then
|
|
Tercio@26
|
302 DF:FadeFrame (self, 1)
|
|
Tercio@26
|
303 DF:FadeFrame (frame2, 1)
|
|
Tercio@11
|
304 end
|
|
Tercio@11
|
305 self:SetScript ("OnUpdate", nil)
|
|
Tercio@11
|
306 frame2:SetScript ("OnUpdate", nil)
|
|
Tercio@11
|
307 end
|
|
Tercio@11
|
308 end
|
|
Tercio@11
|
309
|
|
Tercio@11
|
310 frame1:SetScript ("OnLeave", function (self)
|
|
Tercio@11
|
311
|
|
Tercio@11
|
312 if (CoolTip.Type ~= 1 and CoolTip.Type ~= 2) then
|
|
Tercio@11
|
313 CoolTip.active = false
|
|
Tercio@11
|
314 CoolTip.mouseOver = false
|
|
Tercio@11
|
315 elapsedTime = 0
|
|
Tercio@11
|
316 self:SetScript ("OnUpdate", OnLeaveUpdateFrame1)
|
|
Tercio@11
|
317 else
|
|
Tercio@11
|
318 CoolTip.active = false
|
|
Tercio@11
|
319 CoolTip.mouseOver = false
|
|
Tercio@11
|
320 elapsedTime = 0
|
|
Tercio@11
|
321 self:SetScript ("OnUpdate", OnLeaveUpdateFrame1)
|
|
Tercio@11
|
322 end
|
|
Tercio@11
|
323 end)
|
|
Tercio@11
|
324
|
|
Tercio@11
|
325 local OnLeaveUpdateFrame2 = function (self, elapsed)
|
|
Tercio@11
|
326 elapsedTime = elapsedTime+elapsed
|
|
Tercio@11
|
327 if (elapsedTime > 0.7) then
|
|
Tercio@11
|
328 if (not CoolTip.active and not CoolTip.buttonClicked and self == CoolTip.Host) then
|
|
Tercio@26
|
329 DF:FadeFrame (self, 1)
|
|
Tercio@26
|
330 DF:FadeFrame (frame2, 1)
|
|
Tercio@11
|
331 elseif (not CoolTip.active) then
|
|
Tercio@26
|
332 DF:FadeFrame (self, 1)
|
|
Tercio@26
|
333 DF:FadeFrame (frame2, 1)
|
|
Tercio@11
|
334 end
|
|
Tercio@11
|
335 self:SetScript ("OnUpdate", nil)
|
|
Tercio@11
|
336 frame1:SetScript ("OnUpdate", nil)
|
|
Tercio@11
|
337 end
|
|
Tercio@11
|
338 end
|
|
Tercio@11
|
339
|
|
Tercio@11
|
340 frame2:SetScript ("OnLeave", function (self)
|
|
Tercio@11
|
341 if (CoolTip.Type ~= 1 and CoolTip.Type ~= 2) then
|
|
Tercio@11
|
342 CoolTip.active = false
|
|
Tercio@11
|
343 CoolTip.mouseOver = false
|
|
Tercio@11
|
344 elapsedTime = 0
|
|
Tercio@11
|
345 self:SetScript ("OnUpdate", OnLeaveUpdateFrame2)
|
|
Tercio@11
|
346 else
|
|
Tercio@11
|
347 CoolTip.active = false
|
|
Tercio@11
|
348 CoolTip.mouseOver = false
|
|
Tercio@11
|
349 elapsedTime = 0
|
|
Tercio@11
|
350 self:SetScript ("OnUpdate", OnLeaveUpdateFrame2)
|
|
Tercio@11
|
351
|
|
Tercio@11
|
352 end
|
|
Tercio@11
|
353 end)
|
|
Tercio@53
|
354
|
|
Tercio@11
|
355 frame1:SetScript ("OnHide", function (self)
|
|
Tercio@11
|
356 CoolTip.active = false
|
|
Tercio@11
|
357 CoolTip.buttonClicked = false
|
|
Tercio@11
|
358 CoolTip.mouseOver = false
|
|
Tercio@53
|
359
|
|
Tercio@53
|
360 --> reset parent and strata
|
|
Tercio@53
|
361 frame1:SetParent (UIParent)
|
|
Tercio@53
|
362 frame2:SetParent (UIParent)
|
|
Tercio@53
|
363 frame1:SetFrameStrata ("TOOLTIP")
|
|
Tercio@53
|
364 frame2:SetFrameStrata ("TOOLTIP")
|
|
Tercio@11
|
365 end)
|
|
Tercio@53
|
366
|
|
Tercio@11
|
367 ----------------------------------------------------------------------
|
|
Tercio@11
|
368 --> Button Creation Functions
|
|
Tercio@11
|
369 ----------------------------------------------------------------------
|
|
Tercio@11
|
370
|
|
Tercio@11
|
371 function GameCooltipButtonMouseDown (button)
|
|
Tercio@11
|
372 local mod = CoolTip.OptionsTable.TextHeightMod or 0
|
|
Tercio@11
|
373 button.leftText:SetPoint ("center", button.leftIcon, "center", 0, 0+mod)
|
|
Tercio@11
|
374 button.leftText:SetPoint ("left", button.leftIcon, "right", 4, -1+mod)
|
|
Tercio@11
|
375 end
|
|
Tercio@11
|
376
|
|
Tercio@11
|
377 function GameCooltipButtonMouseUp (button)
|
|
Tercio@11
|
378 local mod = CoolTip.OptionsTable.TextHeightMod or 0
|
|
Tercio@11
|
379 button.leftText:SetPoint ("center", button.leftIcon, "center", 0, 0+mod)
|
|
Tercio@11
|
380 button.leftText:SetPoint ("left", button.leftIcon, "right", 3, 0+mod)
|
|
Tercio@11
|
381 end
|
|
Tercio@11
|
382
|
|
Tercio@11
|
383 function CoolTip:CreateButton (index, frame, name)
|
|
Tercio@11
|
384 local new_button = CreateFrame ("Button", name, frame, "DFCooltipButtonTemplate")
|
|
Tercio@11
|
385 frame.Lines [index] = new_button
|
|
Tercio@11
|
386 return new_button
|
|
Tercio@11
|
387 end
|
|
Tercio@11
|
388
|
|
Tercio@11
|
389 local OnEnterUpdateButton = function (self, elapsed)
|
|
Tercio@11
|
390 elapsedTime = elapsedTime+elapsed
|
|
Tercio@11
|
391 if (elapsedTime > 0.001) then
|
|
Tercio@11
|
392 --> search key: ~onenterupdatemain
|
|
Tercio@11
|
393 CoolTip:ShowSub (self.index)
|
|
Tercio@11
|
394 CoolTip.last_button = self.index
|
|
Tercio@11
|
395 self:SetScript ("OnUpdate", nil)
|
|
Tercio@11
|
396 end
|
|
Tercio@11
|
397 end
|
|
Tercio@11
|
398
|
|
Tercio@11
|
399 local OnLeaveUpdateButton = function (self, elapsed)
|
|
Tercio@11
|
400 elapsedTime = elapsedTime+elapsed
|
|
Tercio@11
|
401 if (elapsedTime > 0.7) then
|
|
Tercio@11
|
402 if (not CoolTip.active and not CoolTip.buttonClicked) then
|
|
Tercio@26
|
403 DF:FadeFrame (frame1, 1)
|
|
Tercio@26
|
404 DF:FadeFrame (frame2, 1)
|
|
Tercio@11
|
405
|
|
Tercio@11
|
406 elseif (not CoolTip.active) then
|
|
Tercio@26
|
407 DF:FadeFrame (frame1, 1)
|
|
Tercio@26
|
408 DF:FadeFrame (frame2, 1)
|
|
Tercio@11
|
409 end
|
|
Tercio@11
|
410 frame1:SetScript ("OnUpdate", nil)
|
|
Tercio@11
|
411 end
|
|
Tercio@11
|
412 end
|
|
Tercio@11
|
413
|
|
Tercio@11
|
414 function CoolTip:NewMainButton (i)
|
|
Tercio@11
|
415 local botao = CoolTip:CreateButton (i, frame1, "GameCooltipMainButton"..i)
|
|
Tercio@11
|
416
|
|
Tercio@11
|
417 --> serach key: ~onenter
|
|
Tercio@11
|
418 botao:SetScript ("OnEnter", function()
|
|
Tercio@11
|
419 if (CoolTip.Type ~= 1 and CoolTip.Type ~= 2 and not botao.isDiv) then
|
|
Tercio@11
|
420 CoolTip.active = true
|
|
Tercio@11
|
421 CoolTip.mouseOver = true
|
|
Tercio@20
|
422 CoolTip.had_interaction = true
|
|
Tercio@11
|
423
|
|
Tercio@11
|
424 frame1:SetScript ("OnUpdate", nil)
|
|
Tercio@11
|
425 frame2:SetScript ("OnUpdate", nil)
|
|
Tercio@11
|
426
|
|
Tercio@11
|
427 botao.background:Show()
|
|
Tercio@11
|
428
|
|
Tercio@11
|
429 if (CoolTip.OptionsTable.IconBlendModeHover) then
|
|
Tercio@11
|
430 botao.leftIcon:SetBlendMode (CoolTip.OptionsTable.IconBlendModeHover)
|
|
Tercio@11
|
431 else
|
|
Tercio@11
|
432 botao.leftIcon:SetBlendMode ("BLEND")
|
|
Tercio@11
|
433 end
|
|
Tercio@11
|
434
|
|
Tercio@20
|
435 if (CoolTip.PopupFrameTable [botao.index]) then
|
|
Tercio@20
|
436 local on_enter, on_leave, param1, param2 = unpack (CoolTip.PopupFrameTable [botao.index])
|
|
Tercio@20
|
437 if (on_enter) then
|
|
Tercio@20
|
438 xpcall (on_enter, geterrorhandler(), frame1, param1, param2)
|
|
Tercio@20
|
439 end
|
|
Tercio@20
|
440
|
|
Tercio@20
|
441 elseif (CoolTip.IndexesSub [botao.index] and CoolTip.IndexesSub [botao.index] > 0) then
|
|
Tercio@11
|
442 if (CoolTip.OptionsTable.SubMenuIsTooltip) then
|
|
Tercio@11
|
443 CoolTip:ShowSub (botao.index)
|
|
Tercio@11
|
444 botao.index = i
|
|
Tercio@11
|
445 else
|
|
Tercio@11
|
446 if (CoolTip.last_button) then
|
|
Tercio@11
|
447 CoolTip:ShowSub (CoolTip.last_button)
|
|
Tercio@11
|
448 else
|
|
Tercio@11
|
449 CoolTip:ShowSub (botao.index)
|
|
Tercio@11
|
450 end
|
|
Tercio@11
|
451 elapsedTime = 0
|
|
Tercio@11
|
452 botao.index = i
|
|
Tercio@11
|
453 botao:SetScript ("OnUpdate", OnEnterUpdateButton)
|
|
Tercio@11
|
454 end
|
|
Tercio@11
|
455
|
|
Tercio@11
|
456 else
|
|
Tercio@11
|
457 --hide second frame
|
|
Tercio@26
|
458 DF:FadeFrame (frame2, 1)
|
|
Tercio@11
|
459 CoolTip.last_button = nil
|
|
Tercio@11
|
460 end
|
|
Tercio@11
|
461 else
|
|
Tercio@11
|
462 CoolTip.mouseOver = true
|
|
Tercio@20
|
463 CoolTip.had_interaction = true
|
|
Tercio@11
|
464 end
|
|
Tercio@11
|
465 end)
|
|
Tercio@11
|
466
|
|
Tercio@11
|
467 botao:SetScript ("OnLeave", function()
|
|
Tercio@11
|
468 if (CoolTip.Type ~= 1 and CoolTip.Type ~= 2 and not botao.isDiv) then
|
|
Tercio@11
|
469 CoolTip.active = false
|
|
Tercio@11
|
470 CoolTip.mouseOver = false
|
|
Tercio@11
|
471 botao:SetScript ("OnUpdate", nil)
|
|
Tercio@11
|
472
|
|
Tercio@11
|
473 botao.background:Hide()
|
|
Tercio@11
|
474
|
|
Tercio@11
|
475 if (CoolTip.OptionsTable.IconBlendMode) then
|
|
Tercio@11
|
476 botao.leftIcon:SetBlendMode (CoolTip.OptionsTable.IconBlendMode)
|
|
Tercio@11
|
477 botao.rightIcon:SetBlendMode (CoolTip.OptionsTable.IconBlendMode)
|
|
Tercio@11
|
478 else
|
|
Tercio@11
|
479 botao.leftIcon:SetBlendMode ("BLEND")
|
|
Tercio@11
|
480 botao.rightIcon:SetBlendMode ("BLEND")
|
|
Tercio@11
|
481 end
|
|
Tercio@11
|
482
|
|
Tercio@20
|
483 if (CoolTip.PopupFrameTable [botao.index]) then
|
|
Tercio@20
|
484 local on_enter, on_leave, param1, param2 = unpack (CoolTip.PopupFrameTable [botao.index])
|
|
Tercio@20
|
485 if (on_leave) then
|
|
Tercio@20
|
486 xpcall (on_leave, geterrorhandler(), frame1, param1, param2)
|
|
Tercio@20
|
487 end
|
|
Tercio@20
|
488 end
|
|
Tercio@20
|
489
|
|
Tercio@11
|
490 elapsedTime = 0
|
|
Tercio@11
|
491 frame1:SetScript ("OnUpdate", OnLeaveUpdateButton)
|
|
Tercio@11
|
492 --CoolTip:HideSub (i)
|
|
Tercio@11
|
493 else
|
|
Tercio@11
|
494 CoolTip.active = false
|
|
Tercio@11
|
495 elapsedTime = 0
|
|
Tercio@11
|
496 frame1:SetScript ("OnUpdate", OnLeaveUpdateButton)
|
|
Tercio@11
|
497 CoolTip.mouseOver = false
|
|
Tercio@11
|
498 end
|
|
Tercio@11
|
499 end)
|
|
Tercio@11
|
500
|
|
Tercio@11
|
501 return botao
|
|
Tercio@11
|
502 end
|
|
Tercio@11
|
503
|
|
Tercio@11
|
504 local OnLeaveUpdateButtonSec = function (self, elapsed)
|
|
Tercio@11
|
505 elapsedTime = elapsedTime+elapsed
|
|
Tercio@11
|
506 if (elapsedTime > 0.7) then
|
|
Tercio@11
|
507 if (not CoolTip.active and not CoolTip.buttonClicked) then
|
|
Tercio@26
|
508 DF:FadeFrame (frame1, 1)
|
|
Tercio@26
|
509 DF:FadeFrame (frame2, 1)
|
|
Tercio@11
|
510 elseif (not CoolTip.active) then
|
|
Tercio@26
|
511 DF:FadeFrame (frame1, 1)
|
|
Tercio@26
|
512 DF:FadeFrame (frame2, 1)
|
|
Tercio@11
|
513 end
|
|
Tercio@11
|
514 frame2:SetScript ("OnUpdate", nil)
|
|
Tercio@11
|
515 end
|
|
Tercio@11
|
516 end
|
|
Tercio@11
|
517
|
|
Tercio@11
|
518 function CoolTip:NewSecondaryButton (i)
|
|
Tercio@11
|
519 local botao = CoolTip:CreateButton (i, frame2, "GameCooltipSecButton"..i)
|
|
Tercio@11
|
520
|
|
Tercio@11
|
521 botao:SetScript ("OnEnter", function()
|
|
Tercio@11
|
522 if (CoolTip.OptionsTable.SubMenuIsTooltip) then
|
|
Tercio@11
|
523 return CoolTip:Close()
|
|
Tercio@11
|
524 end
|
|
Tercio@11
|
525 if (CoolTip.Type ~= 1 and CoolTip.Type ~= 2 and not botao.isDiv) then
|
|
Tercio@11
|
526 CoolTip.active = true
|
|
Tercio@11
|
527 CoolTip.mouseOver = true
|
|
Tercio@20
|
528 CoolTip.had_interaction = true
|
|
Tercio@11
|
529
|
|
Tercio@11
|
530 botao.background:Show()
|
|
Tercio@11
|
531
|
|
Tercio@11
|
532 if (CoolTip.OptionsTable.IconBlendModeHover) then
|
|
Tercio@11
|
533 botao.leftIcon:SetBlendMode (CoolTip.OptionsTable.IconBlendModeHover)
|
|
Tercio@11
|
534 else
|
|
Tercio@11
|
535 botao.leftIcon:SetBlendMode ("BLEND")
|
|
Tercio@11
|
536 end
|
|
Tercio@11
|
537
|
|
Tercio@11
|
538 frame1:SetScript ("OnUpdate", nil)
|
|
Tercio@11
|
539 frame2:SetScript ("OnUpdate", nil)
|
|
Tercio@11
|
540
|
|
Tercio@26
|
541 DF:FadeFrame (frame1, 0)
|
|
Tercio@26
|
542 DF:FadeFrame (frame2, 0)
|
|
Tercio@11
|
543 else
|
|
Tercio@11
|
544 CoolTip.mouseOver = true
|
|
Tercio@20
|
545 CoolTip.had_interaction = true
|
|
Tercio@11
|
546 end
|
|
Tercio@11
|
547 end)
|
|
Tercio@11
|
548
|
|
Tercio@11
|
549 botao:SetScript ("OnLeave", function()
|
|
Tercio@11
|
550 if (CoolTip.Type ~= 1 and CoolTip.Type ~= 2) then
|
|
Tercio@11
|
551 CoolTip.active = false
|
|
Tercio@11
|
552 CoolTip.mouseOver = false
|
|
Tercio@11
|
553
|
|
Tercio@11
|
554 botao.background:Hide()
|
|
Tercio@11
|
555
|
|
Tercio@11
|
556 if (CoolTip.OptionsTable.IconBlendMode) then
|
|
Tercio@11
|
557 botao.leftIcon:SetBlendMode (CoolTip.OptionsTable.IconBlendMode)
|
|
Tercio@11
|
558 botao.rightIcon:SetBlendMode (CoolTip.OptionsTable.IconBlendMode)
|
|
Tercio@11
|
559 else
|
|
Tercio@11
|
560 botao.leftIcon:SetBlendMode ("BLEND")
|
|
Tercio@11
|
561 botao.rightIcon:SetBlendMode ("BLEND")
|
|
Tercio@11
|
562 end
|
|
Tercio@11
|
563
|
|
Tercio@11
|
564 elapsedTime = 0
|
|
Tercio@11
|
565 frame2:SetScript ("OnUpdate", OnLeaveUpdateButtonSec)
|
|
Tercio@11
|
566 else
|
|
Tercio@11
|
567 CoolTip.active = false
|
|
Tercio@11
|
568 CoolTip.mouseOver = false
|
|
Tercio@11
|
569 elapsedTime = 0
|
|
Tercio@11
|
570 frame2:SetScript ("OnUpdate", OnLeaveUpdateButtonSec)
|
|
Tercio@11
|
571 end
|
|
Tercio@11
|
572 end)
|
|
Tercio@11
|
573
|
|
Tercio@11
|
574 return botao
|
|
Tercio@11
|
575 end
|
|
Tercio@11
|
576
|
|
Tercio@11
|
577 ----------------------------------------------------------------------
|
|
Tercio@11
|
578 --> Button Click Functions
|
|
Tercio@11
|
579 ----------------------------------------------------------------------
|
|
Tercio@11
|
580
|
|
Tercio@11
|
581 CoolTip.selected_anchor.left = 4
|
|
Tercio@11
|
582 CoolTip.selected_anchor.right = -4
|
|
Tercio@11
|
583 CoolTip.selected_anchor.top = 0
|
|
Tercio@11
|
584 CoolTip.selected_anchor.bottom = 0
|
|
Tercio@11
|
585
|
|
Tercio@11
|
586 function CoolTip:HideSelectedTexture (frame)
|
|
Tercio@11
|
587 frame.selectedTop:Hide()
|
|
Tercio@11
|
588 frame.selectedBottom:Hide()
|
|
Tercio@11
|
589 frame.selectedMiddle:Hide()
|
|
Tercio@11
|
590 end
|
|
Tercio@11
|
591
|
|
Tercio@11
|
592 function CoolTip:ShowSelectedTexture (frame)
|
|
Tercio@11
|
593 frame.selectedTop:Show()
|
|
Tercio@11
|
594 frame.selectedBottom:Show()
|
|
Tercio@11
|
595 frame.selectedMiddle:Show()
|
|
Tercio@11
|
596 end
|
|
Tercio@11
|
597
|
|
Tercio@11
|
598 function CoolTip:SetSelectedAnchor (frame, button)
|
|
Tercio@11
|
599
|
|
Tercio@11
|
600 local left = CoolTip.selected_anchor.left + (CoolTip.OptionsTable.SelectedLeftAnchorMod or 0)
|
|
Tercio@11
|
601 local right = CoolTip.selected_anchor.right + (CoolTip.OptionsTable.SelectedRightAnchorMod or 0)
|
|
Tercio@11
|
602
|
|
Tercio@11
|
603 local top = CoolTip.selected_anchor.top + (CoolTip.OptionsTable.SelectedTopAnchorMod or 0)
|
|
Tercio@11
|
604 local bottom = CoolTip.selected_anchor.bottom + (CoolTip.OptionsTable.SelectedBottomAnchorMod or 0)
|
|
Tercio@11
|
605
|
|
Tercio@11
|
606 frame.selectedTop:ClearAllPoints()
|
|
Tercio@11
|
607 frame.selectedBottom:ClearAllPoints()
|
|
Tercio@11
|
608
|
|
Tercio@40
|
609 frame.selectedTop:SetPoint ("topleft", button, "topleft", left+1, top) --
|
|
Tercio@40
|
610 frame.selectedTop:SetPoint ("topright", button, "topright", right-1, top) --
|
|
Tercio@11
|
611
|
|
Tercio@40
|
612 frame.selectedBottom:SetPoint ("bottomleft", button, "bottomleft", left+1, bottom) --
|
|
Tercio@40
|
613 frame.selectedBottom:SetPoint ("bottomright", button, "bottomright", right-1, bottom) --
|
|
Tercio@11
|
614
|
|
Tercio@11
|
615 CoolTip:ShowSelectedTexture (frame)
|
|
Tercio@11
|
616 end
|
|
Tercio@11
|
617
|
|
Tercio@40
|
618 local OnClickFunctionButtonPrincipal = function (self, button)
|
|
Tercio@11
|
619 if (CoolTip.IndexesSub [self.index] and CoolTip.IndexesSub [self.index] > 0) then
|
|
Tercio@11
|
620 CoolTip:ShowSub (self.index)
|
|
Tercio@11
|
621 CoolTip.last_button = self.index
|
|
Tercio@11
|
622 end
|
|
Tercio@11
|
623
|
|
Tercio@11
|
624 CoolTip.buttonClicked = true
|
|
Tercio@11
|
625 CoolTip:SetSelectedAnchor (frame1, self)
|
|
Tercio@11
|
626
|
|
Tercio@11
|
627 if (not CoolTip.OptionsTable.NoLastSelectedBar) then
|
|
Tercio@11
|
628 CoolTip:ShowSelectedTexture (frame1)
|
|
Tercio@11
|
629
|
|
Tercio@11
|
630 end
|
|
Tercio@11
|
631 CoolTip.SelectedIndexMain = self.index
|
|
Tercio@11
|
632
|
|
Tercio@11
|
633 if (CoolTip.FunctionsTableMain [self.index]) then
|
|
Tercio@11
|
634 local parameterTable = CoolTip.ParametersTableMain [self.index]
|
|
Tercio@40
|
635 CoolTip.FunctionsTableMain [self.index] (_, CoolTip.FixedValue, parameterTable [1], parameterTable [2], parameterTable [3], button)
|
|
Tercio@11
|
636 end
|
|
Tercio@11
|
637 end
|
|
Tercio@11
|
638
|
|
Tercio@40
|
639 local OnClickFunctionButtonSecundario = function (self, button)
|
|
Tercio@11
|
640 CoolTip.buttonClicked = true
|
|
Tercio@11
|
641
|
|
Tercio@11
|
642 CoolTip:SetSelectedAnchor (frame2, self)
|
|
Tercio@11
|
643
|
|
Tercio@11
|
644 if (CoolTip.FunctionsTableSub [self.mainIndex] and CoolTip.FunctionsTableSub [self.mainIndex] [self.index]) then
|
|
Tercio@11
|
645 local parameterTable = CoolTip.ParametersTableSub [self.mainIndex] [self.index]
|
|
Tercio@40
|
646 CoolTip.FunctionsTableSub [self.mainIndex] [self.index] (_, CoolTip.FixedValue, parameterTable [1], parameterTable [2], parameterTable [3], button)
|
|
Tercio@11
|
647 end
|
|
Tercio@11
|
648
|
|
Tercio@11
|
649 local botao_p = frame1.Lines [self.mainIndex]
|
|
Tercio@11
|
650 CoolTip:SetSelectedAnchor (frame1, botao_p)
|
|
Tercio@11
|
651
|
|
Tercio@11
|
652 if (not CoolTip.OptionsTable.NoLastSelectedBar) then
|
|
Tercio@11
|
653 CoolTip:ShowSelectedTexture (frame1)
|
|
Tercio@11
|
654 end
|
|
Tercio@11
|
655
|
|
Tercio@11
|
656 CoolTip.SelectedIndexMain = self.mainIndex
|
|
Tercio@11
|
657 CoolTip.SelectedIndexSec [self.mainIndex] = self.index
|
|
Tercio@11
|
658
|
|
Tercio@11
|
659 end
|
|
Tercio@11
|
660
|
|
Tercio@11
|
661 function CoolTip:TextAndIcon (index, frame, menuButton, leftTextTable, rightTextTable, leftIconTable, rightIconTable, isSub)
|
|
Tercio@11
|
662
|
|
Tercio@11
|
663 --> reset width
|
|
Tercio@11
|
664 menuButton.leftText:SetWidth (0)
|
|
Tercio@11
|
665 menuButton.leftText:SetHeight (0)
|
|
Tercio@11
|
666 menuButton.rightText:SetWidth (0)
|
|
Tercio@11
|
667 menuButton.rightText:SetHeight (0)
|
|
Tercio@11
|
668
|
|
Tercioo@30
|
669 menuButton.rightText:SetPoint ("right", menuButton.rightIcon, "left", CoolTip.OptionsTable.RightTextMargin or -3, 0)
|
|
Tercioo@30
|
670
|
|
Tercio@11
|
671 --> set text
|
|
Tercio@11
|
672 if (leftTextTable) then
|
|
Tercio@11
|
673
|
|
Tercio@11
|
674 menuButton.leftText:SetText (leftTextTable [1])
|
|
Tercio@11
|
675
|
|
Tercio@11
|
676 local r, g, b, a = leftTextTable [2], leftTextTable [3], leftTextTable [4], leftTextTable [5]
|
|
Tercio@11
|
677
|
|
Tercio@11
|
678 if (r == 0 and g == 0 and b == 0 and a == 0) then
|
|
Tercio@11
|
679 if (CoolTip.OptionsTable.TextColor) then
|
|
Tercio@11
|
680 r, g, b, a = DF:ParseColors (CoolTip.OptionsTable.TextColor)
|
|
Tercio@11
|
681 menuButton.leftText:SetTextColor (r, g, b, a)
|
|
Tercio@11
|
682 else
|
|
Tercio@11
|
683 menuButton.leftText:SetTextColor (1, 1, 1, 1)
|
|
Tercio@11
|
684 end
|
|
Tercio@11
|
685 else
|
|
Tercio@11
|
686 menuButton.leftText:SetTextColor (r, g, b, a)
|
|
Tercio@11
|
687 end
|
|
Tercio@11
|
688
|
|
Tercio@11
|
689 if (CoolTip.OptionsTable.TextSize and not leftTextTable [6]) then
|
|
Tercio@11
|
690 DF:SetFontSize (menuButton.leftText, CoolTip.OptionsTable.TextSize)
|
|
Tercio@11
|
691 end
|
|
Tercio@11
|
692
|
|
Tercio@11
|
693 if (CoolTip.OptionsTable.LeftTextWidth) then
|
|
Tercio@11
|
694 menuButton.leftText:SetWidth (CoolTip.OptionsTable.LeftTextWidth)
|
|
Tercio@11
|
695 else
|
|
Tercio@11
|
696 menuButton.leftText:SetWidth (0)
|
|
Tercio@11
|
697 end
|
|
Tercio@11
|
698
|
|
Tercio@11
|
699 if (CoolTip.OptionsTable.LeftTextHeight) then
|
|
Tercio@11
|
700 menuButton.leftText:SetHeight (CoolTip.OptionsTable.LeftTextHeight)
|
|
Tercio@11
|
701 else
|
|
Tercio@11
|
702 menuButton.leftText:SetHeight (0)
|
|
Tercio@11
|
703 end
|
|
Tercio@11
|
704
|
|
Tercio@11
|
705 if (CoolTip.OptionsTable.TextFont and not leftTextTable [7]) then --font
|
|
Tercio@11
|
706
|
|
Tercio@11
|
707 if (_G [CoolTip.OptionsTable.TextFont]) then
|
|
Tercio@11
|
708 menuButton.leftText:SetFontObject (GameFontRed or CoolTip.OptionsTable.TextFont)
|
|
Tercio@11
|
709 else
|
|
Tercio@11
|
710 local font = SharedMedia:Fetch ("font", CoolTip.OptionsTable.TextFont)
|
|
Tercio@11
|
711 local _, size, flags = menuButton.leftText:GetFont()
|
|
Tercio@11
|
712 flags = leftTextTable [8] or CoolTip.OptionsTable.TextShadow or nil
|
|
Tercio@11
|
713 size = leftTextTable [6] or CoolTip.OptionsTable.TextSize or size
|
|
Tercio@11
|
714 menuButton.leftText:SetFont (font, size, flags)
|
|
Tercio@11
|
715 end
|
|
Tercio@11
|
716
|
|
Tercio@11
|
717 elseif (leftTextTable [7]) then
|
|
Tercio@11
|
718 if (_G [leftTextTable [7]]) then
|
|
Tercio@11
|
719 menuButton.leftText:SetFontObject (leftTextTable [7])
|
|
Tercio@11
|
720 local face, size, flags = menuButton.leftText:GetFont()
|
|
Tercio@11
|
721 flags = leftTextTable [8] or CoolTip.OptionsTable.TextShadow or nil
|
|
Tercio@11
|
722 size = leftTextTable [6] or CoolTip.OptionsTable.TextSize or size
|
|
Tercio@11
|
723 menuButton.leftText:SetFont (face, size, flags)
|
|
Tercio@11
|
724 else
|
|
Tercio@11
|
725 local font = SharedMedia:Fetch ("font", leftTextTable [7])
|
|
Tercio@11
|
726 local face, size, flags = menuButton.leftText:GetFont()
|
|
Tercio@11
|
727 flags = leftTextTable [8] or CoolTip.OptionsTable.TextShadow or nil
|
|
Tercio@11
|
728 size = leftTextTable [6] or CoolTip.OptionsTable.TextSize or size
|
|
Tercio@11
|
729 menuButton.leftText:SetFont (face, size, flags)
|
|
Tercio@11
|
730 end
|
|
Tercio@11
|
731 else
|
|
Tercio@11
|
732 menuButton.leftText:SetFont (CoolTip._default_font, leftTextTable [6] or CoolTip.OptionsTable.TextSize or 10, leftTextTable [8] or CoolTip.OptionsTable.TextShadow)
|
|
Tercio@11
|
733 end
|
|
Tercio@11
|
734
|
|
Tercio@11
|
735 local height_mod = CoolTip.OptionsTable.TextHeightMod or 0
|
|
Tercio@11
|
736 menuButton.leftText:SetPoint ("center", menuButton.leftIcon, "center", 0, 0+height_mod)
|
|
Tercio@11
|
737 menuButton.leftText:SetPoint ("left", menuButton.leftIcon, "right", 3, 0+height_mod)
|
|
Tercio@11
|
738
|
|
Tercio@11
|
739 else
|
|
Tercio@11
|
740 menuButton.leftText:SetText ("")
|
|
Tercio@11
|
741 end
|
|
Tercio@11
|
742
|
|
Tercio@11
|
743 if (rightTextTable) then
|
|
Tercio@11
|
744 menuButton.rightText:SetText (rightTextTable [1])
|
|
Tercio@11
|
745
|
|
Tercio@11
|
746 local r, g, b, a = rightTextTable [2], rightTextTable [3], rightTextTable [4], rightTextTable [5]
|
|
Tercio@11
|
747
|
|
Tercio@11
|
748 if (r == 0 and g == 0 and b == 0 and a == 0) then
|
|
Tercio@11
|
749
|
|
Tercio@11
|
750 if (CoolTip.OptionsTable.TextColorRight) then
|
|
Tercio@11
|
751 r, g, b, a = DF:ParseColors (CoolTip.OptionsTable.TextColorRight)
|
|
Tercio@11
|
752 menuButton.rightText:SetTextColor (r, g, b, a)
|
|
Tercio@11
|
753 elseif (CoolTip.OptionsTable.TextColor) then
|
|
Tercio@11
|
754 r, g, b, a = DF:ParseColors (CoolTip.OptionsTable.TextColor)
|
|
Tercio@11
|
755 menuButton.rightText:SetTextColor (r, g, b, a)
|
|
Tercio@11
|
756 else
|
|
Tercio@11
|
757 menuButton.rightText:SetTextColor (1, 1, 1, 1)
|
|
Tercio@11
|
758 end
|
|
Tercio@11
|
759 else
|
|
Tercio@11
|
760 menuButton.rightText:SetTextColor (r, g, b, a)
|
|
Tercio@11
|
761 end
|
|
Tercio@11
|
762
|
|
Tercio@11
|
763 if (CoolTip.OptionsTable.TextSize and not rightTextTable [6]) then
|
|
Tercio@11
|
764 DF:SetFontSize (menuButton.rightText, CoolTip.OptionsTable.TextSize)
|
|
Tercio@11
|
765 end
|
|
Tercio@11
|
766
|
|
Tercio@11
|
767 if (CoolTip.OptionsTable.RightTextWidth) then
|
|
Tercio@11
|
768 menuButton.rightText:SetWidth (CoolTip.OptionsTable.RightTextWidth)
|
|
Tercio@11
|
769 else
|
|
Tercio@11
|
770 menuButton.rightText:SetWidth (0)
|
|
Tercio@11
|
771 end
|
|
Tercio@11
|
772
|
|
Tercio@11
|
773 if (CoolTip.OptionsTable.TextFont and not rightTextTable [7]) then
|
|
Tercio@11
|
774 if (_G [CoolTip.OptionsTable.TextFont]) then
|
|
Tercio@11
|
775 menuButton.rightText:SetFontObject (CoolTip.OptionsTable.TextFont)
|
|
Tercio@11
|
776 else
|
|
Tercio@11
|
777 local font = SharedMedia:Fetch ("font", CoolTip.OptionsTable.TextFont)
|
|
Tercio@11
|
778 local _, size, flags = menuButton.rightText:GetFont()
|
|
Tercio@11
|
779 flags = rightTextTable [8] or CoolTip.OptionsTable.TextShadow or nil
|
|
Tercio@11
|
780 size = rightTextTable [6] or CoolTip.OptionsTable.TextSize or size
|
|
Tercio@11
|
781 menuButton.rightText:SetFont (font, size, flags)
|
|
Tercio@11
|
782 end
|
|
Tercio@11
|
783
|
|
Tercio@11
|
784 elseif (rightTextTable [7]) then
|
|
Tercio@11
|
785 if (_G [rightTextTable [7]]) then
|
|
Tercio@11
|
786 menuButton.rightText:SetFontObject (rightTextTable [7])
|
|
Tercio@11
|
787 local face, size, flags = menuButton.rightText:GetFont()
|
|
Tercio@11
|
788 flags = rightTextTable [8] or CoolTip.OptionsTable.TextShadow or nil
|
|
Tercio@11
|
789 size = rightTextTable [6] or CoolTip.OptionsTable.TextSize or size
|
|
Tercio@11
|
790 menuButton.rightText:SetFont (face, size, flags)
|
|
Tercio@11
|
791 else
|
|
Tercio@11
|
792 local font = SharedMedia:Fetch ("font", rightTextTable [7])
|
|
Tercio@11
|
793 local face, size, flags = menuButton.rightText:GetFont()
|
|
Tercio@11
|
794 flags = rightTextTable [8] or CoolTip.OptionsTable.TextShadow or nil
|
|
Tercio@11
|
795 size = rightTextTable [6] or CoolTip.OptionsTable.TextSize or size
|
|
Tercio@11
|
796 menuButton.rightText:SetFont (face, size, flags)
|
|
Tercio@11
|
797 end
|
|
Tercio@11
|
798
|
|
Tercio@11
|
799 else
|
|
Tercio@11
|
800 menuButton.rightText:SetFont (CoolTip._default_font, rightTextTable [6] or CoolTip.OptionsTable.TextSize or 10, rightTextTable [8] or CoolTip.OptionsTable.TextShadow)
|
|
Tercio@11
|
801 end
|
|
Tercio@11
|
802
|
|
Tercio@11
|
803
|
|
Tercio@11
|
804 else
|
|
Tercio@11
|
805 menuButton.rightText:SetText ("")
|
|
Tercio@11
|
806 end
|
|
Tercio@11
|
807
|
|
Tercio@11
|
808 --> left icon
|
|
Tercio@11
|
809 if (leftIconTable and leftIconTable [1]) then
|
|
Tercio@11
|
810 menuButton.leftIcon:SetTexture (leftIconTable [1])
|
|
Tercio@11
|
811 menuButton.leftIcon:SetWidth (leftIconTable [2])
|
|
Tercio@11
|
812 menuButton.leftIcon:SetHeight (leftIconTable [3])
|
|
Tercio@11
|
813 menuButton.leftIcon:SetTexCoord (leftIconTable [4], leftIconTable [5], leftIconTable [6], leftIconTable [7])
|
|
Tercio@11
|
814
|
|
Tercio@11
|
815 local ColorR, ColorG, ColorB, ColorA = DF:ParseColors (leftIconTable [8])
|
|
Tercio@11
|
816 menuButton.leftIcon:SetVertexColor (ColorR, ColorG, ColorB, ColorA)
|
|
Tercio@11
|
817
|
|
Tercio@11
|
818 if (CoolTip.OptionsTable.IconBlendMode) then
|
|
Tercio@11
|
819 menuButton.leftIcon:SetBlendMode (CoolTip.OptionsTable.IconBlendMode)
|
|
Tercio@11
|
820 else
|
|
Tercio@11
|
821 menuButton.leftIcon:SetBlendMode ("BLEND")
|
|
Tercio@11
|
822 end
|
|
Tercio@11
|
823
|
|
Tercio@11
|
824 menuButton.leftIcon:SetDesaturated (leftIconTable [9])
|
|
Tercio@11
|
825 else
|
|
Tercio@11
|
826 menuButton.leftIcon:SetTexture (nil)
|
|
Tercio@11
|
827 menuButton.leftIcon:SetWidth (1)
|
|
Tercio@11
|
828 menuButton.leftIcon:SetHeight (1)
|
|
Tercio@11
|
829 end
|
|
Tercio@11
|
830
|
|
Tercio@11
|
831 --> right icon
|
|
Tercio@11
|
832 if (rightIconTable and rightIconTable [1]) then
|
|
Tercio@11
|
833 menuButton.rightIcon:SetTexture (rightIconTable [1])
|
|
Tercio@11
|
834 menuButton.rightIcon:SetWidth (rightIconTable [2])
|
|
Tercio@11
|
835 menuButton.rightIcon:SetHeight (rightIconTable [3])
|
|
Tercio@11
|
836 menuButton.rightIcon:SetTexCoord (rightIconTable [4], rightIconTable [5], rightIconTable [6], rightIconTable [7])
|
|
Tercio@11
|
837
|
|
Tercio@11
|
838 local ColorR, ColorG, ColorB, ColorA = DF:ParseColors (rightIconTable [8])
|
|
Tercio@11
|
839 menuButton.rightIcon:SetVertexColor (ColorR, ColorG, ColorB, ColorA)
|
|
Tercio@11
|
840
|
|
Tercio@11
|
841 if (CoolTip.OptionsTable.IconBlendMode) then
|
|
Tercio@11
|
842 menuButton.rightIcon:SetBlendMode (CoolTip.OptionsTable.IconBlendMode)
|
|
Tercio@11
|
843 else
|
|
Tercio@11
|
844 menuButton.rightIcon:SetBlendMode ("BLEND")
|
|
Tercio@11
|
845 end
|
|
Tercio@11
|
846
|
|
Tercio@11
|
847 menuButton.rightIcon:SetDesaturated (rightIconTable [9])
|
|
Tercio@11
|
848 else
|
|
Tercio@11
|
849 menuButton.rightIcon:SetTexture (nil)
|
|
Tercio@11
|
850 menuButton.rightIcon:SetWidth (1)
|
|
Tercio@11
|
851 menuButton.rightIcon:SetHeight (1)
|
|
Tercio@11
|
852 end
|
|
Tercio@11
|
853
|
|
Tercio@11
|
854 --> overwrite icon size
|
|
Tercio@11
|
855 if (CoolTip.OptionsTable.IconSize) then
|
|
Tercio@11
|
856 menuButton.leftIcon:SetWidth (CoolTip.OptionsTable.IconSize)
|
|
Tercio@11
|
857 menuButton.leftIcon:SetHeight (CoolTip.OptionsTable.IconSize)
|
|
Tercio@11
|
858 menuButton.rightIcon:SetWidth (CoolTip.OptionsTable.IconSize)
|
|
Tercio@11
|
859 menuButton.rightIcon:SetHeight (CoolTip.OptionsTable.IconSize)
|
|
Tercio@11
|
860 end
|
|
Tercio@11
|
861
|
|
Tercio@40
|
862 menuButton.leftText:SetHeight (0)
|
|
Tercio@40
|
863 menuButton.rightText:SetHeight (0)
|
|
Tercio@40
|
864
|
|
Tercio@11
|
865 if (CoolTip.Type == 2) then
|
|
Tercio@11
|
866 CoolTip:LeftTextSpace (menuButton)
|
|
Tercio@11
|
867 end
|
|
Tercio@40
|
868 if (CoolTip.OptionsTable.LeftTextHeight) then
|
|
Tercio@40
|
869 menuButton.leftText:SetHeight (CoolTip.OptionsTable.LeftTextHeight)
|
|
Tercio@40
|
870 end
|
|
Tercio@40
|
871 if (CoolTip.OptionsTable.RightTextHeight) then
|
|
Tercio@40
|
872 menuButton.rightText:SetHeight (CoolTip.OptionsTable.RightTextHeight)
|
|
Tercio@40
|
873 end
|
|
Tercio@11
|
874
|
|
Tercio@11
|
875 --> string length
|
|
Tercio@11
|
876 if (not isSub) then --> main frame
|
|
Tercio@11
|
877 if (not CoolTip.OptionsTable.FixedWidth) then
|
|
Tercio@11
|
878 if (CoolTip.Type == 1 or CoolTip.Type == 2) then
|
|
Tercio@11
|
879 local stringWidth = menuButton.leftText:GetStringWidth() + menuButton.rightText:GetStringWidth() + menuButton.leftIcon:GetWidth() + menuButton.rightIcon:GetWidth() + 10
|
|
Tercio@11
|
880 if (stringWidth > frame.w) then
|
|
Tercio@11
|
881 frame.w = stringWidth
|
|
Tercio@11
|
882 end
|
|
Tercio@11
|
883 end
|
|
Tercio@11
|
884 else
|
|
Tercio@40
|
885 menuButton.leftText:SetWidth (CoolTip.OptionsTable.FixedWidth - menuButton.leftIcon:GetWidth() - menuButton.rightText:GetStringWidth() - menuButton.rightIcon:GetWidth() - 22)
|
|
Tercio@11
|
886 end
|
|
Tercio@11
|
887 else
|
|
Tercio@11
|
888 if (not CoolTip.OptionsTable.FixedWidthSub) then
|
|
Tercio@11
|
889 if (CoolTip.Type == 1 or CoolTip.Type == 2) then
|
|
Tercio@11
|
890 local stringWidth = menuButton.leftText:GetStringWidth() + menuButton.rightText:GetStringWidth() + menuButton.leftIcon:GetWidth() + menuButton.rightIcon:GetWidth()
|
|
Tercio@11
|
891 if (stringWidth > frame.w) then
|
|
Tercio@11
|
892 frame.w = stringWidth
|
|
Tercio@11
|
893 end
|
|
Tercio@11
|
894 end
|
|
Tercio@11
|
895 else
|
|
Tercio@40
|
896 menuButton.leftText:SetWidth (CoolTip.OptionsTable.FixedWidthSub - menuButton.leftIcon:GetWidth() - 12)
|
|
Tercio@11
|
897 end
|
|
Tercio@11
|
898 end
|
|
Tercio@11
|
899
|
|
Tercio@11
|
900 local height = _math_max ( menuButton.leftIcon:GetHeight(), menuButton.rightIcon:GetHeight(), menuButton.leftText:GetStringHeight(), menuButton.rightText:GetStringHeight() )
|
|
Tercio@11
|
901 if (height > frame.hHeight) then
|
|
Tercio@11
|
902 frame.hHeight = height
|
|
Tercio@11
|
903 end
|
|
Tercio@11
|
904
|
|
Tercio@11
|
905 end
|
|
Tercio@11
|
906
|
|
Tercio@11
|
907 function CoolTip:RefreshSpark (menuButton)
|
|
Tercio@11
|
908 menuButton.spark:ClearAllPoints()
|
|
Tercio@45
|
909 menuButton.spark:SetPoint ("LEFT", menuButton.statusbar, "LEFT", (menuButton.statusbar:GetValue() * (menuButton.statusbar:GetWidth() / 100)) - 5, 0)
|
|
Tercio@11
|
910 menuButton.spark2:ClearAllPoints()
|
|
Tercio@11
|
911 menuButton.spark2:SetPoint ("left", menuButton.statusbar, "left", menuButton.statusbar:GetValue() * (menuButton.statusbar:GetWidth()/100) - 16, 0)
|
|
Tercio@11
|
912 end
|
|
Tercio@11
|
913
|
|
Tercio@11
|
914 function CoolTip:StatusBar (menuButton, StatusBar)
|
|
Tercioo@29
|
915
|
|
Tercio@11
|
916 if (StatusBar) then
|
|
Tercio@11
|
917
|
|
Tercio@11
|
918 menuButton.statusbar:SetValue (StatusBar [1])
|
|
Tercio@11
|
919 menuButton.statusbar:SetStatusBarColor (StatusBar [2], StatusBar [3], StatusBar [4], StatusBar [5])
|
|
Tercio@11
|
920 menuButton.statusbar:SetHeight (20 + (CoolTip.OptionsTable.StatusBarHeightMod or 0))
|
|
Tercio@11
|
921
|
|
Tercio@11
|
922 menuButton.spark2:Hide()
|
|
Tercio@11
|
923 if (StatusBar [6]) then
|
|
Tercio@11
|
924 menuButton.spark:Show()
|
|
Tercio@11
|
925 --menuButton.spark:ClearAllPoints()
|
|
Tercio@11
|
926 --menuButton.spark:SetPoint ("LEFT", menuButton.statusbar, "LEFT", (StatusBar [1] * (menuButton.statusbar:GetWidth() / 100)) - 3, 0)
|
|
Tercio@11
|
927 else
|
|
Tercio@11
|
928 menuButton.spark:Hide()
|
|
Tercio@11
|
929 end
|
|
Tercio@11
|
930
|
|
Tercio@11
|
931 if (StatusBar [7]) then
|
|
Tercio@11
|
932 menuButton.statusbar2:SetValue (StatusBar[7].value)
|
|
Tercio@11
|
933 menuButton.statusbar2.texture:SetTexture (StatusBar[7].texture or [[Interface\RaidFrame\Raid-Bar-Hp-Fill]])
|
|
Tercio@11
|
934 if (StatusBar[7].specialSpark) then
|
|
Tercio@11
|
935 menuButton.spark2:Show()
|
|
Tercio@11
|
936 end
|
|
Tercio@11
|
937 if (StatusBar[7].color) then
|
|
Tercio@11
|
938 local ColorR, ColorG, ColorB, ColorA = DF:ParseColors (StatusBar[7].color)
|
|
Tercio@11
|
939 menuButton.statusbar2:SetStatusBarColor (ColorR, ColorG, ColorB, ColorA)
|
|
Tercio@11
|
940 else
|
|
Tercio@11
|
941 menuButton.statusbar2:SetStatusBarColor (1, 1, 1, 1)
|
|
Tercio@11
|
942 end
|
|
Tercio@11
|
943 else
|
|
Tercio@11
|
944 menuButton.statusbar2:SetValue (0)
|
|
Tercio@11
|
945 menuButton.spark2:Hide()
|
|
Tercio@11
|
946 end
|
|
Tercio@11
|
947
|
|
Tercioo@29
|
948 if (StatusBar [8]) then
|
|
Tercioo@29
|
949 local texture = SharedMedia:Fetch ("statusbar", StatusBar [8], true)
|
|
Tercioo@29
|
950 if (texture) then
|
|
Tercioo@29
|
951 menuButton.statusbar.texture:SetTexture (texture)
|
|
Tercioo@29
|
952 else
|
|
Tercioo@29
|
953 menuButton.statusbar.texture:SetTexture (StatusBar [8])
|
|
Tercioo@29
|
954 end
|
|
Tercioo@29
|
955 elseif (CoolTip.OptionsTable.StatusBarTexture) then
|
|
Tercioo@29
|
956 local texture = SharedMedia:Fetch ("statusbar", CoolTip.OptionsTable.StatusBarTexture, true)
|
|
Tercioo@29
|
957 if (texture) then
|
|
Tercioo@29
|
958 menuButton.statusbar.texture:SetTexture (texture)
|
|
Tercioo@29
|
959 else
|
|
Tercioo@29
|
960 menuButton.statusbar.texture:SetTexture (CoolTip.OptionsTable.StatusBarTexture)
|
|
Tercioo@29
|
961 end
|
|
Tercioo@29
|
962 else
|
|
Tercioo@29
|
963 menuButton.statusbar.texture:SetTexture ("Interface\\PaperDollInfoFrame\\UI-Character-Skills-Bar")
|
|
Tercioo@29
|
964 end
|
|
Tercioo@29
|
965
|
|
Tercioo@29
|
966 --[[
|
|
Tercio@11
|
967 if (CoolTip.OptionsTable.StatusBarTexture) then
|
|
Tercio@11
|
968 menuButton.statusbar.texture:SetTexture (CoolTip.OptionsTable.StatusBarTexture)
|
|
Tercio@11
|
969 else
|
|
Tercio@11
|
970 menuButton.statusbar.texture:SetTexture ("Interface\\PaperDollInfoFrame\\UI-Character-Skills-Bar")
|
|
Tercio@11
|
971 end
|
|
Tercioo@29
|
972 --]]
|
|
Tercio@11
|
973 else
|
|
Tercio@11
|
974 menuButton.statusbar:SetValue (0)
|
|
Tercio@11
|
975 menuButton.statusbar2:SetValue (0)
|
|
Tercio@11
|
976 menuButton.spark:Hide()
|
|
Tercio@11
|
977 menuButton.spark2:Hide()
|
|
Tercio@11
|
978 end
|
|
Tercioo@29
|
979
|
|
Tercio@11
|
980 if (CoolTip.OptionsTable.LeftBorderSize) then
|
|
Tercio@11
|
981 menuButton.statusbar:SetPoint ("left", menuButton, "left", 10 + CoolTip.OptionsTable.LeftBorderSize, 0)
|
|
Tercio@11
|
982 else
|
|
Tercio@11
|
983 menuButton.statusbar:SetPoint ("left", menuButton, "left", 10, 0)
|
|
Tercio@11
|
984 end
|
|
Tercio@11
|
985
|
|
Tercio@11
|
986 if (CoolTip.OptionsTable.RightBorderSize) then
|
|
Tercio@11
|
987 menuButton.statusbar:SetPoint ("right", menuButton, "right", CoolTip.OptionsTable.RightBorderSize + (- 10), 0)
|
|
Tercio@11
|
988 else
|
|
Tercio@11
|
989 menuButton.statusbar:SetPoint ("right", menuButton, "right", -10, 0)
|
|
Tercio@11
|
990 end
|
|
Tercio@11
|
991 end
|
|
Tercio@11
|
992
|
|
Tercio@11
|
993 function CoolTip:SetupMainButton (menuButton, index)
|
|
Tercio@11
|
994 menuButton.index = index
|
|
Tercio@11
|
995
|
|
Tercio@11
|
996 --> setup texts and icons
|
|
Tercio@11
|
997 CoolTip:TextAndIcon (index, frame1, menuButton, CoolTip.LeftTextTable [index], CoolTip.RightTextTable [index], CoolTip.LeftIconTable [index], CoolTip.RightIconTable [index])
|
|
Tercio@11
|
998 --> setup statusbar
|
|
Tercio@11
|
999 CoolTip:StatusBar (menuButton, CoolTip.StatusBarTable [index])
|
|
Tercio@11
|
1000
|
|
Tercio@11
|
1001 --> click
|
|
Tercio@11
|
1002 menuButton:RegisterForClicks ("LeftButtonDown")
|
|
Tercio@11
|
1003
|
|
Tercio@11
|
1004 --> string length
|
|
Tercio@11
|
1005 if (not CoolTip.OptionsTable.FixedWidth) then
|
|
Tercio@11
|
1006 local stringWidth = menuButton.leftText:GetStringWidth() + menuButton.rightText:GetStringWidth() + menuButton.leftIcon:GetWidth() + menuButton.rightIcon:GetWidth()
|
|
Tercio@11
|
1007 if (stringWidth > frame1.w) then
|
|
Tercio@11
|
1008 frame1.w = stringWidth
|
|
Tercio@11
|
1009 end
|
|
Tercio@11
|
1010 end
|
|
Tercio@11
|
1011
|
|
Tercio@11
|
1012 --> register click function
|
|
Tercio@11
|
1013 menuButton:SetScript ("OnClick", OnClickFunctionButtonPrincipal)
|
|
Tercio@11
|
1014 menuButton:Show()
|
|
Tercio@11
|
1015 end
|
|
Tercio@11
|
1016
|
|
Tercio@11
|
1017 function CoolTip:SetupSecondaryButton (menuButton, index, mainMenuIndex)
|
|
Tercio@11
|
1018
|
|
Tercio@11
|
1019 menuButton.index = index
|
|
Tercio@11
|
1020 menuButton.mainIndex = mainMenuIndex
|
|
Tercio@11
|
1021
|
|
Tercio@11
|
1022 --> setup texts and icons
|
|
Tercio@11
|
1023 CoolTip:TextAndIcon (index, frame2, menuButton, CoolTip.LeftTextTableSub [mainMenuIndex] and CoolTip.LeftTextTableSub [mainMenuIndex] [index],
|
|
Tercio@11
|
1024 CoolTip.RightTextTableSub [mainMenuIndex] and CoolTip.RightTextTableSub [mainMenuIndex] [index],
|
|
Tercio@11
|
1025 CoolTip.LeftIconTableSub [mainMenuIndex] and CoolTip.LeftIconTableSub [mainMenuIndex] [index],
|
|
Tercio@11
|
1026 CoolTip.RightIconTableSub [mainMenuIndex] and CoolTip.RightIconTableSub [mainMenuIndex] [index], true)
|
|
Tercio@11
|
1027 --> setup statusbar
|
|
Tercio@11
|
1028 CoolTip:StatusBar (menuButton, CoolTip.StatusBarTableSub [mainMenuIndex] and CoolTip.StatusBarTableSub [mainMenuIndex] [index])
|
|
Tercio@11
|
1029
|
|
Tercio@11
|
1030 --> click
|
|
Tercio@11
|
1031 menuButton:RegisterForClicks ("LeftButtonDown")
|
|
Tercio@11
|
1032
|
|
Tercio@11
|
1033 menuButton:ClearAllPoints()
|
|
Tercio@11
|
1034 menuButton:SetPoint ("center", frame2, "center")
|
|
Tercio@11
|
1035 menuButton:SetPoint ("top", frame2, "top", 0, (((index-1)*20)*-1)-3)
|
|
Tercio@40
|
1036 menuButton:SetPoint ("left", frame2, "left", -4, 0)
|
|
Tercio@40
|
1037 menuButton:SetPoint ("right", frame2, "right", 4, 0)
|
|
Tercio@11
|
1038
|
|
Tercio@26
|
1039 DF:FadeFrame (menuButton, 0)
|
|
Tercio@11
|
1040
|
|
Tercio@11
|
1041 --> string length
|
|
Tercio@11
|
1042 local stringWidth = menuButton.leftText:GetStringWidth() + menuButton.rightText:GetStringWidth() + menuButton.leftIcon:GetWidth() + menuButton.rightIcon:GetWidth()
|
|
Tercio@11
|
1043 if (stringWidth > frame2.w) then
|
|
Tercio@11
|
1044 frame2.w = stringWidth
|
|
Tercio@11
|
1045 end
|
|
Tercio@11
|
1046
|
|
Tercio@11
|
1047 menuButton:SetScript ("OnClick", OnClickFunctionButtonSecundario)
|
|
Tercio@11
|
1048 menuButton:Show()
|
|
Tercio@11
|
1049
|
|
Tercio@11
|
1050 return true
|
|
Tercio@11
|
1051 end
|
|
Tercio@11
|
1052
|
|
Tercio@11
|
1053 -- -- --------------------------------------------------------------------------------------------------------------
|
|
Tercio@11
|
1054
|
|
Tercio@11
|
1055 function CoolTip:SetupWallpaper (wallpaperTable, wallpaper)
|
|
Tercio@11
|
1056 local texture = wallpaperTable [1]
|
|
Tercio@11
|
1057 if (DF:IsHtmlColor (texture) or type (texture) == "table") then
|
|
Tercio@11
|
1058 local r, g, b, a = DF:ParseColors (texture)
|
|
Tercio@11
|
1059 wallpaper:SetTexture (r, g, b, a)
|
|
Tercio@11
|
1060 else
|
|
Tercio@11
|
1061 wallpaper:SetTexture (texture)
|
|
Tercio@11
|
1062 end
|
|
Tercio@11
|
1063
|
|
Tercio@11
|
1064 wallpaper:SetTexCoord (wallpaperTable[2], wallpaperTable[3], wallpaperTable[4], wallpaperTable[5])
|
|
Tercio@11
|
1065
|
|
Tercio@11
|
1066 local color = wallpaperTable[6]
|
|
Tercio@11
|
1067 if (color) then
|
|
Tercio@11
|
1068 local r, g, b, a = DF:ParseColors (color)
|
|
Tercio@11
|
1069 wallpaper:SetVertexColor (r, g, b, a)
|
|
Tercio@11
|
1070 else
|
|
Tercio@11
|
1071 wallpaper:SetVertexColor (1, 1, 1, 1)
|
|
Tercio@11
|
1072 end
|
|
Tercio@11
|
1073
|
|
Tercio@11
|
1074 if (wallpaperTable[7]) then
|
|
Tercio@11
|
1075 wallpaper:SetDesaturated (true)
|
|
Tercio@11
|
1076 else
|
|
Tercio@11
|
1077 wallpaper:SetDesaturated (false)
|
|
Tercio@11
|
1078 end
|
|
Tercio@11
|
1079
|
|
Tercio@11
|
1080 wallpaper:Show()
|
|
Tercio@11
|
1081 end
|
|
Tercio@11
|
1082
|
|
Tercio@11
|
1083 -- -- --------------------------------------------------------------------------------------------------------------
|
|
Tercio@11
|
1084
|
|
Tercio@11
|
1085 function CoolTip:ShowSub (index)
|
|
Tercio@11
|
1086
|
|
Tercio@11
|
1087 if (CoolTip.OptionsTable.IgnoreSubMenu) then
|
|
Tercio@26
|
1088 DF:FadeFrame (frame2, 1)
|
|
Tercio@11
|
1089 return
|
|
Tercio@11
|
1090 end
|
|
Tercio@11
|
1091
|
|
Tercio@11
|
1092 frame2:SetHeight (6)
|
|
Tercio@11
|
1093
|
|
Tercio@11
|
1094 local amtIndexes = CoolTip.IndexesSub [index]
|
|
Tercio@11
|
1095 if (not amtIndexes) then
|
|
Tercio@11
|
1096 --print ("Sub menu called but sub menu indexes is nil")
|
|
Tercio@11
|
1097 return
|
|
Tercio@11
|
1098 end
|
|
Tercio@11
|
1099
|
|
Tercio@11
|
1100 if (CoolTip.OptionsTable.FixedWidthSub) then
|
|
Tercio@11
|
1101 frame2:SetWidth (CoolTip.OptionsTable.FixedWidthSub)
|
|
Tercio@11
|
1102 end
|
|
Tercio@11
|
1103
|
|
Tercio@11
|
1104 frame2.h = CoolTip.IndexesSub [index] * 20
|
|
Tercio@11
|
1105 frame2.hHeight = 0
|
|
Tercio@11
|
1106 frame2.w = 0
|
|
Tercio@11
|
1107
|
|
Tercio@11
|
1108 --> pegar a fontsize da label principal
|
|
Tercio@11
|
1109 local mainButton = frame1.Lines [index]
|
|
Tercio@11
|
1110 local fontSize = DF:GetFontSize (mainButton.leftText)
|
|
Tercio@11
|
1111
|
|
Tercio@11
|
1112 local GotChecked = false
|
|
Tercio@11
|
1113
|
|
Tercio@11
|
1114 local IsTooltip = CoolTip.OptionsTable.SubMenuIsTooltip
|
|
Tercio@11
|
1115 if (IsTooltip) then
|
|
Tercio@11
|
1116 frame2:EnableMouse (false)
|
|
Tercio@11
|
1117 else
|
|
Tercio@11
|
1118 frame2:EnableMouse (true)
|
|
Tercio@11
|
1119 end
|
|
Tercio@11
|
1120
|
|
Tercio@11
|
1121 for i = 1, CoolTip.IndexesSub [index] do
|
|
Tercio@11
|
1122
|
|
Tercio@11
|
1123 local button = frame2.Lines [i]
|
|
Tercio@11
|
1124
|
|
Tercio@11
|
1125 if (not button) then
|
|
Tercio@11
|
1126 button = CoolTip:NewSecondaryButton (i)
|
|
Tercio@11
|
1127 end
|
|
Tercio@11
|
1128
|
|
Tercio@11
|
1129 local checked = CoolTip:SetupSecondaryButton (button, i, index)
|
|
Tercio@11
|
1130 if (checked) then
|
|
Tercio@11
|
1131 GotChecked = true
|
|
Tercio@11
|
1132 end
|
|
Tercio@11
|
1133
|
|
Tercio@11
|
1134 if (IsTooltip) then
|
|
Tercio@11
|
1135 button:EnableMouse (false)
|
|
Tercio@11
|
1136 else
|
|
Tercio@11
|
1137 button:EnableMouse (true)
|
|
Tercio@11
|
1138 end
|
|
Tercio@11
|
1139 end
|
|
Tercio@11
|
1140
|
|
Tercio@11
|
1141 local selected = CoolTip.SelectedIndexSec [index]
|
|
Tercio@11
|
1142 if (selected) then
|
|
Tercio@11
|
1143
|
|
Tercio@11
|
1144 CoolTip:SetSelectedAnchor (frame2, frame2.Lines [selected])
|
|
Tercio@11
|
1145
|
|
Tercio@11
|
1146 if (not CoolTip.OptionsTable.NoLastSelectedBar) then
|
|
Tercio@11
|
1147 CoolTip:ShowSelectedTexture (frame2)
|
|
Tercio@11
|
1148 end
|
|
Tercio@11
|
1149 else
|
|
Tercio@11
|
1150 CoolTip:HideSelectedTexture (frame2)
|
|
Tercio@11
|
1151 end
|
|
Tercio@11
|
1152
|
|
Tercio@11
|
1153 for i = CoolTip.IndexesSub [index] + 1, #frame2.Lines do
|
|
Tercio@26
|
1154 DF:FadeFrame (frame2.Lines[i], 1)
|
|
Tercio@11
|
1155 end
|
|
Tercio@11
|
1156
|
|
Tercio@11
|
1157 local spacing = 0
|
|
Tercio@11
|
1158 if (CoolTip.OptionsTable.YSpacingModSub) then
|
|
Tercio@11
|
1159 spacing = CoolTip.OptionsTable.YSpacingModSub
|
|
Tercio@11
|
1160 end
|
|
Tercio@11
|
1161
|
|
Tercio@11
|
1162 --> normalize height of all rows
|
|
Tercio@11
|
1163 for i = 1, CoolTip.IndexesSub [index] do
|
|
Tercio@11
|
1164
|
|
Tercio@11
|
1165 local menuButton = frame2.Lines [i]
|
|
Tercio@11
|
1166
|
|
Tercio@11
|
1167 -- CoolTipFrame2.Lines [2].divbar
|
|
Tercio@11
|
1168
|
|
Tercio@11
|
1169 if (menuButton.leftText:GetText() == "$div") then
|
|
Tercio@11
|
1170
|
|
Tercio@11
|
1171 --> height
|
|
Tercio@11
|
1172 menuButton:SetHeight (4)
|
|
Tercio@11
|
1173
|
|
Tercio@11
|
1174 --> points
|
|
Tercio@11
|
1175 menuButton:ClearAllPoints()
|
|
Tercio@11
|
1176
|
|
Tercio@11
|
1177 menuButton:SetPoint ("center", frame2, "center")
|
|
Tercio@40
|
1178 menuButton:SetPoint ("left", frame2, "left", -4, 0)
|
|
Tercio@40
|
1179 menuButton:SetPoint ("right", frame2, "right", 4, 0)
|
|
Tercio@11
|
1180
|
|
Tercio@11
|
1181 menuButton.rightText:SetText ("")
|
|
Tercio@11
|
1182
|
|
Tercio@11
|
1183 local div_size_up = tonumber (CoolTip.RightTextTableSub [index] [i] [2])
|
|
Tercio@11
|
1184 if (not div_size_up) then
|
|
Tercio@11
|
1185 div_size_up = 0
|
|
Tercio@11
|
1186 end
|
|
Tercio@11
|
1187 local div_size_down = tonumber (CoolTip.RightTextTableSub [index] [i] [3])
|
|
Tercio@11
|
1188 if (not div_size_down) then
|
|
Tercio@11
|
1189 div_size_down = 0
|
|
Tercio@11
|
1190 end
|
|
Tercio@11
|
1191
|
|
Tercio@11
|
1192 menuButton:SetPoint ("top", frame2, "top", 0, ( ( (i-1) * frame2.hHeight) * -1) - 4 + (CoolTip.OptionsTable.ButtonsYModSub or 0) + spacing + (2 + (div_size_up or 0)))
|
|
Tercio@11
|
1193
|
|
Tercio@11
|
1194 if (CoolTip.OptionsTable.YSpacingModSub) then
|
|
Tercio@11
|
1195 spacing = spacing + CoolTip.OptionsTable.YSpacingModSub
|
|
Tercio@11
|
1196 end
|
|
Tercio@11
|
1197
|
|
Tercio@11
|
1198 spacing = spacing + 17 + (div_size_down or 0)
|
|
Tercio@11
|
1199
|
|
Tercio@11
|
1200 menuButton.leftText:SetText ("")
|
|
Tercio@11
|
1201 menuButton.isDiv = true
|
|
Tercio@11
|
1202
|
|
Tercio@11
|
1203 if (not menuButton.divbar) then
|
|
Tercio@11
|
1204 CoolTip:CreateDivBar (menuButton)
|
|
Tercio@11
|
1205 else
|
|
Tercio@11
|
1206 menuButton.divbar:Show()
|
|
Tercio@11
|
1207 end
|
|
Tercio@11
|
1208
|
|
Tercio@11
|
1209 menuButton.divbar:SetPoint ("left", menuButton, "left", frame1:GetWidth()*0.10, 0)
|
|
Tercio@11
|
1210 menuButton.divbar:SetPoint ("right", menuButton, "right", -frame1:GetWidth()*0.10, 0)
|
|
Tercio@11
|
1211
|
|
Tercio@11
|
1212 else
|
|
Tercio@11
|
1213 --> height
|
|
Tercio@11
|
1214 menuButton:SetHeight (frame2.hHeight + (CoolTip.OptionsTable.ButtonHeightModSub or 0))
|
|
Tercio@11
|
1215 --> points
|
|
Tercio@11
|
1216 menuButton:ClearAllPoints()
|
|
Tercio@11
|
1217 menuButton:SetPoint ("center", frame2, "center")
|
|
Tercio@11
|
1218 menuButton:SetPoint ("top", frame2, "top", 0, ( ( (i-1) * frame2.hHeight) * -1) - 4 + (CoolTip.OptionsTable.ButtonsYModSub or 0) + spacing)
|
|
Tercio@11
|
1219 if (CoolTip.OptionsTable.YSpacingModSub) then
|
|
Tercio@11
|
1220 spacing = spacing + CoolTip.OptionsTable.YSpacingModSub
|
|
Tercio@11
|
1221 end
|
|
Tercio@40
|
1222 menuButton:SetPoint ("left", frame2, "left", -4, 0)
|
|
Tercio@40
|
1223 menuButton:SetPoint ("right", frame2, "right", 4, 0)
|
|
Tercio@11
|
1224
|
|
Tercio@11
|
1225 if (menuButton.divbar) then
|
|
Tercio@11
|
1226 menuButton.divbar:Hide()
|
|
Tercio@11
|
1227 menuButton.isDiv = false
|
|
Tercio@11
|
1228 end
|
|
Tercio@11
|
1229 end
|
|
Tercio@11
|
1230
|
|
Tercio@11
|
1231 end
|
|
Tercio@11
|
1232
|
|
Tercio@11
|
1233 local mod = CoolTip.OptionsTable.HeighModSub or 0
|
|
Tercio@11
|
1234 frame2:SetHeight ( (frame2.hHeight * CoolTip.IndexesSub [index]) + 12 + (-spacing) + mod)
|
|
Tercio@11
|
1235
|
|
Tercio@11
|
1236 if (CoolTip.TopIconTableSub [index]) then
|
|
Tercio@11
|
1237 local upperImageTable = CoolTip.TopIconTableSub [index]
|
|
Tercio@11
|
1238 frame2.upperImage:SetTexture (upperImageTable [1])
|
|
Tercio@11
|
1239 frame2.upperImage:SetWidth (upperImageTable [2])
|
|
Tercio@11
|
1240 frame2.upperImage:SetHeight (upperImageTable [3])
|
|
Tercio@11
|
1241 frame2.upperImage:SetTexCoord (upperImageTable[4], upperImageTable[5], upperImageTable[6], upperImageTable[7])
|
|
Tercio@11
|
1242 frame2.upperImage:Show()
|
|
Tercio@11
|
1243 else
|
|
Tercio@11
|
1244 frame2.upperImage:Hide()
|
|
Tercio@11
|
1245 end
|
|
Tercio@11
|
1246
|
|
Tercio@11
|
1247 if (CoolTip.WallpaperTableSub [index]) then
|
|
Tercio@11
|
1248 CoolTip:SetupWallpaper (CoolTip.WallpaperTableSub [index], frame2.frameWallpaper)
|
|
Tercio@11
|
1249 else
|
|
Tercio@11
|
1250 frame2.frameWallpaper:Hide()
|
|
Tercio@11
|
1251 end
|
|
Tercio@11
|
1252
|
|
Tercio@11
|
1253 if (not CoolTip.OptionsTable.FixedWidthSub) then
|
|
Tercio@11
|
1254 frame2:SetWidth (frame2.w + 44)
|
|
Tercio@11
|
1255 end
|
|
Tercio@11
|
1256
|
|
Tercio@26
|
1257 DF:FadeFrame (frame2, 0)
|
|
Tercio@11
|
1258
|
|
Tercio@11
|
1259 CoolTip:CheckOverlap()
|
|
Tercio@11
|
1260
|
|
Tercio@11
|
1261 if (CoolTip.OptionsTable.SubFollowButton and not CoolTip.frame2_leftside) then
|
|
Tercio@11
|
1262
|
|
Tercio@11
|
1263 local button = frame1.Lines [index]
|
|
Tercio@11
|
1264
|
|
Tercio@11
|
1265 frame2:ClearAllPoints()
|
|
Tercio@40
|
1266 frame2:SetPoint ("left", button, "right", 4, 0)
|
|
Tercio@11
|
1267
|
|
Tercio@11
|
1268 elseif (CoolTip.OptionsTable.SubFollowButton and CoolTip.frame2_leftside) then
|
|
Tercio@11
|
1269
|
|
Tercio@11
|
1270 local button = frame1.Lines [index]
|
|
Tercio@11
|
1271
|
|
Tercio@11
|
1272 frame2:ClearAllPoints()
|
|
Tercio@40
|
1273 frame2:SetPoint ("right", button, "left", -4, 0)
|
|
Tercio@11
|
1274
|
|
Tercio@11
|
1275 elseif (CoolTip.frame2_leftside) then
|
|
Tercio@11
|
1276 frame2:ClearAllPoints()
|
|
Tercio@40
|
1277 frame2:SetPoint ("bottomright", frame1, "bottomleft", -4, 0)
|
|
Tercio@11
|
1278 else
|
|
Tercio@11
|
1279 frame2:ClearAllPoints()
|
|
Tercio@40
|
1280 frame2:SetPoint ("bottomleft", frame1, "bottomright", 4, 0)
|
|
Tercio@11
|
1281 end
|
|
Tercio@11
|
1282
|
|
Tercio@11
|
1283 end
|
|
Tercio@11
|
1284
|
|
Tercio@11
|
1285 function CoolTip:HideSub()
|
|
Tercio@26
|
1286 DF:FadeFrame (frame2, 1)
|
|
Tercio@11
|
1287 end
|
|
Tercio@11
|
1288
|
|
Tercio@11
|
1289
|
|
Tercio@11
|
1290 function CoolTip:LeftTextSpace (row)
|
|
Tercio@11
|
1291 row.leftText:SetWidth (row:GetWidth() - 30 - row.leftIcon:GetWidth() - row.rightIcon:GetWidth() - row.rightText:GetStringWidth())
|
|
Tercio@11
|
1292 row.leftText:SetHeight (10)
|
|
Tercio@11
|
1293 end
|
|
Tercio@11
|
1294
|
|
Tercio@26
|
1295 --> ~inicio ~start ~tooltip
|
|
Tercio@11
|
1296 function CoolTip:monta_tooltip()
|
|
Tercio@11
|
1297
|
|
Tercio@11
|
1298 --> hide sub frame
|
|
Tercio@26
|
1299 DF:FadeFrame (frame2, 1)
|
|
Tercio@11
|
1300 --> hide select bar
|
|
Tercio@11
|
1301 CoolTip:HideSelectedTexture (frame1)
|
|
Tercio@11
|
1302
|
|
Tercio@11
|
1303 frame1:EnableMouse (false)
|
|
Tercio@11
|
1304
|
|
Tercio@11
|
1305 --> elevator
|
|
Tercio@11
|
1306 local yDown = 5
|
|
Tercio@11
|
1307 --> width
|
|
Tercio@11
|
1308 if (CoolTip.OptionsTable.FixedWidth) then
|
|
Tercio@11
|
1309 frame1:SetWidth (CoolTip.OptionsTable.FixedWidth)
|
|
Tercio@11
|
1310 end
|
|
Tercio@11
|
1311
|
|
Tercio@11
|
1312 frame1.w = CoolTip.OptionsTable.FixedWidth or 0
|
|
Tercio@11
|
1313 frame1.hHeight = 0
|
|
Tercio@11
|
1314 frame2.hHeight = 0
|
|
Tercio@11
|
1315
|
|
Tercio@11
|
1316 CoolTip.active = true
|
|
Tercio@11
|
1317
|
|
Tercio@11
|
1318 for i = 1, CoolTip.Indexes do
|
|
Tercio@11
|
1319
|
|
Tercio@11
|
1320 local button = frame1.Lines [i]
|
|
Tercio@11
|
1321 if (not button) then
|
|
Tercio@11
|
1322 button = CoolTip:NewMainButton (i)
|
|
Tercio@11
|
1323 end
|
|
Tercio@11
|
1324
|
|
Tercio@11
|
1325 button.index = i
|
|
Tercio@11
|
1326
|
|
Tercio@11
|
1327 --> basic stuff
|
|
Tercio@11
|
1328 button:Show()
|
|
Tercio@11
|
1329 button.background:Hide()
|
|
Tercio@11
|
1330 button:SetHeight (CoolTip.OptionsTable.ButtonHeightMod or CoolTip.default_height)
|
|
Tercio@11
|
1331 button:RegisterForClicks()
|
|
Tercio@11
|
1332
|
|
Tercio@11
|
1333 --> setup texts and icons
|
|
Tercio@11
|
1334 CoolTip:TextAndIcon (i, frame1, button, CoolTip.LeftTextTable [i], CoolTip.RightTextTable [i], CoolTip.LeftIconTable [i], CoolTip.RightIconTable [i])
|
|
Tercio@11
|
1335 --> setup statusbar
|
|
Tercio@11
|
1336 CoolTip:StatusBar (button, CoolTip.StatusBarTable [i])
|
|
Tercio@11
|
1337 end
|
|
Tercio@11
|
1338
|
|
Tercio@11
|
1339 --> hide unused lines
|
|
Tercio@11
|
1340 for i = CoolTip.Indexes+1, #frame1.Lines do
|
|
Tercio@11
|
1341 frame1.Lines[i]:Hide()
|
|
Tercio@11
|
1342 end
|
|
Tercio@11
|
1343 CoolTip.NumLines = CoolTip.Indexes
|
|
Tercio@11
|
1344
|
|
Tercio@11
|
1345 local spacing = 0
|
|
Tercio@11
|
1346 if (CoolTip.OptionsTable.YSpacingMod) then
|
|
Tercio@11
|
1347 spacing = CoolTip.OptionsTable.YSpacingMod
|
|
Tercio@11
|
1348 end
|
|
Tercio@11
|
1349
|
|
Tercio@11
|
1350 --> normalize height of all rows
|
|
Tercio@11
|
1351 local temp = -6 + spacing + (CoolTip.OptionsTable.ButtonsYMod or 0)
|
|
Tercio@11
|
1352 for i = 1, CoolTip.Indexes do
|
|
Tercio@11
|
1353 local menuButton = frame1.Lines [i]
|
|
Tercio@11
|
1354
|
|
Tercio@11
|
1355 menuButton:ClearAllPoints()
|
|
Tercio@11
|
1356 menuButton:SetPoint ("center", frame1, "center")
|
|
Tercio@40
|
1357 menuButton:SetPoint ("left", frame1, "left", -4, 0)
|
|
Tercio@40
|
1358 menuButton:SetPoint ("right", frame1, "right", 4, 0)
|
|
Tercio@11
|
1359
|
|
Tercio@11
|
1360 --> height
|
|
Tercio@11
|
1361 if (CoolTip.OptionsTable.AlignAsBlizzTooltip) then
|
|
Tercio@11
|
1362 local height = _math_max (8, menuButton.leftText:GetStringHeight(), menuButton.rightText:GetStringHeight(), menuButton.leftIcon:GetHeight(), menuButton.rightIcon:GetHeight())
|
|
Tercio@11
|
1363 menuButton:SetHeight (height)
|
|
Tercio@11
|
1364 menuButton:SetPoint ("top", frame1, "top", 0, temp)
|
|
Tercio@11
|
1365 temp = temp + ( height * -1)
|
|
Tercio@11
|
1366
|
|
Tercio@11
|
1367 elseif (CoolTip.OptionsTable.IgnoreButtonAutoHeight) then
|
|
Tercio@11
|
1368
|
|
Tercio@11
|
1369 local height = _math_max (menuButton.leftText:GetStringHeight(), menuButton.rightText:GetStringHeight(), menuButton.leftIcon:GetHeight(), menuButton.rightIcon:GetHeight())
|
|
Tercio@11
|
1370 menuButton:SetHeight (height)
|
|
Tercio@11
|
1371 menuButton:SetPoint ("top", frame1, "top", 0, temp)
|
|
Tercio@11
|
1372
|
|
Tercio@11
|
1373 temp = temp + ( height * -1) + spacing + (CoolTip.OptionsTable.ButtonsYMod or 0)
|
|
Tercio@11
|
1374
|
|
Tercio@11
|
1375 else
|
|
Tercio@11
|
1376 menuButton:SetHeight (frame1.hHeight + (CoolTip.OptionsTable.ButtonHeightMod or 0))
|
|
Tercio@11
|
1377 menuButton:SetPoint ("top", frame1, "top", 0, ( ( (i-1) * frame1.hHeight) * -1) - 6 + (CoolTip.OptionsTable.ButtonsYMod or 0) + spacing)
|
|
Tercio@11
|
1378 end
|
|
Tercio@11
|
1379
|
|
Tercio@11
|
1380 --> points
|
|
Tercio@11
|
1381
|
|
Tercio@11
|
1382 if (CoolTip.OptionsTable.YSpacingMod and not CoolTip.OptionsTable.IgnoreButtonAutoHeight) then
|
|
Tercio@11
|
1383 spacing = spacing + CoolTip.OptionsTable.YSpacingMod
|
|
Tercio@11
|
1384 end
|
|
Tercio@11
|
1385
|
|
Tercio@11
|
1386 menuButton:EnableMouse (false)
|
|
Tercio@11
|
1387 end
|
|
Tercio@11
|
1388
|
|
Tercio@11
|
1389 if (not CoolTip.OptionsTable.FixedWidth) then
|
|
Tercio@11
|
1390 if (CoolTip.Type == 2) then --> with bars
|
|
Tercio@11
|
1391 if (CoolTip.OptionsTable.MinWidth) then
|
|
Tercio@11
|
1392 local w = frame1.w + 34
|
|
Tercio@11
|
1393 frame1:SetWidth (math.max (w, CoolTip.OptionsTable.MinWidth))
|
|
Tercio@11
|
1394 else
|
|
Tercio@11
|
1395 frame1:SetWidth (frame1.w + 34)
|
|
Tercio@11
|
1396 end
|
|
Tercio@11
|
1397 else
|
|
Tercio@11
|
1398 --> width stability check
|
|
Tercio@11
|
1399 local width = frame1.w + 24
|
|
Tercio@11
|
1400 if (width > CoolTip.LastSize-5 and width < CoolTip.LastSize+5) then
|
|
Tercio@11
|
1401 width = CoolTip.LastSize
|
|
Tercio@11
|
1402 else
|
|
Tercio@11
|
1403 CoolTip.LastSize = width
|
|
Tercio@11
|
1404 end
|
|
Tercio@11
|
1405
|
|
Tercio@11
|
1406 if (CoolTip.OptionsTable.MinWidth) then
|
|
Tercio@11
|
1407 frame1:SetWidth (math.max (width, CoolTip.OptionsTable.MinWidth))
|
|
Tercio@11
|
1408 else
|
|
Tercio@11
|
1409 frame1:SetWidth (width)
|
|
Tercio@11
|
1410 end
|
|
Tercio@11
|
1411 end
|
|
Tercio@11
|
1412 end
|
|
Tercio@11
|
1413
|
|
Tercio@11
|
1414 if (CoolTip.OptionsTable.FixedHeight) then
|
|
Tercio@11
|
1415 frame1:SetHeight (CoolTip.OptionsTable.FixedHeight)
|
|
Tercio@11
|
1416 else
|
|
Tercio@11
|
1417 if (CoolTip.OptionsTable.AlignAsBlizzTooltip) then
|
|
Tercio@11
|
1418 frame1:SetHeight ( (temp-10) * -1)
|
|
Tercio@11
|
1419 elseif (CoolTip.OptionsTable.IgnoreButtonAutoHeight) then
|
|
Tercio@11
|
1420 frame1:SetHeight ( (temp+spacing) * -1)
|
|
Tercio@11
|
1421 else
|
|
Tercioo@29
|
1422 frame1:SetHeight ( _math_max ( (frame1.hHeight * CoolTip.Indexes) + 8 + ((CoolTip.OptionsTable.ButtonsYMod or 0)*-1), 22 ))
|
|
Tercio@11
|
1423 end
|
|
Tercio@11
|
1424 end
|
|
Tercio@11
|
1425
|
|
Tercio@11
|
1426 if (CoolTip.WallpaperTable [1]) then
|
|
Tercio@11
|
1427 CoolTip:SetupWallpaper (CoolTip.WallpaperTable, frame1.frameWallpaper)
|
|
Tercio@11
|
1428 else
|
|
Tercio@11
|
1429 frame1.frameWallpaper:Hide()
|
|
Tercio@11
|
1430 end
|
|
Tercio@11
|
1431
|
|
Tercio@11
|
1432 --> unhide frame
|
|
Tercio@26
|
1433 DF:FadeFrame (frame1, 0)
|
|
Tercio@11
|
1434 CoolTip:SetMyPoint (host)
|
|
Tercio@11
|
1435
|
|
Tercio@11
|
1436 --> fix sparks
|
|
Tercio@11
|
1437 for i = 1, CoolTip.Indexes do
|
|
Tercio@11
|
1438 local menuButton = frame1.Lines [i]
|
|
Tercio@11
|
1439 if (menuButton.spark:IsShown() or menuButton.spark2:IsShown()) then
|
|
Tercio@11
|
1440 CoolTip:RefreshSpark (menuButton)
|
|
Tercio@11
|
1441 end
|
|
Tercio@11
|
1442 end
|
|
Tercio@11
|
1443 end
|
|
Tercio@11
|
1444
|
|
Tercio@11
|
1445 function CoolTip:CreateDivBar (button)
|
|
Tercio@11
|
1446 button.divbar = button:CreateTexture (nil, "overlay")
|
|
Tercio@11
|
1447
|
|
Tercio@11
|
1448 button.divbar:SetTexture ([[Interface\QUESTFRAME\AutoQuest-Parts]])
|
|
Tercio@11
|
1449 button.divbar:SetTexCoord (238/512, 445/512, 0/64, 4/64)
|
|
Tercio@11
|
1450
|
|
Tercio@11
|
1451 button.divbar:SetHeight (3)
|
|
Tercio@11
|
1452 button.divbar:SetAlpha (0.1)
|
|
Tercio@11
|
1453
|
|
Tercio@11
|
1454 button.divbar:SetDesaturated (true)
|
|
Tercio@11
|
1455 end
|
|
Tercio@11
|
1456
|
|
Tercio@26
|
1457 --> ~inicio ~start ~menu
|
|
Tercio@11
|
1458 function CoolTip:monta_cooltip (host, instancia, options, sub_menus, icones, tamanho1, tamanho2, font, fontsize)
|
|
Tercio@11
|
1459
|
|
Tercio@11
|
1460 if (CoolTip.Indexes == 0) then
|
|
Tercio@11
|
1461 CoolTip:Reset()
|
|
Tercio@11
|
1462 CoolTip:SetType ("tooltip")
|
|
Tercio@11
|
1463 CoolTip:AddLine ("There is no options.")
|
|
Tercio@11
|
1464 CoolTip:ShowCooltip()
|
|
Tercio@11
|
1465 return
|
|
Tercio@11
|
1466 end
|
|
Tercio@11
|
1467
|
|
Tercio@11
|
1468 if (CoolTip.OptionsTable.FixedWidth) then
|
|
Tercio@11
|
1469 frame1:SetWidth (CoolTip.OptionsTable.FixedWidth)
|
|
Tercio@11
|
1470 end
|
|
Tercio@11
|
1471
|
|
Tercio@11
|
1472 frame1.w = CoolTip.OptionsTable.FixedWidth or 0
|
|
Tercio@11
|
1473 frame1.hHeight = 0
|
|
Tercio@11
|
1474 frame2.hHeight = 0
|
|
Tercio@11
|
1475
|
|
Tercio@11
|
1476 frame1:EnableMouse (true)
|
|
Tercio@11
|
1477
|
|
Tercio@11
|
1478 if (CoolTip.HaveSubMenu) then --> zera o segundo frame
|
|
Tercio@11
|
1479 frame2.w = 0
|
|
Tercio@11
|
1480 frame2:SetHeight (6)
|
|
Tercio@11
|
1481 if (CoolTip.SelectedIndexMain and CoolTip.IndexesSub [CoolTip.SelectedIndexMain] and CoolTip.IndexesSub [CoolTip.SelectedIndexMain] > 0) then
|
|
Tercio@26
|
1482 DF:FadeFrame (frame2, 0)
|
|
Tercio@11
|
1483 else
|
|
Tercio@26
|
1484 DF:FadeFrame (frame2, 1)
|
|
Tercio@11
|
1485 end
|
|
Tercio@11
|
1486 else
|
|
Tercio@26
|
1487 DF:FadeFrame (frame2, 1)
|
|
Tercio@11
|
1488 end
|
|
Tercio@11
|
1489
|
|
Tercio@11
|
1490 CoolTip.active = true
|
|
Tercio@11
|
1491
|
|
Tercio@11
|
1492 for i = 1, CoolTip.Indexes do
|
|
Tercio@11
|
1493 local menuButton = frame1.Lines [i]
|
|
Tercio@11
|
1494 if (not menuButton) then
|
|
Tercio@11
|
1495 menuButton = CoolTip:NewMainButton (i)
|
|
Tercio@11
|
1496 end
|
|
Tercio@11
|
1497
|
|
Tercio@11
|
1498 CoolTip:SetupMainButton (menuButton, i)
|
|
Tercio@11
|
1499
|
|
Tercio@11
|
1500 menuButton.background:Hide()
|
|
Tercio@11
|
1501 end
|
|
Tercio@11
|
1502
|
|
Tercio@11
|
1503 --> selected texture
|
|
Tercio@11
|
1504 if (CoolTip.SelectedIndexMain) then
|
|
Tercio@11
|
1505 CoolTip:SetSelectedAnchor (frame1, frame1.Lines [CoolTip.SelectedIndexMain])
|
|
Tercio@11
|
1506
|
|
Tercio@11
|
1507 if (CoolTip.OptionsTable.NoLastSelectedBar) then
|
|
Tercio@11
|
1508 CoolTip:HideSelectedTexture (frame1)
|
|
Tercio@11
|
1509 else
|
|
Tercio@11
|
1510 CoolTip:ShowSelectedTexture (frame1)
|
|
Tercio@11
|
1511 end
|
|
Tercio@11
|
1512 else
|
|
Tercio@11
|
1513 CoolTip:HideSelectedTexture (frame1)
|
|
Tercio@11
|
1514 end
|
|
Tercio@11
|
1515
|
|
Tercio@11
|
1516 if (CoolTip.Indexes < #frame1.Lines) then
|
|
Tercio@11
|
1517 for i = CoolTip.Indexes+1, #frame1.Lines do
|
|
Tercio@11
|
1518 frame1.Lines[i]:Hide()
|
|
Tercio@11
|
1519 end
|
|
Tercio@11
|
1520 end
|
|
Tercio@11
|
1521
|
|
Tercio@11
|
1522 CoolTip.NumLines = CoolTip.Indexes
|
|
Tercio@11
|
1523
|
|
Tercio@11
|
1524 local spacing = 0
|
|
Tercio@11
|
1525 if (CoolTip.OptionsTable.YSpacingMod) then
|
|
Tercio@11
|
1526 spacing = CoolTip.OptionsTable.YSpacingMod
|
|
Tercio@11
|
1527 end
|
|
Tercio@11
|
1528
|
|
Tercio@11
|
1529 if (not CoolTip.OptionsTable.FixedWidth) then
|
|
Tercio@11
|
1530 if (CoolTip.OptionsTable.MinWidth) then
|
|
Tercio@11
|
1531 local w = frame1.w + 24
|
|
Tercio@11
|
1532 frame1:SetWidth (math.max (w, CoolTip.OptionsTable.MinWidth))
|
|
Tercio@11
|
1533 else
|
|
Tercio@11
|
1534 frame1:SetWidth (frame1.w + 24)
|
|
Tercio@11
|
1535 end
|
|
Tercio@11
|
1536 end
|
|
Tercio@11
|
1537
|
|
Tercio@11
|
1538 --> normalize height of all rows
|
|
Tercio@11
|
1539 for i = 1, CoolTip.Indexes do
|
|
Tercio@11
|
1540 local menuButton = frame1.Lines [i]
|
|
Tercio@11
|
1541 menuButton:EnableMouse (true)
|
|
Tercio@11
|
1542
|
|
Tercio@11
|
1543 if (menuButton.leftText:GetText() == "$div") then
|
|
Tercio@11
|
1544
|
|
Tercio@11
|
1545 --> height
|
|
Tercio@11
|
1546 menuButton:SetHeight (4)
|
|
Tercio@11
|
1547 --> points
|
|
Tercio@11
|
1548 menuButton:ClearAllPoints()
|
|
Tercio@40
|
1549 menuButton:SetPoint ("left", frame1, "left", -4, 0)
|
|
Tercio@40
|
1550 menuButton:SetPoint ("right", frame1, "right", 4, 0)
|
|
Tercio@11
|
1551 menuButton:SetPoint ("center", frame1, "center")
|
|
Tercio@11
|
1552
|
|
Tercio@11
|
1553 local div_size_up = tonumber (CoolTip.LeftTextTable [i] [2])
|
|
Tercio@11
|
1554 if (not div_size_up) then
|
|
Tercio@11
|
1555 div_size_up = 0
|
|
Tercio@11
|
1556 end
|
|
Tercio@11
|
1557 local div_size_down = tonumber (CoolTip.LeftTextTable [i] [3])
|
|
Tercio@11
|
1558 if (not div_size_down) then
|
|
Tercio@11
|
1559 div_size_down = 0
|
|
Tercio@11
|
1560 end
|
|
Tercio@11
|
1561
|
|
Tercio@11
|
1562 menuButton:SetPoint ("top", frame1, "top", 0, ( ( (i-1) * frame1.hHeight) * -1) - 4 + (CoolTip.OptionsTable.ButtonsYMod or 0) + spacing - 4 + div_size_up)
|
|
Tercio@11
|
1563 if (CoolTip.OptionsTable.YSpacingMod) then
|
|
Tercio@11
|
1564 spacing = spacing + CoolTip.OptionsTable.YSpacingMod
|
|
Tercio@11
|
1565 end
|
|
Tercio@11
|
1566
|
|
Tercio@11
|
1567 spacing = spacing + 4 + div_size_down
|
|
Tercio@11
|
1568
|
|
Tercio@11
|
1569 menuButton.leftText:SetText ("")
|
|
Tercio@11
|
1570 menuButton.isDiv = true
|
|
Tercio@11
|
1571
|
|
Tercio@11
|
1572 if (not menuButton.divbar) then
|
|
Tercio@11
|
1573 CoolTip:CreateDivBar (menuButton)
|
|
Tercio@11
|
1574 else
|
|
Tercio@11
|
1575 menuButton.divbar:Show()
|
|
Tercio@11
|
1576 end
|
|
Tercio@11
|
1577
|
|
Tercio@11
|
1578 menuButton.divbar:SetPoint ("left", menuButton, "left", frame1:GetWidth()*0.10, 0)
|
|
Tercio@11
|
1579 menuButton.divbar:SetPoint ("right", menuButton, "right", -frame1:GetWidth()*0.10, 0)
|
|
Tercio@11
|
1580
|
|
Tercio@11
|
1581 else
|
|
Tercio@11
|
1582
|
|
Tercio@11
|
1583 --> height
|
|
Tercio@11
|
1584 menuButton:SetHeight (frame1.hHeight + (CoolTip.OptionsTable.ButtonHeightMod or 0))
|
|
Tercio@11
|
1585 --> points
|
|
Tercio@11
|
1586 menuButton:ClearAllPoints()
|
|
Tercio@11
|
1587 menuButton:SetPoint ("center", frame1, "center")
|
|
Tercio@11
|
1588 menuButton:SetPoint ("top", frame1, "top", 0, ( ( (i-1) * frame1.hHeight) * -1) - 4 + (CoolTip.OptionsTable.ButtonsYMod or 0) + spacing)
|
|
Tercio@11
|
1589 if (CoolTip.OptionsTable.YSpacingMod) then
|
|
Tercio@11
|
1590 spacing = spacing + CoolTip.OptionsTable.YSpacingMod
|
|
Tercio@11
|
1591 end
|
|
Tercio@40
|
1592 menuButton:SetPoint ("left", frame1, "left", -4, 0)
|
|
Tercio@40
|
1593 menuButton:SetPoint ("right", frame1, "right", 4, 0)
|
|
Tercio@11
|
1594
|
|
Tercio@11
|
1595 if (menuButton.divbar) then
|
|
Tercio@11
|
1596 menuButton.divbar:Hide()
|
|
Tercio@11
|
1597 menuButton.isDiv = false
|
|
Tercio@11
|
1598 end
|
|
Tercio@11
|
1599 end
|
|
Tercio@11
|
1600
|
|
Tercio@11
|
1601 end
|
|
Tercio@11
|
1602
|
|
Tercio@11
|
1603 if (CoolTip.OptionsTable.FixedHeight) then
|
|
Tercio@11
|
1604 frame1:SetHeight (CoolTip.OptionsTable.FixedHeight)
|
|
Tercio@11
|
1605 else
|
|
Tercio@11
|
1606 local mod = CoolTip.OptionsTable.HeighMod or 0
|
|
Tercio@11
|
1607 frame1:SetHeight (_math_max ( (frame1.hHeight * CoolTip.Indexes) + 12 + (-spacing) + mod, 22 ))
|
|
Tercio@11
|
1608 end
|
|
Tercio@11
|
1609
|
|
Tercio@11
|
1610 --> sub menu arrows
|
|
Tercio@11
|
1611 if (CoolTip.HaveSubMenu and not CoolTip.OptionsTable.IgnoreArrows and not CoolTip.OptionsTable.SubMenuIsTooltip) then
|
|
Tercio@11
|
1612 for i = 1, CoolTip.Indexes do
|
|
Tercio@11
|
1613 if (CoolTip.IndexesSub [i] and CoolTip.IndexesSub [i] > 0) then
|
|
Tercio@11
|
1614 frame1.Lines [i].statusbar.subMenuArrow:Show()
|
|
Tercio@11
|
1615 else
|
|
Tercio@11
|
1616 frame1.Lines [i].statusbar.subMenuArrow:Hide()
|
|
Tercio@11
|
1617 end
|
|
Tercio@11
|
1618 end
|
|
Tercio@11
|
1619
|
|
Tercio@11
|
1620 frame1:SetWidth (frame1:GetWidth() + 16)
|
|
Tercio@11
|
1621 end
|
|
Tercio@11
|
1622
|
|
Tercio@11
|
1623 frame1:ClearAllPoints()
|
|
Tercio@11
|
1624 CoolTip:SetMyPoint (host)
|
|
Tercio@11
|
1625
|
|
Tercio@11
|
1626 if (CoolTip.title1) then
|
|
Tercio@11
|
1627 CoolTip.frame1.titleText:Show()
|
|
Tercio@11
|
1628 CoolTip.frame1.titleIcon:Show()
|
|
Tercio@11
|
1629 CoolTip.frame1.titleText:SetText (CoolTip.title_text)
|
|
Tercio@11
|
1630 CoolTip.frame1.titleIcon:SetWidth (frame1:GetWidth())
|
|
Tercio@11
|
1631 CoolTip.frame1.titleIcon:SetHeight (40)
|
|
Tercio@11
|
1632 end
|
|
Tercio@11
|
1633
|
|
Tercio@11
|
1634 if (CoolTip.WallpaperTable [1]) then
|
|
Tercio@11
|
1635 CoolTip:SetupWallpaper (CoolTip.WallpaperTable, frame1.frameWallpaper)
|
|
Tercio@11
|
1636 else
|
|
Tercio@11
|
1637 frame1.frameWallpaper:Hide()
|
|
Tercio@11
|
1638 end
|
|
Tercio@11
|
1639
|
|
Tercio@26
|
1640 DF:FadeFrame (frame1, 0)
|
|
Tercio@11
|
1641
|
|
Tercio@11
|
1642 for i = 1, CoolTip.Indexes do
|
|
Tercio@11
|
1643 if (CoolTip.SelectedIndexMain and CoolTip.SelectedIndexMain == i) then
|
|
Tercio@11
|
1644 if (CoolTip.HaveSubMenu and CoolTip.IndexesSub [i] and CoolTip.IndexesSub [i] > 0) then
|
|
Tercio@11
|
1645 CoolTip:ShowSub (i)
|
|
Tercio@11
|
1646 end
|
|
Tercio@11
|
1647 end
|
|
Tercio@11
|
1648 end
|
|
Tercio@11
|
1649
|
|
Tercio@11
|
1650 return true
|
|
Tercio@11
|
1651 end
|
|
Tercio@11
|
1652
|
|
Tercio@11
|
1653 function CoolTip:SetMyPoint (host, x_mod, y_mod)
|
|
Tercio@11
|
1654
|
|
Tercio@11
|
1655 local moveX = x_mod or 0
|
|
Tercio@11
|
1656 local moveY = y_mod or 0
|
|
Tercio@11
|
1657
|
|
Tercio@11
|
1658 --> clear all points
|
|
Tercio@11
|
1659 frame1:ClearAllPoints()
|
|
Tercio@11
|
1660
|
|
Tercio@11
|
1661 local anchor = CoolTip.OptionsTable.Anchor or CoolTip.Host
|
|
Tercio@11
|
1662 frame1:SetPoint (CoolTip.OptionsTable.MyAnchor, anchor, CoolTip.OptionsTable.RelativeAnchor, 0 + moveX + CoolTip.OptionsTable.WidthAnchorMod, 10 + CoolTip.OptionsTable.HeightAnchorMod + moveY)
|
|
Tercio@11
|
1663
|
|
Tercio@11
|
1664 if (not x_mod) then
|
|
Tercio@11
|
1665 --> check if cooltip is out of screen bounds
|
|
Tercio@11
|
1666 local center_x = frame1:GetCenter()
|
|
Tercio@11
|
1667
|
|
Tercio@11
|
1668 if (center_x) then
|
|
Tercio@11
|
1669 local screen_x_res = GetScreenWidth()
|
|
Tercio@11
|
1670 local half_x = frame1:GetWidth() / 2
|
|
Tercio@11
|
1671
|
|
Tercio@11
|
1672 if (center_x+half_x > screen_x_res) then
|
|
Tercio@11
|
1673 --> out of right side
|
|
Tercio@11
|
1674 local move_to_left = (center_x + half_x) - screen_x_res
|
|
Tercio@11
|
1675 CoolTip.internal_x_mod = -move_to_left
|
|
Tercio@11
|
1676 return CoolTip:SetMyPoint (host, -move_to_left, 0)
|
|
Tercio@11
|
1677
|
|
Tercio@11
|
1678 elseif (center_x-half_x < 0) then
|
|
Tercio@11
|
1679 --> out of left side
|
|
Tercio@11
|
1680 local move_to_right = center_x - half_x
|
|
Tercio@11
|
1681 CoolTip.internal_x_mod = move_to_right*-1
|
|
Tercio@11
|
1682 return CoolTip:SetMyPoint (host, move_to_right*-1, 0)
|
|
Tercio@11
|
1683 end
|
|
Tercio@11
|
1684 end
|
|
Tercio@11
|
1685 end
|
|
Tercio@11
|
1686
|
|
Tercio@11
|
1687 if (not y_mod) then
|
|
Tercio@11
|
1688 --> check if cooltip is out of screen bounds
|
|
Tercio@11
|
1689 local _, center_y = frame1:GetCenter()
|
|
Tercio@11
|
1690 local screen_y_res = GetScreenHeight()
|
|
Tercio@11
|
1691 local half_y = frame1:GetHeight() / 2
|
|
Tercio@11
|
1692
|
|
Tercio@11
|
1693 if (center_y) then
|
|
Tercio@11
|
1694 if (center_y+half_y > screen_y_res) then
|
|
Tercio@11
|
1695 --> out of top side
|
|
Tercio@11
|
1696 local move_to_down = (center_y + half_y) - screen_y_res
|
|
Tercio@11
|
1697 CoolTip.internal_y_mod = -move_to_down
|
|
Tercio@11
|
1698 return CoolTip:SetMyPoint (host, 0, -move_to_down)
|
|
Tercio@11
|
1699
|
|
Tercio@11
|
1700 elseif (center_y-half_y < 0) then
|
|
Tercio@11
|
1701 --> out of bottom side
|
|
Tercio@11
|
1702 local move_to_up = center_y - half_y
|
|
Tercio@11
|
1703 CoolTip.internal_y_mod = move_to_up*-1
|
|
Tercio@11
|
1704 return CoolTip:SetMyPoint (host, 0, move_to_up*-1)
|
|
Tercio@11
|
1705
|
|
Tercio@11
|
1706 end
|
|
Tercio@11
|
1707 end
|
|
Tercio@11
|
1708 end
|
|
Tercio@11
|
1709
|
|
Tercio@11
|
1710 if (frame2:IsShown() and not CoolTip.overlap_checked) then
|
|
Tercio@11
|
1711
|
|
Tercio@11
|
1712 local frame_2_center_x = frame2:GetCenter()
|
|
Tercio@11
|
1713 if (frame_2_center_x) then
|
|
Tercio@11
|
1714 local frame_2_half_x = frame2:GetWidth() / 2
|
|
Tercio@11
|
1715
|
|
Tercio@11
|
1716 local frame_1_center_x = frame1:GetCenter()
|
|
Tercio@11
|
1717 if (frame_1_center_x) then
|
|
Tercio@11
|
1718
|
|
Tercio@11
|
1719 local frame_1_half_x = frame1:GetWidth() / 2
|
|
Tercio@11
|
1720
|
|
Tercio@11
|
1721 local f1_end_point = frame_1_center_x + frame_1_half_x - 3
|
|
Tercio@11
|
1722 local f2_start_point = frame_2_center_x - frame_2_half_x
|
|
Tercio@11
|
1723
|
|
Tercio@11
|
1724 if (f2_start_point < f1_end_point) then
|
|
Tercio@11
|
1725 local diff = f2_start_point - f1_end_point
|
|
Tercio@11
|
1726 CoolTip.overlap_checked = true
|
|
Tercio@11
|
1727
|
|
Tercio@11
|
1728 frame2:ClearAllPoints()
|
|
Tercio@40
|
1729 frame2:SetPoint ("bottomright", frame1, "bottomleft", 4, 0)
|
|
Tercio@11
|
1730 CoolTip.frame2_leftside = true
|
|
Tercio@11
|
1731 --> diff
|
|
Tercio@11
|
1732 return CoolTip:SetMyPoint (host, CoolTip.internal_x_mod , CoolTip.internal_y_mod)
|
|
Tercio@11
|
1733 end
|
|
Tercio@11
|
1734
|
|
Tercio@11
|
1735 end
|
|
Tercio@11
|
1736 end
|
|
Tercio@11
|
1737
|
|
Tercio@11
|
1738 end
|
|
Tercio@11
|
1739
|
|
Tercio@11
|
1740 end
|
|
Tercio@11
|
1741
|
|
Tercio@11
|
1742 function CoolTip:CheckOverlap()
|
|
Tercio@11
|
1743 if (frame2:IsShown()) then
|
|
Tercio@11
|
1744
|
|
Tercio@11
|
1745 local frame_2_center_x = frame2:GetCenter()
|
|
Tercio@11
|
1746 if (frame_2_center_x) then
|
|
Tercio@11
|
1747 local frame_2_half_x = frame2:GetWidth() / 2
|
|
Tercio@11
|
1748
|
|
Tercio@11
|
1749 local frame_1_center_x = frame1:GetCenter()
|
|
Tercio@11
|
1750 if (frame_1_center_x) then
|
|
Tercio@11
|
1751
|
|
Tercio@11
|
1752 local frame_1_half_x = frame1:GetWidth() / 2
|
|
Tercio@11
|
1753
|
|
Tercio@11
|
1754 local f1_end_point = frame_1_center_x + frame_1_half_x - 3
|
|
Tercio@11
|
1755 local f2_start_point = frame_2_center_x - frame_2_half_x
|
|
Tercio@11
|
1756
|
|
Tercio@11
|
1757 if (f2_start_point < f1_end_point) then
|
|
Tercio@11
|
1758 local diff = f2_start_point - f1_end_point
|
|
Tercio@11
|
1759
|
|
Tercio@11
|
1760 frame2:ClearAllPoints()
|
|
Tercio@40
|
1761 frame2:SetPoint ("bottomright", frame1, "bottomleft", 4, 0)
|
|
Tercio@11
|
1762 CoolTip.frame2_leftside = true
|
|
Tercio@11
|
1763 end
|
|
Tercio@11
|
1764
|
|
Tercio@11
|
1765 end
|
|
Tercio@11
|
1766 end
|
|
Tercio@11
|
1767
|
|
Tercio@11
|
1768 end
|
|
Tercio@11
|
1769 end
|
|
Tercio@11
|
1770
|
|
Tercio@11
|
1771 function CoolTip:GetText (buttonIndex)
|
|
Tercio@11
|
1772 local button1 = frame1.Lines [buttonIndex]
|
|
Tercio@11
|
1773 if (not button1) then
|
|
Tercio@11
|
1774 return "", ""
|
|
Tercio@11
|
1775 else
|
|
Tercio@11
|
1776 return button1.leftText:GetText() or "", button1.rightText:GetText() or ""
|
|
Tercio@11
|
1777 end
|
|
Tercio@11
|
1778 end
|
|
Tercio@11
|
1779
|
|
Tercio@11
|
1780 ----------------------------------------------------------------------
|
|
Tercio@11
|
1781 --> Get the number of lines current shown on cooltip
|
|
Tercio@11
|
1782
|
|
Tercio@11
|
1783 function CoolTip:GetNumLines()
|
|
Tercio@11
|
1784 return CoolTip.NumLines or 0
|
|
Tercio@11
|
1785 end
|
|
Tercio@11
|
1786
|
|
Tercio@11
|
1787 ----------------------------------------------------------------------
|
|
Tercio@11
|
1788 --> Remove all options actived
|
|
Tercio@11
|
1789 --> Set a option on current cooltip
|
|
Tercio@11
|
1790
|
|
Tercio@11
|
1791 function CoolTip:ClearAllOptions()
|
|
Tercio@11
|
1792 for option, _ in pairs (CoolTip.OptionsTable) do
|
|
Tercio@11
|
1793 CoolTip.OptionsTable [option] = nil
|
|
Tercio@11
|
1794 end
|
|
Tercio@11
|
1795
|
|
Tercio@11
|
1796 CoolTip:SetOption ("MyAnchor", "bottom")
|
|
Tercio@11
|
1797 CoolTip:SetOption ("RelativeAnchor", "top")
|
|
Tercio@11
|
1798 CoolTip:SetOption ("WidthAnchorMod", 0)
|
|
Tercio@11
|
1799 CoolTip:SetOption ("HeightAnchorMod", 0)
|
|
Tercio@11
|
1800 end
|
|
Tercio@11
|
1801
|
|
Tercio@11
|
1802 function CoolTip:SetOption (option, value)
|
|
Tercio@11
|
1803 --> check if this options exists
|
|
Tercio@11
|
1804 if (not CoolTip.OptionsList [option]) then
|
|
Tercio@11
|
1805 return --> error
|
|
Tercio@11
|
1806 end
|
|
Tercio@11
|
1807
|
|
Tercio@11
|
1808 --> set options
|
|
Tercio@11
|
1809 CoolTip.OptionsTable [option] = value
|
|
Tercio@11
|
1810 end
|
|
Tercio@11
|
1811
|
|
Tercio@11
|
1812 ----------------------------------------------------------------------
|
|
Tercio@11
|
1813 --> set the anchor of cooltip
|
|
Tercio@11
|
1814 --> parameters: frame [, cooltip anchor point, frame anchor point [, x mod, y mod]]
|
|
Tercio@11
|
1815 --> frame [, x mod, y mod]
|
|
Tercio@11
|
1816
|
|
Tercio@11
|
1817 --> alias
|
|
Tercio@11
|
1818 function CoolTip:GetOwner()
|
|
Tercio@11
|
1819 return CoolTip.Host
|
|
Tercio@11
|
1820 end
|
|
Tercio@11
|
1821
|
|
Tercio@11
|
1822 function CoolTip:SetOwner (frame, myPoint, hisPoint, x, y)
|
|
Tercio@11
|
1823 return CoolTip:SetHost (frame, myPoint, hisPoint, x, y)
|
|
Tercio@11
|
1824 end
|
|
Tercio@11
|
1825
|
|
Tercio@11
|
1826 function CoolTip:SetHost (frame, myPoint, hisPoint, x, y)
|
|
Tercio@11
|
1827 --> check data integrity
|
|
Tercio@11
|
1828 if (type (frame) ~= "table" or not frame.GetObjectType) then
|
|
Tercio@11
|
1829 print ("host need to be a frame")
|
|
Tercio@11
|
1830 return --> error
|
|
Tercio@11
|
1831 end
|
|
Tercio@11
|
1832
|
|
Tercio@11
|
1833 CoolTip.Host = frame
|
|
Tercio@11
|
1834
|
|
Tercio@11
|
1835 CoolTip.frame1:SetFrameLevel (frame:GetFrameLevel()+1)
|
|
Tercio@11
|
1836
|
|
Tercio@11
|
1837 --> defaults
|
|
Tercio@11
|
1838 myPoint = myPoint or CoolTip.OptionsTable.MyAnchor or "bottom"
|
|
Tercio@11
|
1839 hisPoint = hisPoint or CoolTip.OptionsTable.hisPoint or "top"
|
|
Tercio@11
|
1840
|
|
Tercio@11
|
1841 x = x or CoolTip.OptionsTable.WidthAnchorMod or 0
|
|
Tercio@11
|
1842 y = y or CoolTip.OptionsTable.HeightAnchorMod or 0
|
|
Tercio@11
|
1843
|
|
Tercio@11
|
1844 --> check options
|
|
Tercio@11
|
1845 if (type (myPoint) == "string") then
|
|
Tercio@11
|
1846 CoolTip:SetOption ("MyAnchor", myPoint)
|
|
Tercio@11
|
1847 CoolTip:SetOption ("WidthAnchorMod", x)
|
|
Tercio@11
|
1848 elseif (type (myPoint) == "number") then
|
|
Tercio@11
|
1849 CoolTip:SetOption ("HeightAnchorMod", myPoint)
|
|
Tercio@11
|
1850 end
|
|
Tercio@11
|
1851
|
|
Tercio@11
|
1852 if (type (hisPoint) == "string") then
|
|
Tercio@11
|
1853 CoolTip:SetOption ("RelativeAnchor", hisPoint)
|
|
Tercio@11
|
1854 CoolTip:SetOption ("HeightAnchorMod", y)
|
|
Tercio@11
|
1855 elseif (type (hisPoint) == "number") then
|
|
Tercio@11
|
1856 CoolTip:SetOption ("WidthAnchorMod", hisPoint)
|
|
Tercio@11
|
1857 end
|
|
Tercio@11
|
1858 end
|
|
Tercio@11
|
1859
|
|
Tercio@11
|
1860 ----------------------------------------------------------------------
|
|
Tercio@11
|
1861 --> set cooltip type
|
|
Tercio@11
|
1862 --> parameters: type (1 = tooltip | 2 = tooltip with bars | 3 = menu)
|
|
Tercio@11
|
1863
|
|
Tercio@11
|
1864 function CoolTip:IsMenu()
|
|
Tercio@11
|
1865 return CoolTip.frame1:IsShown() and CoolTip.Type == 3
|
|
Tercio@11
|
1866 end
|
|
Tercio@11
|
1867
|
|
Tercio@11
|
1868 function CoolTip:IsTooltip()
|
|
Tercio@11
|
1869 return CoolTip.frame1:IsShown() and (CoolTip.Type == 1 or CoolTip.Type == 2)
|
|
Tercio@11
|
1870 end
|
|
Tercio@11
|
1871
|
|
Tercio@11
|
1872 function CoolTip:GetType()
|
|
Tercio@11
|
1873 if (CoolTip.Type == 1 or CoolTip.Type == 2) then
|
|
Tercio@11
|
1874 return "tooltip"
|
|
Tercio@11
|
1875 elseif (CoolTip.Type == 3) then
|
|
Tercio@11
|
1876 return "menu"
|
|
Tercio@11
|
1877 else
|
|
Tercio@11
|
1878 return "none"
|
|
Tercio@11
|
1879 end
|
|
Tercio@11
|
1880 end
|
|
Tercio@11
|
1881
|
|
Tercio@11
|
1882 function CoolTip:SetType (newType)
|
|
Tercio@11
|
1883 if (type (newType) == "string") then
|
|
Tercio@11
|
1884 if (newType == "tooltip") then
|
|
Tercio@11
|
1885 CoolTip.Type = 1
|
|
Tercio@11
|
1886 elseif (newType == "tooltipbar") then
|
|
Tercio@11
|
1887 CoolTip.Type = 2
|
|
Tercio@11
|
1888 elseif (newType == "menu") then
|
|
Tercio@11
|
1889 CoolTip.Type = 3
|
|
Tercio@11
|
1890 else
|
|
Tercio@11
|
1891 --> error
|
|
Tercio@11
|
1892 end
|
|
Tercio@11
|
1893 elseif (type (newType) == "number") then
|
|
Tercio@11
|
1894 if (newType == 1) then
|
|
Tercio@11
|
1895 CoolTip.Type = 1
|
|
Tercio@11
|
1896 elseif (newType == 2) then
|
|
Tercio@11
|
1897 CoolTip.Type = 2
|
|
Tercio@11
|
1898 elseif (newType == 3) then
|
|
Tercio@11
|
1899 CoolTip.Type = 3
|
|
Tercio@11
|
1900 else
|
|
Tercio@11
|
1901 --> error
|
|
Tercio@11
|
1902 end
|
|
Tercio@11
|
1903 else
|
|
Tercio@11
|
1904 --> error
|
|
Tercio@11
|
1905 end
|
|
Tercio@11
|
1906 end
|
|
Tercio@11
|
1907
|
|
Tercio@11
|
1908 --> Set a fixed value for menu
|
|
Tercio@11
|
1909 function CoolTip:SetFixedParameter (value, injected)
|
|
Tercio@11
|
1910 if (injected ~= nil) then
|
|
Tercio@11
|
1911 local frame = value
|
|
Tercio@11
|
1912 if (frame.dframework) then
|
|
Tercio@11
|
1913 frame = frame.widget
|
|
Tercio@11
|
1914 end
|
|
Tercio@11
|
1915 if (frame.CoolTip) then
|
|
Tercio@11
|
1916 frame.CoolTip.FixedValue = injected
|
|
Tercio@11
|
1917 else
|
|
Tercio@11
|
1918 --debug
|
|
Tercio@11
|
1919 end
|
|
Tercio@11
|
1920 end
|
|
Tercio@11
|
1921 CoolTip.FixedValue = value
|
|
Tercio@11
|
1922 end
|
|
Tercio@11
|
1923
|
|
Tercio@11
|
1924 function CoolTip:SetColor (menuType, ...)
|
|
Tercio@11
|
1925 local ColorR, ColorG, ColorB, ColorA = DF:ParseColors (...)
|
|
Tercio@11
|
1926 if ((type (menuType) == "string" and menuType == "main") or (type (menuType) == "number" and menuType == 1)) then
|
|
Tercio@11
|
1927 frame1.framebackgroundLeft:SetVertexColor (ColorR, ColorG, ColorB, ColorA)
|
|
Tercio@11
|
1928 frame1.framebackgroundRight:SetVertexColor (ColorR, ColorG, ColorB, ColorA)
|
|
Tercio@11
|
1929 frame1.framebackgroundCenter:SetVertexColor (ColorR, ColorG, ColorB, ColorA)
|
|
Tercio@11
|
1930
|
|
Tercio@11
|
1931 elseif ((type (menuType) == "string" and menuType == "sec") or (type (menuType) == "number" and menuType == 2)) then
|
|
Tercio@11
|
1932 frame2.framebackgroundLeft:SetVertexColor (ColorR, ColorG, ColorB, ColorA)
|
|
Tercio@11
|
1933 frame2.framebackgroundRight:SetVertexColor (ColorR, ColorG, ColorB, ColorA)
|
|
Tercio@11
|
1934 frame2.framebackgroundCenter:SetVertexColor (ColorR, ColorG, ColorB, ColorA)
|
|
Tercio@11
|
1935
|
|
Tercio@11
|
1936 else
|
|
Tercio@11
|
1937 return --> error
|
|
Tercio@11
|
1938 end
|
|
Tercio@11
|
1939 end
|
|
Tercio@11
|
1940
|
|
Tercio@11
|
1941 --> Set last selected option
|
|
Tercio@11
|
1942 function CoolTip:SetLastSelected (menuType, index, index2)
|
|
Tercio@11
|
1943
|
|
Tercio@11
|
1944 if (CoolTip.Type == 3) then
|
|
Tercio@11
|
1945 if ((type (menuType) == "string" and menuType == "main") or (type (menuType) == "number" and menuType == 1)) then
|
|
Tercio@11
|
1946 CoolTip.SelectedIndexMain = index
|
|
Tercio@11
|
1947 elseif ((type (menuType) == "string" and menuType == "sec") or (type (menuType) == "number" and menuType == 2)) then
|
|
Tercio@11
|
1948 CoolTip.SelectedIndexSec [index] = index2
|
|
Tercio@11
|
1949 else
|
|
Tercio@11
|
1950 return --> error
|
|
Tercio@11
|
1951 end
|
|
Tercio@11
|
1952 else
|
|
Tercio@11
|
1953 return --> error
|
|
Tercio@11
|
1954 end
|
|
Tercio@11
|
1955 end
|
|
Tercio@11
|
1956
|
|
Tercio@11
|
1957 --> serack key: ~select
|
|
Tercio@11
|
1958 function CoolTip:Select (menuType, option, mainIndex)
|
|
Tercio@11
|
1959 if (menuType == 1) then --main menu
|
|
Tercio@11
|
1960 local botao = frame1.Lines [option]
|
|
Tercio@11
|
1961 CoolTip.buttonClicked = true
|
|
Tercio@11
|
1962 CoolTip:SetSelectedAnchor (frame1, botao)
|
|
Tercio@11
|
1963
|
|
Tercio@11
|
1964 --UIFrameFlash (frame1.selected, 0.05, 0.05, 0.2, true, 0, 0)
|
|
Tercio@11
|
1965
|
|
Tercio@11
|
1966 elseif (menuType == 2) then --sub menu
|
|
Tercio@11
|
1967 CoolTip:ShowSub (mainIndex)
|
|
Tercio@11
|
1968 local botao = frame2.Lines [option]
|
|
Tercio@11
|
1969 CoolTip.buttonClicked = true
|
|
Tercio@11
|
1970
|
|
Tercio@11
|
1971 CoolTip:SetSelectedAnchor (frame2, botao)
|
|
Tercio@11
|
1972 end
|
|
Tercio@11
|
1973 end
|
|
Tercio@11
|
1974
|
|
Tercio@11
|
1975 ----------------------------------------------------------------------
|
|
Tercio@11
|
1976 --> Reset cooltip
|
|
Tercio@11
|
1977
|
|
Tercioo@29
|
1978 local default_backdrop = {bgFile = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]], edgeFile = [[Interface\Buttons\WHITE8X8]], tile = true,
|
|
Tercioo@29
|
1979 edgeSize = 1, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}}
|
|
Tercio@11
|
1980 local default_backdrop_color = {0.09019, 0.09019, 0.18823, 1}
|
|
Tercio@11
|
1981 local default_backdropborder_color = {1, 1, 1, 1}
|
|
Tercio@11
|
1982
|
|
Tercio@11
|
1983 --borda preta sem usar unpack
|
|
Tercio@11
|
1984
|
|
Tercio@11
|
1985 --> wipe all data ~reset
|
|
Tercio@11
|
1986 function CoolTip:Reset()
|
|
Tercio@11
|
1987
|
|
Tercio@11
|
1988 frame2:ClearAllPoints()
|
|
Tercio@40
|
1989 frame2:SetPoint ("bottomleft", frame1, "bottomright", 4, 0)
|
|
Tercio@40
|
1990
|
|
Tercio@40
|
1991 frame1:SetParent (UIParent)
|
|
Tercio@40
|
1992 frame2:SetParent (UIParent)
|
|
Tercio@40
|
1993 frame1:SetFrameStrata ("TOOLTIP")
|
|
Tercio@40
|
1994 frame2:SetFrameStrata ("TOOLTIP")
|
|
Tercio@40
|
1995
|
|
Tercio@11
|
1996 CoolTip:HideSelectedTexture (frame1)
|
|
Tercio@11
|
1997 CoolTip:HideSelectedTexture (frame2)
|
|
Tercio@11
|
1998
|
|
Tercio@11
|
1999 CoolTip.FixedValue = nil
|
|
Tercio@11
|
2000 CoolTip.HaveSubMenu = false
|
|
Tercio@11
|
2001
|
|
Tercio@11
|
2002 CoolTip.SelectedIndexMain = nil
|
|
Tercio@11
|
2003 _table_wipe (CoolTip.SelectedIndexSec)
|
|
Tercio@11
|
2004
|
|
Tercio@11
|
2005 CoolTip.Indexes = 0
|
|
Tercio@11
|
2006 CoolTip.SubIndexes = 0
|
|
Tercio@11
|
2007 _table_wipe (CoolTip.IndexesSub)
|
|
Tercio@11
|
2008
|
|
Tercio@11
|
2009 CoolTip.internal_x_mod = 0
|
|
Tercio@11
|
2010 CoolTip.internal_y_mod = 0
|
|
Tercio@11
|
2011 CoolTip.current_anchor = nil
|
|
Tercio@11
|
2012 CoolTip.overlap_checked = false
|
|
Tercio@11
|
2013
|
|
Tercio@11
|
2014 CoolTip.frame2_leftside = nil
|
|
Tercio@11
|
2015
|
|
Tercio@11
|
2016 frame1:SetBackdrop (default_backdrop)
|
|
Tercio@11
|
2017 frame1:SetBackdropColor (unpack (default_backdrop_color))
|
|
Tercio@11
|
2018 frame1:SetBackdropBorderColor (unpack (default_backdropborder_color))
|
|
Tercio@11
|
2019
|
|
Tercio@11
|
2020 frame2:SetBackdrop (default_backdrop)
|
|
Tercio@11
|
2021 frame2:SetBackdropColor (unpack (default_backdrop_color))
|
|
Tercio@11
|
2022 frame2:SetBackdropBorderColor (unpack (default_backdropborder_color))
|
|
Tercio@11
|
2023
|
|
Tercio@11
|
2024 --[
|
|
Tercio@20
|
2025 _table_wipe (CoolTip.PopupFrameTable)
|
|
Tercio@20
|
2026
|
|
Tercio@11
|
2027 _table_wipe (CoolTip.LeftTextTable)
|
|
Tercio@11
|
2028 _table_wipe (CoolTip.LeftTextTableSub)
|
|
Tercio@11
|
2029 _table_wipe (CoolTip.RightTextTable)
|
|
Tercio@11
|
2030 _table_wipe (CoolTip.RightTextTableSub)
|
|
Tercio@11
|
2031
|
|
Tercio@11
|
2032 _table_wipe (CoolTip.LeftIconTable)
|
|
Tercio@11
|
2033 _table_wipe (CoolTip.LeftIconTableSub)
|
|
Tercio@11
|
2034 _table_wipe (CoolTip.RightIconTable)
|
|
Tercio@11
|
2035 _table_wipe (CoolTip.RightIconTableSub)
|
|
Tercio@11
|
2036
|
|
Tercio@11
|
2037 _table_wipe (CoolTip.StatusBarTable)
|
|
Tercio@11
|
2038 _table_wipe (CoolTip.StatusBarTableSub)
|
|
Tercio@11
|
2039
|
|
Tercio@11
|
2040 _table_wipe (CoolTip.FunctionsTableMain)
|
|
Tercio@11
|
2041 _table_wipe (CoolTip.FunctionsTableSub)
|
|
Tercio@11
|
2042
|
|
Tercio@11
|
2043 _table_wipe (CoolTip.ParametersTableMain)
|
|
Tercio@11
|
2044 _table_wipe (CoolTip.ParametersTableSub)
|
|
Tercio@11
|
2045
|
|
Tercio@11
|
2046 _table_wipe (CoolTip.WallpaperTable)
|
|
Tercio@11
|
2047 _table_wipe (CoolTip.WallpaperTableSub)
|
|
Tercio@11
|
2048 --]]
|
|
Tercio@11
|
2049
|
|
Tercio@11
|
2050 _table_wipe (CoolTip.TopIconTableSub)
|
|
Tercio@11
|
2051 CoolTip.Banner [1] = false
|
|
Tercio@11
|
2052 CoolTip.Banner [2] = false
|
|
Tercio@11
|
2053 CoolTip.Banner [3] = false
|
|
Tercio@11
|
2054
|
|
Tercio@11
|
2055 frame1.upperImage:Hide()
|
|
Tercio@11
|
2056 frame1.upperImage2:Hide()
|
|
Tercio@11
|
2057 frame1.upperImageText:Hide()
|
|
Tercio@11
|
2058 frame1.upperImageText2:Hide()
|
|
Tercio@11
|
2059
|
|
Tercio@11
|
2060 frame1.frameWallpaper:Hide()
|
|
Tercio@11
|
2061 frame2.frameWallpaper:Hide()
|
|
Tercio@11
|
2062
|
|
Tercio@11
|
2063 frame2.upperImage:Hide()
|
|
Tercio@11
|
2064
|
|
Tercio@11
|
2065 CoolTip.title1 = nil
|
|
Tercio@11
|
2066 CoolTip.title_text = nil
|
|
Tercio@11
|
2067
|
|
Tercio@11
|
2068 CoolTip.frame1.titleText:Hide()
|
|
Tercio@11
|
2069 CoolTip.frame1.titleIcon:Hide()
|
|
Tercio@11
|
2070
|
|
Tercio@11
|
2071 CoolTip:ClearAllOptions()
|
|
Tercio@11
|
2072 CoolTip:SetColor (1, "transparent")
|
|
Tercio@11
|
2073 CoolTip:SetColor (2, "transparent")
|
|
Tercio@11
|
2074
|
|
Tercio@11
|
2075 local f1Lines = frame1.Lines
|
|
Tercio@11
|
2076 for i = 1, #f1Lines do
|
|
Tercio@11
|
2077 f1Lines [i].statusbar.subMenuArrow:Hide()
|
|
Tercio@11
|
2078 end
|
|
Tercio@11
|
2079 end
|
|
Tercio@11
|
2080
|
|
Tercio@11
|
2081 ----------------------------------------------------------------------
|
|
Tercio@11
|
2082 --> Menu functions
|
|
Tercio@11
|
2083
|
|
Tercio@11
|
2084 local _default_color = {1, 1, 1}
|
|
Tercio@11
|
2085 local _default_point = {"center", "center", 0, -3}
|
|
Tercio@11
|
2086
|
|
Tercio@11
|
2087 function CoolTip:AddMenu (menuType, func, param1, param2, param3, leftText, leftIcon, indexUp)
|
|
Tercio@11
|
2088
|
|
Tercio@11
|
2089 if (leftText and indexUp and ((type (menuType) == "string" and menuType == "main") or (type (menuType) == "number" and menuType == 1))) then
|
|
Tercio@11
|
2090 CoolTip.Indexes = CoolTip.Indexes + 1
|
|
Tercio@11
|
2091
|
|
Tercio@11
|
2092 if (not CoolTip.IndexesSub [CoolTip.Indexes]) then
|
|
Tercio@11
|
2093 CoolTip.IndexesSub [CoolTip.Indexes] = 0
|
|
Tercio@11
|
2094 end
|
|
Tercio@11
|
2095
|
|
Tercio@11
|
2096 CoolTip.SubIndexes = 0
|
|
Tercio@11
|
2097 end
|
|
Tercio@11
|
2098
|
|
Tercio@11
|
2099 --> need a previous line
|
|
Tercio@11
|
2100 if (CoolTip.Indexes == 0) then
|
|
Tercio@11
|
2101 print ("Indexes are 0")
|
|
Tercio@11
|
2102 return --> return error
|
|
Tercio@11
|
2103 end
|
|
Tercio@11
|
2104
|
|
Tercio@11
|
2105 --> check data integrity
|
|
Tercio@11
|
2106 if (type (func) ~= "function") then
|
|
Tercio@11
|
2107 print ("No function")
|
|
Tercio@11
|
2108 return --> erroe
|
|
Tercio@11
|
2109 end
|
|
Tercio@11
|
2110
|
|
Tercio@11
|
2111 --> add
|
|
Tercio@11
|
2112
|
|
Tercio@11
|
2113 if ((type (menuType) == "string" and menuType == "main") or (type (menuType) == "number" and menuType == 1)) then
|
|
Tercio@11
|
2114
|
|
Tercio@11
|
2115 local parameterTable
|
|
Tercio@11
|
2116 if (CoolTip.isSpecial) then
|
|
Tercio@11
|
2117 parameterTable = {}
|
|
Tercio@11
|
2118 _table_insert (CoolTip.FunctionsTableMain, CoolTip.Indexes, func)
|
|
Tercio@11
|
2119 _table_insert (CoolTip.ParametersTableMain, CoolTip.Indexes, parameterTable)
|
|
Tercio@11
|
2120 else
|
|
Tercio@11
|
2121
|
|
Tercio@11
|
2122 CoolTip.FunctionsTableMain [CoolTip.Indexes] = func
|
|
Tercio@11
|
2123
|
|
Tercio@11
|
2124 parameterTable = CoolTip.ParametersTableMain [CoolTip.Indexes]
|
|
Tercio@11
|
2125 if (not parameterTable) then
|
|
Tercio@11
|
2126 parameterTable = {}
|
|
Tercio@11
|
2127 CoolTip.ParametersTableMain [CoolTip.Indexes] = parameterTable
|
|
Tercio@11
|
2128 end
|
|
Tercio@11
|
2129 end
|
|
Tercio@11
|
2130
|
|
Tercio@11
|
2131 parameterTable [1] = param1
|
|
Tercio@11
|
2132 parameterTable [2] = param2
|
|
Tercio@11
|
2133 parameterTable [3] = param3
|
|
Tercio@11
|
2134
|
|
Tercio@11
|
2135 if (leftIcon) then
|
|
Tercio@11
|
2136 local iconTable = CoolTip.LeftIconTable [CoolTip.Indexes]
|
|
Tercio@11
|
2137
|
|
Tercio@11
|
2138 if (not iconTable or CoolTip.isSpecial) then
|
|
Tercio@11
|
2139 iconTable = {}
|
|
Tercio@11
|
2140 CoolTip.LeftIconTable [CoolTip.Indexes] = iconTable
|
|
Tercio@11
|
2141 end
|
|
Tercio@11
|
2142
|
|
Tercio@11
|
2143 iconTable [1] = leftIcon
|
|
Tercio@11
|
2144 iconTable [2] = 16 --> default 16
|
|
Tercio@11
|
2145 iconTable [3] = 16 --> default 16
|
|
Tercio@11
|
2146 iconTable [4] = 0 --> default 0
|
|
Tercio@11
|
2147 iconTable [5] = 1 --> default 1
|
|
Tercio@11
|
2148 iconTable [6] = 0 --> default 0
|
|
Tercio@11
|
2149 iconTable [7] = 1 --> default 1
|
|
Tercio@11
|
2150 iconTable [8] = _default_color
|
|
Tercio@11
|
2151 end
|
|
Tercio@11
|
2152
|
|
Tercio@11
|
2153 if (leftText) then
|
|
Tercio@11
|
2154 local lineTable_left = CoolTip.LeftTextTable [CoolTip.Indexes]
|
|
Tercio@11
|
2155
|
|
Tercio@11
|
2156 if (not lineTable_left or CoolTip.isSpecial) then
|
|
Tercio@11
|
2157 lineTable_left = {}
|
|
Tercio@11
|
2158 CoolTip.LeftTextTable [CoolTip.Indexes] = lineTable_left
|
|
Tercio@11
|
2159 end
|
|
Tercio@11
|
2160
|
|
Tercio@11
|
2161 lineTable_left [1] = leftText --> line text
|
|
Tercio@11
|
2162 lineTable_left [2] = 0
|
|
Tercio@11
|
2163 lineTable_left [3] = 0
|
|
Tercio@11
|
2164 lineTable_left [4] = 0
|
|
Tercio@11
|
2165 lineTable_left [5] = 0
|
|
Tercio@11
|
2166 lineTable_left [6] = false
|
|
Tercio@11
|
2167 lineTable_left [7] = false
|
|
Tercio@11
|
2168 lineTable_left [8] = false
|
|
Tercio@11
|
2169
|
|
Tercio@11
|
2170 end
|
|
Tercio@11
|
2171
|
|
Tercio@11
|
2172 elseif ((type (menuType) == "string" and menuType == "sec") or (type (menuType) == "number" and menuType == 2)) then
|
|
Tercio@11
|
2173
|
|
Tercio@11
|
2174 if (CoolTip.SubIndexes == 0) then
|
|
Tercio@11
|
2175 if (not indexUp or not leftText) then
|
|
Tercio@11
|
2176 print ("not indexUp or not leftText")
|
|
Tercio@11
|
2177 return --> error
|
|
Tercio@11
|
2178 end
|
|
Tercio@11
|
2179 end
|
|
Tercio@11
|
2180
|
|
Tercio@11
|
2181 if (indexUp and leftText) then
|
|
Tercio@11
|
2182 CoolTip.SubIndexes = CoolTip.SubIndexes + 1
|
|
Tercio@11
|
2183 CoolTip.IndexesSub [CoolTip.Indexes] = CoolTip.IndexesSub [CoolTip.Indexes] + 1
|
|
Tercio@11
|
2184 elseif (indexUp and not leftText) then
|
|
Tercio@11
|
2185 print ("indexUp and not leftText")
|
|
Tercio@11
|
2186 return --> error [leftText can't be nil if indexUp are true]
|
|
Tercio@11
|
2187 end
|
|
Tercio@11
|
2188
|
|
Tercio@11
|
2189 --> menu container
|
|
Tercio@11
|
2190 local subMenuContainerParameters = CoolTip.ParametersTableSub [CoolTip.Indexes]
|
|
Tercio@11
|
2191 if (not subMenuContainerParameters) then
|
|
Tercio@11
|
2192 subMenuContainerParameters = {}
|
|
Tercio@11
|
2193 CoolTip.ParametersTableSub [CoolTip.Indexes] = subMenuContainerParameters
|
|
Tercio@11
|
2194 end
|
|
Tercio@11
|
2195
|
|
Tercio@11
|
2196 local subMenuContainerFunctions = CoolTip.FunctionsTableSub [CoolTip.Indexes]
|
|
Tercio@11
|
2197 if (not subMenuContainerFunctions or CoolTip.isSpecial) then
|
|
Tercio@11
|
2198 subMenuContainerFunctions = {}
|
|
Tercio@11
|
2199 CoolTip.FunctionsTableSub [CoolTip.Indexes] = subMenuContainerFunctions
|
|
Tercio@11
|
2200 end
|
|
Tercio@11
|
2201
|
|
Tercio@11
|
2202 --> menu table
|
|
Tercio@11
|
2203 local subMenuTablesParameters = subMenuContainerParameters [CoolTip.SubIndexes]
|
|
Tercio@11
|
2204 if (not subMenuTablesParameters or CoolTip.isSpecial) then
|
|
Tercio@11
|
2205 subMenuTablesParameters = {}
|
|
Tercio@11
|
2206 subMenuContainerParameters [CoolTip.SubIndexes] = subMenuTablesParameters
|
|
Tercio@11
|
2207 end
|
|
Tercio@11
|
2208
|
|
Tercio@11
|
2209 --> add
|
|
Tercio@11
|
2210 subMenuContainerFunctions [CoolTip.SubIndexes] = func
|
|
Tercio@11
|
2211
|
|
Tercio@11
|
2212 subMenuTablesParameters [1] = param1
|
|
Tercio@11
|
2213 subMenuTablesParameters [2] = param2
|
|
Tercio@11
|
2214 subMenuTablesParameters [3] = param3
|
|
Tercio@11
|
2215
|
|
Tercio@11
|
2216 --> text and icon
|
|
Tercio@11
|
2217 if (leftIcon) then
|
|
Tercio@11
|
2218
|
|
Tercio@11
|
2219 local subMenuContainerIcons = CoolTip.LeftIconTableSub [CoolTip.Indexes]
|
|
Tercio@11
|
2220 if (not subMenuContainerIcons) then
|
|
Tercio@11
|
2221 subMenuContainerIcons = {}
|
|
Tercio@11
|
2222 CoolTip.LeftIconTableSub [CoolTip.Indexes] = subMenuContainerIcons
|
|
Tercio@11
|
2223 end
|
|
Tercio@11
|
2224 local subMenuTablesIcons = subMenuContainerIcons [CoolTip.SubIndexes]
|
|
Tercio@11
|
2225 if (not subMenuTablesIcons or CoolTip.isSpecial) then
|
|
Tercio@11
|
2226 subMenuTablesIcons = {}
|
|
Tercio@11
|
2227 subMenuContainerIcons [CoolTip.SubIndexes] = subMenuTablesIcons
|
|
Tercio@11
|
2228 end
|
|
Tercio@11
|
2229
|
|
Tercio@11
|
2230 subMenuTablesIcons [1] = leftIcon
|
|
Tercio@11
|
2231 subMenuTablesIcons [2] = 16 --> default 16
|
|
Tercio@11
|
2232 subMenuTablesIcons [3] = 16 --> default 16
|
|
Tercio@11
|
2233 subMenuTablesIcons [4] = 0 --> default 0
|
|
Tercio@11
|
2234 subMenuTablesIcons [5] = 1 --> default 1
|
|
Tercio@11
|
2235 subMenuTablesIcons [6] = 0 --> default 0
|
|
Tercio@11
|
2236 subMenuTablesIcons [7] = 1 --> default 1
|
|
Tercio@11
|
2237 subMenuTablesIcons [8] = _default_color
|
|
Tercio@11
|
2238 end
|
|
Tercio@11
|
2239
|
|
Tercio@11
|
2240 if (leftText) then
|
|
Tercio@11
|
2241
|
|
Tercio@11
|
2242 local subMenuContainerTexts = CoolTip.LeftTextTableSub [CoolTip.Indexes]
|
|
Tercio@11
|
2243 if (not subMenuContainerTexts) then
|
|
Tercio@11
|
2244 subMenuContainerTexts = {}
|
|
Tercio@11
|
2245 CoolTip.LeftTextTableSub [CoolTip.Indexes] = subMenuContainerTexts
|
|
Tercio@11
|
2246 end
|
|
Tercio@11
|
2247 local subMenuTablesTexts = subMenuContainerTexts [CoolTip.SubIndexes]
|
|
Tercio@11
|
2248 if (not subMenuTablesTexts or CoolTip.isSpecial) then
|
|
Tercio@11
|
2249 subMenuTablesTexts = {}
|
|
Tercio@11
|
2250 subMenuContainerTexts [CoolTip.SubIndexes] = subMenuTablesTexts
|
|
Tercio@11
|
2251 end
|
|
Tercio@11
|
2252
|
|
Tercio@11
|
2253 subMenuTablesTexts [1] = leftText --> line text
|
|
Tercio@11
|
2254 subMenuTablesTexts [2] = 0
|
|
Tercio@11
|
2255 subMenuTablesTexts [3] = 0
|
|
Tercio@11
|
2256 subMenuTablesTexts [4] = 0
|
|
Tercio@11
|
2257 subMenuTablesTexts [5] = 0
|
|
Tercio@11
|
2258 subMenuTablesTexts [6] = false
|
|
Tercio@11
|
2259 subMenuTablesTexts [7] = false
|
|
Tercio@11
|
2260 subMenuTablesTexts [8] = false
|
|
Tercio@11
|
2261
|
|
Tercio@11
|
2262 end
|
|
Tercio@11
|
2263
|
|
Tercio@11
|
2264 CoolTip.HaveSubMenu = true
|
|
Tercio@11
|
2265
|
|
Tercio@11
|
2266 else
|
|
Tercio@11
|
2267 return --> error
|
|
Tercio@11
|
2268 end
|
|
Tercio@11
|
2269 end
|
|
Tercio@11
|
2270
|
|
Tercio@11
|
2271 ----------------------------------------------------------------------
|
|
Tercio@11
|
2272 --> adds a statusbar to the last line added.
|
|
Tercio@11
|
2273 --> only works with cooltip type 2 (tooltip with bars)
|
|
Tercio@11
|
2274 --> parameters: value [, color red, color green, color blue, color alpha [, glow]]
|
|
Tercio@11
|
2275 --> can also use a table or html color name in color red and send glow in color green
|
|
Tercio@11
|
2276
|
|
Tercioo@29
|
2277 function CoolTip:AddStatusBar (statusbarValue, frame, ColorR, ColorG, ColorB, ColorA, statusbarGlow, backgroundBar, barTexture)
|
|
Tercio@11
|
2278
|
|
Tercio@11
|
2279 --> need a previous line
|
|
Tercio@11
|
2280 if (CoolTip.Indexes == 0) then
|
|
Tercio@11
|
2281 return --> return error
|
|
Tercio@11
|
2282 end
|
|
Tercio@11
|
2283
|
|
Tercio@11
|
2284 --> check data integrity
|
|
Tercio@11
|
2285 if (type (statusbarValue) ~= "number") then
|
|
Tercio@11
|
2286 return --> error
|
|
Tercio@11
|
2287 end
|
|
Tercio@11
|
2288
|
|
Tercio@11
|
2289 if (type (ColorR) == "table" or type (ColorR) == "string") then
|
|
Tercio@11
|
2290 statusbarGlow, backgroundBar, ColorR, ColorG, ColorB, ColorA = ColorG, ColorB, DF:ParseColors (ColorR)
|
|
Tercio@11
|
2291 elseif (type (ColorR) == "boolean") then
|
|
Tercio@11
|
2292 backgroundBar = ColorG
|
|
Tercio@11
|
2293 statusbarGlow = ColorR
|
|
Tercio@11
|
2294 ColorR, ColorG, ColorB, ColorA = 1, 1, 1, 1
|
|
Tercio@11
|
2295 else
|
|
Tercio@11
|
2296 --> error
|
|
Tercio@11
|
2297 end
|
|
Tercio@11
|
2298
|
|
Tercio@11
|
2299 --> add
|
|
Tercio@11
|
2300 local frameTable
|
|
Tercio@11
|
2301 local statusbarTable
|
|
Tercio@11
|
2302
|
|
Tercio@11
|
2303 if (not frame or (type (frame) == "string" and frame == "main") or (type (frame) == "number" and frame == 1)) then
|
|
Tercio@11
|
2304 frameTable = CoolTip.StatusBarTable
|
|
Tercio@11
|
2305
|
|
Tercio@11
|
2306 if (CoolTip.isSpecial) then
|
|
Tercio@11
|
2307 statusbarTable = {}
|
|
Tercio@11
|
2308 _table_insert (frameTable, CoolTip.Indexes, statusbarTable)
|
|
Tercio@11
|
2309 else
|
|
Tercio@11
|
2310 statusbarTable = frameTable [CoolTip.Indexes]
|
|
Tercio@11
|
2311 if (not statusbarTable) then
|
|
Tercio@11
|
2312 statusbarTable = {}
|
|
Tercio@11
|
2313 _table_insert (frameTable, CoolTip.Indexes, statusbarTable)
|
|
Tercio@11
|
2314 --frameTable [CoolTip.Indexes] = statusbarTable
|
|
Tercio@11
|
2315 end
|
|
Tercio@11
|
2316 end
|
|
Tercio@11
|
2317
|
|
Tercio@11
|
2318 elseif ((type (frame) == "string" and frame == "sub") or (type (frame) == "number" and frame == 2)) then
|
|
Tercio@11
|
2319
|
|
Tercio@11
|
2320 frameTable = CoolTip.StatusBarTableSub
|
|
Tercio@11
|
2321
|
|
Tercio@11
|
2322 local subMenuContainerStatusBar = frameTable [CoolTip.Indexes]
|
|
Tercio@11
|
2323 if (not subMenuContainerStatusBar) then
|
|
Tercio@11
|
2324 subMenuContainerStatusBar = {}
|
|
Tercio@11
|
2325 frameTable [CoolTip.Indexes] = subMenuContainerStatusBar
|
|
Tercio@11
|
2326 end
|
|
Tercio@11
|
2327
|
|
Tercio@11
|
2328 if (CoolTip.isSpecial) then
|
|
Tercio@11
|
2329 statusbarTable = {}
|
|
Tercio@11
|
2330 _table_insert (subMenuContainerStatusBar, CoolTip.SubIndexes, statusbarTable)
|
|
Tercio@11
|
2331 else
|
|
Tercio@11
|
2332 statusbarTable = subMenuContainerStatusBar [CoolTip.SubIndexes]
|
|
Tercio@11
|
2333 if (not statusbarTable) then
|
|
Tercio@11
|
2334 statusbarTable = {}
|
|
Tercio@11
|
2335 _table_insert (subMenuContainerStatusBar, CoolTip.SubIndexes, statusbarTable)
|
|
Tercio@11
|
2336 end
|
|
Tercio@11
|
2337 end
|
|
Tercio@11
|
2338 else
|
|
Tercio@11
|
2339 print ("unknow frame")
|
|
Tercio@11
|
2340 return --> error
|
|
Tercio@11
|
2341 end
|
|
Tercio@11
|
2342
|
|
Tercio@11
|
2343 statusbarTable [1] = statusbarValue
|
|
Tercio@11
|
2344 statusbarTable [2] = ColorR
|
|
Tercio@11
|
2345 statusbarTable [3] = ColorG
|
|
Tercio@11
|
2346 statusbarTable [4] = ColorB
|
|
Tercio@11
|
2347 statusbarTable [5] = ColorA
|
|
Tercio@11
|
2348 statusbarTable [6] = statusbarGlow
|
|
Tercio@11
|
2349 statusbarTable [7] = backgroundBar
|
|
Tercioo@29
|
2350 statusbarTable [8] = barTexture
|
|
Tercio@11
|
2351
|
|
Tercio@11
|
2352 end
|
|
Tercio@11
|
2353
|
|
Tercio@11
|
2354 frame1.frameWallpaper:Hide()
|
|
Tercio@11
|
2355 frame2.frameWallpaper:Hide()
|
|
Tercio@11
|
2356
|
|
Tercio@11
|
2357 function CoolTip:SetWallpaper (index, texture, texcoord, color, desaturate)
|
|
Tercio@11
|
2358
|
|
Tercio@11
|
2359 if (CoolTip.Indexes == 0) then
|
|
Tercio@11
|
2360 return --> return error
|
|
Tercio@11
|
2361 end
|
|
Tercio@11
|
2362
|
|
Tercio@11
|
2363 local frameTable
|
|
Tercio@11
|
2364 local wallpaperTable
|
|
Tercio@11
|
2365
|
|
Tercio@11
|
2366 if ( (type (index) == "number" and index == 1) or (type (index) == "string" and index == "main") ) then
|
|
Tercio@11
|
2367 wallpaperTable = CoolTip.WallpaperTable
|
|
Tercio@11
|
2368
|
|
Tercio@11
|
2369 elseif ( (type (index) == "number" and index == 2) or (type (index) == "string" and index == "sub") ) then
|
|
Tercio@11
|
2370 frameTable = CoolTip.WallpaperTableSub
|
|
Tercio@11
|
2371
|
|
Tercio@11
|
2372 local subMenuContainerWallpapers = frameTable [CoolTip.Indexes]
|
|
Tercio@11
|
2373 if (not subMenuContainerWallpapers) then
|
|
Tercio@11
|
2374 subMenuContainerWallpapers = {}
|
|
Tercio@11
|
2375 frameTable [CoolTip.Indexes] = subMenuContainerWallpapers
|
|
Tercio@11
|
2376 end
|
|
Tercio@11
|
2377
|
|
Tercio@11
|
2378 wallpaperTable = subMenuContainerWallpapers
|
|
Tercio@11
|
2379 end
|
|
Tercio@11
|
2380
|
|
Tercio@11
|
2381 wallpaperTable [1] = texture
|
|
Tercio@11
|
2382 if (texcoord) then
|
|
Tercio@11
|
2383 wallpaperTable [2] = texcoord [1]
|
|
Tercio@11
|
2384 wallpaperTable [3] = texcoord [2]
|
|
Tercio@11
|
2385 wallpaperTable [4] = texcoord [3]
|
|
Tercio@11
|
2386 wallpaperTable [5] = texcoord [4]
|
|
Tercio@11
|
2387 else
|
|
Tercio@11
|
2388 wallpaperTable [2] = 0
|
|
Tercio@11
|
2389 wallpaperTable [3] = 1
|
|
Tercio@11
|
2390 wallpaperTable [4] = 0
|
|
Tercio@11
|
2391 wallpaperTable [5] = 1
|
|
Tercio@11
|
2392 end
|
|
Tercio@11
|
2393 wallpaperTable [6] = color
|
|
Tercio@11
|
2394 wallpaperTable [7] = desaturate
|
|
Tercio@11
|
2395 end
|
|
Tercio@11
|
2396
|
|
Tercio@11
|
2397 function CoolTip:SetBannerText (index, text, anchor, color, fontsize, fontface, fontflag)
|
|
Tercio@11
|
2398 local fontstring
|
|
Tercio@11
|
2399
|
|
Tercio@11
|
2400 if (index == 1) then
|
|
Tercio@11
|
2401 fontstring = frame1.upperImageText
|
|
Tercio@11
|
2402 elseif (index == 2) then
|
|
Tercio@11
|
2403 fontstring = frame1.upperImageText2
|
|
Tercio@11
|
2404 end
|
|
Tercio@11
|
2405
|
|
Tercio@11
|
2406 fontstring:SetText (text or "")
|
|
Tercio@11
|
2407
|
|
Tercio@11
|
2408 if (anchor and index == 1) then
|
|
Tercio@11
|
2409 local myAnchor, hisAnchor, x, y = unpack (anchor)
|
|
Tercio@11
|
2410 fontstring:SetPoint (myAnchor, frame1.upperImage, hisAnchor or myAnchor, x or 0, y or 0)
|
|
Tercio@11
|
2411 elseif (anchor and index == 2) then
|
|
Tercio@11
|
2412 local myAnchor, hisAnchor, x, y = unpack (anchor)
|
|
Tercio@11
|
2413 fontstring:SetPoint (myAnchor, frame1, hisAnchor or myAnchor, x or 0, y or 0)
|
|
Tercio@11
|
2414 end
|
|
Tercio@11
|
2415
|
|
Tercio@11
|
2416 if (color) then
|
|
Tercio@11
|
2417 local r, g, b, a = DF:ParseColors (color)
|
|
Tercio@11
|
2418 fontstring:SetTextColor (r, g, b, a)
|
|
Tercio@11
|
2419 end
|
|
Tercio@11
|
2420
|
|
Tercio@11
|
2421 local face, size, flags = fontstring:GetFont()
|
|
Tercio@11
|
2422 face = fontface or [[Fonts\FRIZQT__.TTF]]
|
|
Tercio@11
|
2423 size = fontsize or 13
|
|
Tercio@11
|
2424 flags = fontflag or nil
|
|
Tercio@11
|
2425 fontstring:SetFont (face, size, flags)
|
|
Tercio@11
|
2426 fontstring:Show()
|
|
Tercio@11
|
2427 end
|
|
Tercio@11
|
2428
|
|
Tercio@11
|
2429 function CoolTip:SetBackdrop (index, backdrop, backdropcolor, bordercolor)
|
|
Tercio@11
|
2430
|
|
Tercio@11
|
2431 local f
|
|
Tercio@11
|
2432 if (index == 1) then
|
|
Tercio@11
|
2433 f = frame1
|
|
Tercio@11
|
2434 elseif (index == 2) then
|
|
Tercio@11
|
2435 f = frame2
|
|
Tercio@11
|
2436 end
|
|
Tercio@11
|
2437
|
|
Tercio@11
|
2438 if (backdrop) then
|
|
Tercio@11
|
2439 f:SetBackdrop (backdrop)
|
|
Tercio@11
|
2440 end
|
|
Tercio@11
|
2441 if (backdropcolor) then
|
|
Tercio@11
|
2442 local r, g, b, a = DF:ParseColors (backdropcolor)
|
|
Tercio@11
|
2443 f:SetBackdropColor (r, g, b, a)
|
|
Tercio@11
|
2444 end
|
|
Tercio@11
|
2445 if (bordercolor) then
|
|
Tercio@11
|
2446 local r, g, b, a = DF:ParseColors (bordercolor)
|
|
Tercio@11
|
2447 f:SetBackdropBorderColor (r, g, b, a)
|
|
Tercio@11
|
2448 end
|
|
Tercio@11
|
2449
|
|
Tercio@11
|
2450 end
|
|
Tercio@11
|
2451
|
|
Tercio@11
|
2452 function CoolTip:SetBannerImage (index, texturepath, width, height, anchor, texcoord, overlay)
|
|
Tercio@11
|
2453
|
|
Tercio@11
|
2454 local texture
|
|
Tercio@11
|
2455
|
|
Tercio@11
|
2456 if (index == 1) then
|
|
Tercio@11
|
2457 texture = frame1.upperImage
|
|
Tercio@11
|
2458 elseif (index == 2) then
|
|
Tercio@11
|
2459 texture = frame1.upperImage2
|
|
Tercio@11
|
2460 end
|
|
Tercio@11
|
2461
|
|
Tercio@11
|
2462 if (texturepath) then
|
|
Tercio@11
|
2463 texture:SetTexture (texturepath)
|
|
Tercio@11
|
2464 end
|
|
Tercio@11
|
2465
|
|
Tercio@11
|
2466 if (width) then
|
|
Tercio@11
|
2467 texture:SetWidth (width)
|
|
Tercio@11
|
2468 end
|
|
Tercio@11
|
2469 if (height) then
|
|
Tercio@11
|
2470 texture:SetHeight (height)
|
|
Tercio@11
|
2471 end
|
|
Tercio@11
|
2472
|
|
Tercio@11
|
2473 if (anchor) then
|
|
Tercio@11
|
2474 if (type (anchor[1]) == "table") then
|
|
Tercio@11
|
2475 for _, t in _ipairs (anchor) do
|
|
Tercio@11
|
2476 local myAnchor, hisAnchor, x, y = unpack (t)
|
|
Tercio@11
|
2477 texture:SetPoint (myAnchor, frame1, hisAnchor or myAnchor, x or 0, y or 0)
|
|
Tercio@11
|
2478 end
|
|
Tercio@11
|
2479 else
|
|
Tercio@11
|
2480 local myAnchor, hisAnchor, x, y = unpack (anchor)
|
|
Tercio@11
|
2481 texture:SetPoint (myAnchor, frame1, hisAnchor or myAnchor, x or 0, y or 0)
|
|
Tercio@11
|
2482 end
|
|
Tercio@11
|
2483 end
|
|
Tercio@11
|
2484
|
|
Tercio@11
|
2485 if (texcoord) then
|
|
Tercio@11
|
2486 local L, R, T, B = unpack (texcoord)
|
|
Tercio@11
|
2487 texture:SetTexCoord (L, R, T, B)
|
|
Tercio@11
|
2488 end
|
|
Tercio@11
|
2489
|
|
Tercio@11
|
2490 if (overlay) then
|
|
Tercio@11
|
2491 texture:SetVertexColor (unpack (overlay))
|
|
Tercio@11
|
2492 end
|
|
Tercio@11
|
2493
|
|
Tercio@11
|
2494 CoolTip.Banner [index] = true
|
|
Tercio@11
|
2495 texture:Show()
|
|
Tercio@11
|
2496
|
|
Tercio@11
|
2497 end
|
|
Tercio@11
|
2498
|
|
Tercio@11
|
2499 ----------------------------------------------------------------------
|
|
Tercio@11
|
2500 --> adds a icon to the last line added.
|
|
Tercio@11
|
2501 --> only works with cooltip type 1 and 2 (tooltip and tooltip with bars)
|
|
Tercio@11
|
2502 --> parameters: icon [, width [, height [, TexCoords L R T B ]]]
|
|
Tercio@11
|
2503 --> texture support string path or texture object
|
|
Tercio@11
|
2504
|
|
Tercio@11
|
2505 function CoolTip:AddTexture (iconTexture, frame, side, iconWidth, iconHeight, L, R, T, B, overlayColor, point, desaturated)
|
|
Tercio@11
|
2506 return CoolTip:AddIcon (iconTexture, frame, side, iconWidth, iconHeight, L, R, T, B, overlayColor, point, desaturated)
|
|
Tercio@11
|
2507 end
|
|
Tercio@11
|
2508 function CoolTip:AddIcon (iconTexture, frame, side, iconWidth, iconHeight, L, R, T, B, overlayColor, point, desaturated)
|
|
Tercio@11
|
2509
|
|
Tercio@11
|
2510 --> need a previous line
|
|
Tercio@11
|
2511 if (CoolTip.Indexes == 0) then
|
|
Tercio@11
|
2512 return --> return error
|
|
Tercio@11
|
2513 end
|
|
Tercio@11
|
2514
|
|
Tercio@11
|
2515 --> check data integrity
|
|
Tercio@39
|
2516 if ( (type (iconTexture) ~= "string" and type (iconTexture) ~= "number") and (type (iconTexture) ~= "table" or not iconTexture.GetObjectType or iconTexture:GetObjectType() ~= "Texture") ) then
|
|
Tercio@11
|
2517 return --> return error
|
|
Tercio@11
|
2518 end
|
|
Tercio@11
|
2519
|
|
Tercio@11
|
2520 side = side or 1
|
|
Tercio@11
|
2521
|
|
Tercio@11
|
2522 local frameTable
|
|
Tercio@11
|
2523 local iconTable
|
|
Tercio@11
|
2524
|
|
Tercio@11
|
2525 if (not frame or (type (frame) == "string" and frame == "main") or (type (frame) == "number" and frame == 1)) then
|
|
Tercio@11
|
2526
|
|
Tercio@11
|
2527 if (not side or (type (side) == "string" and side == "left") or (type (side) == "number" and side == 1)) then
|
|
Tercio@11
|
2528 frameTable = CoolTip.LeftIconTable
|
|
Tercio@11
|
2529
|
|
Tercio@11
|
2530 elseif ((type (side) == "string" and side == "right") or (type (side) == "number" and side == 2)) then
|
|
Tercio@11
|
2531 frameTable = CoolTip.RightIconTable
|
|
Tercio@11
|
2532
|
|
Tercio@11
|
2533 end
|
|
Tercio@11
|
2534
|
|
Tercio@11
|
2535 if (CoolTip.isSpecial) then
|
|
Tercio@11
|
2536 iconTable = {}
|
|
Tercio@11
|
2537 _table_insert (frameTable, CoolTip.Indexes, iconTable)
|
|
Tercio@11
|
2538 else
|
|
Tercio@11
|
2539 iconTable = frameTable [CoolTip.Indexes]
|
|
Tercio@11
|
2540 if (not iconTable) then
|
|
Tercio@11
|
2541 iconTable = {}
|
|
Tercio@11
|
2542 _table_insert (frameTable, CoolTip.Indexes, iconTable)
|
|
Tercio@11
|
2543 --frameTable [CoolTip.Indexes] = iconTable
|
|
Tercio@11
|
2544 end
|
|
Tercio@11
|
2545 end
|
|
Tercio@11
|
2546
|
|
Tercio@11
|
2547 elseif ((type (frame) == "string" and frame == "sub") or (type (frame) == "number" and frame == 2)) then
|
|
Tercio@11
|
2548
|
|
Tercio@11
|
2549 if ((type (side) == "string" and side == "left") or (type (side) == "number" and side == 1)) then
|
|
Tercio@11
|
2550 frameTable = CoolTip.LeftIconTableSub
|
|
Tercio@11
|
2551 elseif ((type (side) == "string" and side == "right") or (type (side) == "number" and side == 2)) then
|
|
Tercio@11
|
2552 frameTable = CoolTip.RightIconTableSub
|
|
Tercio@11
|
2553 elseif ((type (side) == "string" and side == "top") or (type (side) == "number" and side == 3)) then
|
|
Tercio@11
|
2554 CoolTip.TopIconTableSub [CoolTip.Indexes] = CoolTip.TopIconTableSub [CoolTip.Indexes] or {}
|
|
Tercio@11
|
2555 CoolTip.TopIconTableSub [CoolTip.Indexes] [1] = iconTexture
|
|
Tercio@11
|
2556 CoolTip.TopIconTableSub [CoolTip.Indexes] [2] = iconWidth or 16
|
|
Tercio@11
|
2557 CoolTip.TopIconTableSub [CoolTip.Indexes] [3] = iconHeight or 16
|
|
Tercio@11
|
2558 CoolTip.TopIconTableSub [CoolTip.Indexes] [4] = L or 0
|
|
Tercio@11
|
2559 CoolTip.TopIconTableSub [CoolTip.Indexes] [5] = R or 1
|
|
Tercio@11
|
2560 CoolTip.TopIconTableSub [CoolTip.Indexes] [6] = T or 0
|
|
Tercio@11
|
2561 CoolTip.TopIconTableSub [CoolTip.Indexes] [7] = B or 1
|
|
Tercio@11
|
2562 CoolTip.TopIconTableSub [CoolTip.Indexes] [8] = overlayColor or _default_color
|
|
Tercio@11
|
2563 CoolTip.TopIconTableSub [CoolTip.Indexes] [9] = desaturated
|
|
Tercio@11
|
2564 return
|
|
Tercio@11
|
2565 end
|
|
Tercio@11
|
2566
|
|
Tercio@11
|
2567 local subMenuContainerIcons = frameTable [CoolTip.Indexes]
|
|
Tercio@11
|
2568 if (not subMenuContainerIcons) then
|
|
Tercio@11
|
2569 subMenuContainerIcons = {}
|
|
Tercio@11
|
2570 frameTable [CoolTip.Indexes] = subMenuContainerIcons
|
|
Tercio@11
|
2571 end
|
|
Tercio@11
|
2572
|
|
Tercio@11
|
2573 if (CoolTip.isSpecial) then
|
|
Tercio@11
|
2574 iconTable = {}
|
|
Tercio@11
|
2575 subMenuContainerIcons [CoolTip.SubIndexes] = iconTable
|
|
Tercio@11
|
2576 else
|
|
Tercio@11
|
2577 iconTable = subMenuContainerIcons [CoolTip.SubIndexes]
|
|
Tercio@11
|
2578 if (not iconTable) then
|
|
Tercio@11
|
2579 iconTable = {}
|
|
Tercio@11
|
2580 subMenuContainerIcons [CoolTip.SubIndexes] = iconTable
|
|
Tercio@11
|
2581 end
|
|
Tercio@11
|
2582 end
|
|
Tercio@11
|
2583
|
|
Tercio@11
|
2584 else
|
|
Tercio@11
|
2585 return --> error
|
|
Tercio@11
|
2586 end
|
|
Tercio@11
|
2587
|
|
Tercio@11
|
2588 iconTable [1] = iconTexture
|
|
Tercio@11
|
2589 iconTable [2] = iconWidth or 16 --> default 16
|
|
Tercio@11
|
2590 iconTable [3] = iconHeight or 16 --> default 16
|
|
Tercio@11
|
2591 iconTable [4] = L or 0 --> default 0
|
|
Tercio@11
|
2592 iconTable [5] = R or 1 --> default 1
|
|
Tercio@11
|
2593 iconTable [6] = T or 0 --> default 0
|
|
Tercio@11
|
2594 iconTable [7] = B or 1 --> default 1
|
|
Tercio@11
|
2595 iconTable [8] = overlayColor or _default_color --> default 1, 1, 1
|
|
Tercio@11
|
2596 iconTable [9] = desaturated
|
|
Tercio@11
|
2597
|
|
Tercio@11
|
2598 return true
|
|
Tercio@11
|
2599 end
|
|
Tercio@11
|
2600
|
|
Tercio@11
|
2601 ----------------------------------------------------------------------
|
|
Tercio@20
|
2602 --> popup frame
|
|
Tercio@20
|
2603 function CoolTip:AddPopUpFrame (func_on_show, func_on_hide, param1, param2)
|
|
Tercio@20
|
2604
|
|
Tercio@20
|
2605 -- act like a sub menu
|
|
Tercio@20
|
2606 if (CoolTip.Indexes > 0) then
|
|
Tercio@20
|
2607 CoolTip.PopupFrameTable [CoolTip.Indexes] = {func_on_show or false, func_on_hide or false, param1, param2}
|
|
Tercio@20
|
2608 end
|
|
Tercio@20
|
2609
|
|
Tercio@20
|
2610 end
|
|
Tercio@20
|
2611
|
|
Tercio@20
|
2612 ----------------------------------------------------------------------
|
|
Tercio@11
|
2613 --> adds a line.
|
|
Tercio@11
|
2614 --> only works with cooltip type 1 and 2 (tooltip and tooltip with bars)
|
|
Tercio@11
|
2615 --> parameters: left text, right text [, L color R, L color G, L color B, L color A [, R color R, R color G, R color B, R color A [, wrap]]]
|
|
Tercio@11
|
2616
|
|
Tercio@11
|
2617 --> alias
|
|
Tercio@11
|
2618 function CoolTip:AddDoubleLine (leftText, rightText, frame, ColorR1, ColorG1, ColorB1, ColorA1, ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace, fontFlag)
|
|
Tercio@11
|
2619 return CoolTip:AddLine (leftText, rightText, frame, ColorR1, ColorG1, ColorB1, ColorA1, ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace, fontFlag)
|
|
Tercio@11
|
2620 end
|
|
Tercio@11
|
2621
|
|
Tercio@11
|
2622 --> adds a line for tooltips
|
|
Tercio@11
|
2623 function CoolTip:AddLine (leftText, rightText, frame, ColorR1, ColorG1, ColorB1, ColorA1, ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace, fontFlag)
|
|
Tercio@11
|
2624
|
|
Tercio@11
|
2625 --> check data integrity
|
|
Tercio@11
|
2626 local t = type (leftText)
|
|
Tercio@11
|
2627 if (t ~= "string") then
|
|
Tercio@11
|
2628 if (t == "number") then
|
|
Tercio@11
|
2629 leftText = tostring (leftText)
|
|
Tercio@11
|
2630 else
|
|
Tercio@11
|
2631 leftText = ""
|
|
Tercio@11
|
2632 end
|
|
Tercio@11
|
2633 end
|
|
Tercio@11
|
2634
|
|
Tercio@11
|
2635 local t = type (rightText)
|
|
Tercio@11
|
2636 if (t ~= "string") then
|
|
Tercio@11
|
2637 if (t == "number") then
|
|
Tercio@11
|
2638 rightText = tostring (rightText)
|
|
Tercio@11
|
2639 else
|
|
Tercio@11
|
2640 rightText = ""
|
|
Tercio@11
|
2641 end
|
|
Tercio@11
|
2642 end
|
|
Tercio@11
|
2643
|
|
Tercio@11
|
2644 if (type (ColorR1) ~= "number") then
|
|
Tercio@11
|
2645 ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace, fontFlag = ColorG1, ColorB1, ColorA1, ColorR2, ColorG2, ColorB2, ColorA2
|
|
Tercio@11
|
2646
|
|
Tercio@11
|
2647 if (type (ColorR1) == "boolean" or not ColorR1) then
|
|
Tercio@11
|
2648 ColorR1, ColorG1, ColorB1, ColorA1 = 0, 0, 0, 0
|
|
Tercio@11
|
2649 else
|
|
Tercio@11
|
2650 ColorR1, ColorG1, ColorB1, ColorA1 = DF:ParseColors (ColorR1)
|
|
Tercio@11
|
2651 end
|
|
Tercio@11
|
2652 end
|
|
Tercio@11
|
2653
|
|
Tercio@11
|
2654 if (type (ColorR2) ~= "number") then
|
|
Tercio@11
|
2655 fontSize, fontFace, fontFlag = ColorG2, ColorB2, ColorA2
|
|
Tercio@11
|
2656
|
|
Tercio@11
|
2657 if (type (ColorR2) == "boolean" or not ColorR2) then
|
|
Tercio@11
|
2658 ColorR2, ColorG2, ColorB2, ColorA2 = 0, 0, 0, 0
|
|
Tercio@11
|
2659 else
|
|
Tercio@11
|
2660 ColorR2, ColorG2, ColorB2, ColorA2 = DF:ParseColors (ColorR2)
|
|
Tercio@11
|
2661 end
|
|
Tercio@11
|
2662 end
|
|
Tercio@11
|
2663
|
|
Tercio@11
|
2664 local frameTableLeft
|
|
Tercio@11
|
2665 local frameTableRight
|
|
Tercio@11
|
2666 local lineTable_left
|
|
Tercio@11
|
2667 local lineTable_right
|
|
Tercio@11
|
2668
|
|
Tercio@11
|
2669 if (not frame or (type (frame) == "string" and frame == "main") or (type (frame) == "number" and frame == 1)) then
|
|
Tercio@11
|
2670
|
|
Tercio@11
|
2671 CoolTip.Indexes = CoolTip.Indexes + 1
|
|
Tercio@11
|
2672
|
|
Tercio@11
|
2673 if (not CoolTip.IndexesSub [CoolTip.Indexes]) then
|
|
Tercio@11
|
2674 CoolTip.IndexesSub [CoolTip.Indexes] = 0
|
|
Tercio@11
|
2675 end
|
|
Tercio@11
|
2676
|
|
Tercio@11
|
2677 CoolTip.SubIndexes = 0
|
|
Tercio@11
|
2678
|
|
Tercio@11
|
2679 frameTableLeft = CoolTip.LeftTextTable
|
|
Tercio@11
|
2680 frameTableRight = CoolTip.RightTextTable
|
|
Tercio@11
|
2681
|
|
Tercio@11
|
2682 if (CoolTip.isSpecial) then
|
|
Tercio@11
|
2683 lineTable_left = {}
|
|
Tercio@11
|
2684 _table_insert (frameTableLeft, CoolTip.Indexes, lineTable_left)
|
|
Tercio@11
|
2685 lineTable_right = {}
|
|
Tercio@11
|
2686 _table_insert (frameTableRight, CoolTip.Indexes, lineTable_right)
|
|
Tercio@11
|
2687 else
|
|
Tercio@11
|
2688 lineTable_left = frameTableLeft [CoolTip.Indexes]
|
|
Tercio@11
|
2689 lineTable_right = frameTableRight [CoolTip.Indexes]
|
|
Tercio@11
|
2690
|
|
Tercio@11
|
2691 if (not lineTable_left) then
|
|
Tercio@11
|
2692 lineTable_left = {}
|
|
Tercio@11
|
2693 _table_insert (frameTableLeft, CoolTip.Indexes, lineTable_left)
|
|
Tercio@11
|
2694 end
|
|
Tercio@11
|
2695 if (not lineTable_right) then
|
|
Tercio@11
|
2696 lineTable_right = {}
|
|
Tercio@11
|
2697 _table_insert (frameTableRight, CoolTip.Indexes, lineTable_right)
|
|
Tercio@11
|
2698 end
|
|
Tercio@11
|
2699 end
|
|
Tercio@11
|
2700
|
|
Tercio@11
|
2701 elseif ((type (frame) == "string" and frame == "sub") or (type (frame) == "number" and frame == 2)) then
|
|
Tercio@11
|
2702
|
|
Tercio@11
|
2703 CoolTip.SubIndexes = CoolTip.SubIndexes + 1
|
|
Tercio@11
|
2704 CoolTip.IndexesSub [CoolTip.Indexes] = CoolTip.IndexesSub [CoolTip.Indexes] + 1
|
|
Tercio@11
|
2705 CoolTip.HaveSubMenu = true
|
|
Tercio@11
|
2706
|
|
Tercio@11
|
2707 frameTableLeft = CoolTip.LeftTextTableSub
|
|
Tercio@11
|
2708 frameTableRight = CoolTip.RightTextTableSub
|
|
Tercio@11
|
2709
|
|
Tercio@11
|
2710 local subMenuContainerTexts = frameTableLeft [CoolTip.Indexes]
|
|
Tercio@11
|
2711 if (not subMenuContainerTexts) then
|
|
Tercio@11
|
2712 subMenuContainerTexts = {}
|
|
Tercio@11
|
2713 _table_insert (frameTableLeft, CoolTip.Indexes, subMenuContainerTexts)
|
|
Tercio@11
|
2714 end
|
|
Tercio@11
|
2715
|
|
Tercio@11
|
2716 if (CoolTip.isSpecial) then
|
|
Tercio@11
|
2717 lineTable_left = {}
|
|
Tercio@11
|
2718 _table_insert (subMenuContainerTexts, CoolTip.SubIndexes, lineTable_left)
|
|
Tercio@11
|
2719 else
|
|
Tercio@11
|
2720 lineTable_left = subMenuContainerTexts [CoolTip.SubIndexes]
|
|
Tercio@11
|
2721 if (not lineTable_left) then
|
|
Tercio@11
|
2722 lineTable_left = {}
|
|
Tercio@11
|
2723 --subMenuContainerTexts [CoolTip.SubIndexes] = lineTable_left
|
|
Tercio@11
|
2724 _table_insert (subMenuContainerTexts, CoolTip.SubIndexes, lineTable_left)
|
|
Tercio@11
|
2725 end
|
|
Tercio@11
|
2726 end
|
|
Tercio@11
|
2727
|
|
Tercio@11
|
2728 local subMenuContainerTexts = frameTableRight [CoolTip.Indexes]
|
|
Tercio@11
|
2729 if (not subMenuContainerTexts) then
|
|
Tercio@11
|
2730 subMenuContainerTexts = {}
|
|
Tercio@11
|
2731 _table_insert (frameTableRight, CoolTip.Indexes, subMenuContainerTexts)
|
|
Tercio@11
|
2732 --frameTableRight [CoolTip.Indexes] = subMenuContainerTexts
|
|
Tercio@11
|
2733 end
|
|
Tercio@11
|
2734
|
|
Tercio@11
|
2735 if (CoolTip.isSpecial) then
|
|
Tercio@11
|
2736 lineTable_right = {}
|
|
Tercio@11
|
2737 _table_insert (subMenuContainerTexts, CoolTip.SubIndexes, lineTable_right)
|
|
Tercio@11
|
2738 else
|
|
Tercio@11
|
2739 lineTable_right = subMenuContainerTexts [CoolTip.SubIndexes]
|
|
Tercio@11
|
2740 if (not lineTable_right) then
|
|
Tercio@11
|
2741 lineTable_right = {}
|
|
Tercio@11
|
2742 _table_insert (subMenuContainerTexts, CoolTip.SubIndexes, lineTable_right)
|
|
Tercio@11
|
2743 --subMenuContainerTexts [CoolTip.SubIndexes] = lineTable_right
|
|
Tercio@11
|
2744 end
|
|
Tercio@11
|
2745 end
|
|
Tercio@11
|
2746 else
|
|
Tercio@11
|
2747 return --> error
|
|
Tercio@11
|
2748 end
|
|
Tercio@11
|
2749
|
|
Tercio@11
|
2750 lineTable_left [1] = leftText --> line text
|
|
Tercio@11
|
2751 lineTable_left [2] = ColorR1
|
|
Tercio@11
|
2752 lineTable_left [3] = ColorG1
|
|
Tercio@11
|
2753 lineTable_left [4] = ColorB1
|
|
Tercio@11
|
2754 lineTable_left [5] = ColorA1
|
|
Tercio@11
|
2755 lineTable_left [6] = fontSize
|
|
Tercio@11
|
2756 lineTable_left [7] = fontFace
|
|
Tercio@11
|
2757 lineTable_left [8] = fontFlag
|
|
Tercio@11
|
2758
|
|
Tercio@11
|
2759 lineTable_right [1] = rightText --> line text
|
|
Tercio@11
|
2760 lineTable_right [2] = ColorR2
|
|
Tercio@11
|
2761 lineTable_right [3] = ColorG2
|
|
Tercio@11
|
2762 lineTable_right [4] = ColorB2
|
|
Tercio@11
|
2763 lineTable_right [5] = ColorA2
|
|
Tercio@11
|
2764 lineTable_right [6] = fontSize
|
|
Tercio@11
|
2765 lineTable_right [7] = fontFace
|
|
Tercio@11
|
2766 lineTable_right [8] = fontFlag
|
|
Tercio@11
|
2767 end
|
|
Tercio@11
|
2768
|
|
Tercio@11
|
2769 function CoolTip:AddSpecial (widgetType, index, subIndex, ...)
|
|
Tercio@11
|
2770
|
|
Tercio@11
|
2771 local currentIndex = CoolTip.Indexes
|
|
Tercio@11
|
2772 local currentSubIndex = CoolTip.SubIndexes
|
|
Tercio@11
|
2773 CoolTip.isSpecial = true
|
|
Tercio@11
|
2774
|
|
Tercio@11
|
2775 widgetType = string.lower (widgetType)
|
|
Tercio@11
|
2776
|
|
Tercio@11
|
2777 if (widgetType == "line") then
|
|
Tercio@11
|
2778
|
|
Tercio@11
|
2779 if (subIndex) then
|
|
Tercio@11
|
2780 CoolTip.Indexes = index
|
|
Tercio@11
|
2781 CoolTip.SubIndexes = subIndex-1
|
|
Tercio@11
|
2782 else
|
|
Tercio@11
|
2783 CoolTip.Indexes = index-1
|
|
Tercio@11
|
2784 end
|
|
Tercio@11
|
2785
|
|
Tercio@11
|
2786 CoolTip:AddLine (...)
|
|
Tercio@11
|
2787
|
|
Tercio@11
|
2788 if (subIndex) then
|
|
Tercio@11
|
2789 CoolTip.Indexes = currentIndex
|
|
Tercio@11
|
2790 CoolTip.SubIndexes = currentSubIndex+1
|
|
Tercio@11
|
2791 else
|
|
Tercio@11
|
2792 CoolTip.Indexes = currentIndex+1
|
|
Tercio@11
|
2793 end
|
|
Tercio@11
|
2794
|
|
Tercio@11
|
2795 elseif (widgetType == "icon") then
|
|
Tercio@11
|
2796
|
|
Tercio@11
|
2797 CoolTip.Indexes = index
|
|
Tercio@11
|
2798 if (subIndex) then
|
|
Tercio@11
|
2799 CoolTip.SubIndexes = subIndex
|
|
Tercio@11
|
2800 end
|
|
Tercio@11
|
2801
|
|
Tercio@11
|
2802 CoolTip:AddIcon (...)
|
|
Tercio@11
|
2803
|
|
Tercio@11
|
2804 CoolTip.Indexes = currentIndex
|
|
Tercio@11
|
2805 if (subIndex) then
|
|
Tercio@11
|
2806 CoolTip.SubIndexes = currentSubIndex
|
|
Tercio@11
|
2807 end
|
|
Tercio@11
|
2808
|
|
Tercio@11
|
2809 elseif (widgetType == "statusbar") then
|
|
Tercio@11
|
2810
|
|
Tercio@11
|
2811 CoolTip.Indexes = index
|
|
Tercio@11
|
2812 if (subIndex) then
|
|
Tercio@11
|
2813 CoolTip.SubIndexes = subIndex
|
|
Tercio@11
|
2814 end
|
|
Tercio@11
|
2815
|
|
Tercio@11
|
2816 CoolTip:AddStatusBar (...)
|
|
Tercio@11
|
2817
|
|
Tercio@11
|
2818 CoolTip.Indexes = currentIndex
|
|
Tercio@11
|
2819 if (subIndex) then
|
|
Tercio@11
|
2820 CoolTip.SubIndexes = currentSubIndex
|
|
Tercio@11
|
2821 end
|
|
Tercio@11
|
2822
|
|
Tercio@11
|
2823 elseif (widgetType == "menu") then
|
|
Tercio@11
|
2824
|
|
Tercio@11
|
2825 CoolTip.Indexes = index
|
|
Tercio@11
|
2826 if (subIndex) then
|
|
Tercio@11
|
2827 CoolTip.SubIndexes = subIndex
|
|
Tercio@11
|
2828 end
|
|
Tercio@11
|
2829
|
|
Tercio@11
|
2830 CoolTip:AddMenu (...)
|
|
Tercio@11
|
2831
|
|
Tercio@11
|
2832 CoolTip.Indexes = currentIndex
|
|
Tercio@11
|
2833 if (subIndex) then
|
|
Tercio@11
|
2834 CoolTip.SubIndexes = currentSubIndex
|
|
Tercio@11
|
2835 end
|
|
Tercio@11
|
2836
|
|
Tercio@11
|
2837 end
|
|
Tercio@11
|
2838
|
|
Tercio@11
|
2839 CoolTip.isSpecial = false
|
|
Tercio@11
|
2840
|
|
Tercio@11
|
2841 end
|
|
Tercio@11
|
2842
|
|
Tercio@11
|
2843 --> search key: ~fromline
|
|
Tercio@11
|
2844 function CoolTip:AddFromTable (_table)
|
|
Tercio@11
|
2845 for index, menu in _ipairs (_table) do
|
|
Tercio@11
|
2846 if (menu.func) then
|
|
Tercio@11
|
2847 CoolTip:AddMenu (menu.type or 1, menu.func, menu.param1, menu.param2, menu.param3, nil, menu.icon)
|
|
Tercio@11
|
2848 elseif (menu.statusbar) then
|
|
Tercio@11
|
2849 CoolTip:AddStatusBar (menu.value, menu.type or 1, menu.color, true)
|
|
Tercio@11
|
2850 elseif (menu.icon) then
|
|
Tercio@11
|
2851 CoolTip:AddIcon (menu.icon, menu.type or 1, menu.side or 1, menu.width, menu.height, menu.l, menu.r, menu.t, menu.b, menu.color)
|
|
Tercio@11
|
2852 elseif (menu.textleft or menu.textright or menu.text) then
|
|
Tercio@11
|
2853 CoolTip:AddLine (menu.text, "", menu.type, menu.color, menu.color)
|
|
Tercio@11
|
2854 end
|
|
Tercio@11
|
2855 end
|
|
Tercio@11
|
2856 end
|
|
Tercio@11
|
2857
|
|
Tercio@11
|
2858 ----------------------------------------------------------------------
|
|
Tercio@11
|
2859 --> show cooltip
|
|
Tercio@11
|
2860
|
|
Tercio@11
|
2861 --> serach key: ~start
|
|
Tercio@11
|
2862 function CoolTip:Show (frame, menuType, color)
|
|
Tercio@20
|
2863 CoolTip.had_interaction = false
|
|
Tercio@11
|
2864 return CoolTip:ShowCooltip (frame, menuType, color)
|
|
Tercio@11
|
2865 end
|
|
Tercio@11
|
2866
|
|
Tercio@11
|
2867 function CoolTip:ShowCooltip (frame, menuType, color)
|
|
Tercio@11
|
2868
|
|
Tercio@40
|
2869 frame1:SetFrameStrata ("TOOLTIP")
|
|
Tercio@40
|
2870 frame2:SetFrameStrata ("TOOLTIP")
|
|
Tercio@40
|
2871 frame1:SetParent (UIParent)
|
|
Tercio@40
|
2872 frame2:SetParent (UIParent)
|
|
Tercio@40
|
2873
|
|
Tercio@20
|
2874 CoolTip.had_interaction = false
|
|
Tercio@20
|
2875
|
|
Tercio@11
|
2876 if (frame) then
|
|
Tercio@11
|
2877 --> details framework
|
|
Tercio@11
|
2878 if (frame.dframework) then
|
|
Tercio@11
|
2879 frame = frame.widget
|
|
Tercio@11
|
2880 end
|
|
Tercio@11
|
2881 CoolTip:SetHost (frame)
|
|
Tercio@11
|
2882 end
|
|
Tercio@11
|
2883 if (menuType) then
|
|
Tercio@11
|
2884 CoolTip:SetType (menuType)
|
|
Tercio@11
|
2885 end
|
|
Tercio@11
|
2886 if (color) then
|
|
Tercio@11
|
2887 CoolTip:SetColor (1, color)
|
|
Tercio@11
|
2888 CoolTip:SetColor (2, color)
|
|
Tercio@11
|
2889 end
|
|
Tercio@11
|
2890
|
|
Tercio@11
|
2891 if (CoolTip.Type == 1 or CoolTip.Type == 2) then
|
|
Tercio@11
|
2892 return CoolTip:monta_tooltip()
|
|
Tercio@11
|
2893
|
|
Tercio@11
|
2894 elseif (CoolTip.Type == 3) then
|
|
Tercio@11
|
2895 return CoolTip:monta_cooltip()
|
|
Tercio@11
|
2896
|
|
Tercio@11
|
2897 end
|
|
Tercio@11
|
2898 end
|
|
Tercio@11
|
2899
|
|
Tercio@11
|
2900 local emptyOptions = {}
|
|
Tercio@11
|
2901
|
|
Tercio@11
|
2902 function CoolTip:Hide()
|
|
Tercio@11
|
2903 return CoolTip:Close()
|
|
Tercio@11
|
2904 end
|
|
Tercio@11
|
2905
|
|
Tercio@11
|
2906 function CoolTip:Close()
|
|
Tercio@11
|
2907 CoolTip.active = false
|
|
Tercio@11
|
2908 CoolTip.Host = nil
|
|
Tercio@26
|
2909 DF:FadeFrame (frame1, 1)
|
|
Tercio@26
|
2910 DF:FadeFrame (frame2, 1)
|
|
Tercio@11
|
2911 end
|
|
Tercio@11
|
2912
|
|
Tercio@53
|
2913
|
|
Tercio@53
|
2914
|
|
Tercio@11
|
2915 --> old function call
|
|
Tercio@11
|
2916 function CoolTip:ShowMe (host, arg2)
|
|
Tercio@11
|
2917 --> ignore if mouse is up me
|
|
Tercio@11
|
2918 if (CoolTip.mouseOver) then
|
|
Tercio@11
|
2919 return
|
|
Tercio@11
|
2920 end
|
|
Tercio@11
|
2921
|
|
Tercio@11
|
2922 if (not host or not arg2) then --> hideme
|
|
Tercio@11
|
2923 CoolTip:Close()
|
|
Tercio@11
|
2924 end
|
|
Tercio@11
|
2925 end
|
|
Tercio@11
|
2926
|
|
Tercio@11
|
2927 --> search key: ~inject
|
|
Tercio@11
|
2928 function CoolTip:ExecFunc (host, fromClick)
|
|
Tercio@11
|
2929
|
|
Tercio@11
|
2930 if (host.dframework) then
|
|
Tercio@11
|
2931 if (not host.widget.CoolTip) then
|
|
Tercio@11
|
2932 host.widget.CoolTip = host.CoolTip
|
|
Tercio@11
|
2933 end
|
|
Tercio@11
|
2934 host = host.widget
|
|
Tercio@11
|
2935 end
|
|
Tercio@11
|
2936
|
|
Tercio@11
|
2937 CoolTip:Reset()
|
|
Tercio@11
|
2938 CoolTip:SetType (host.CoolTip.Type)
|
|
Tercio@11
|
2939 CoolTip:SetFixedParameter (host.CoolTip.FixedValue)
|
|
Tercio@11
|
2940 CoolTip:SetColor ("main", host.CoolTip.MainColor or "transparent")
|
|
Tercio@11
|
2941 CoolTip:SetColor ("sec", host.CoolTip.SubColor or "transparent")
|
|
Tercio@11
|
2942
|
|
Tercio@11
|
2943 CoolTip:SetOwner (host, host.CoolTip.MyAnchor, host.CoolTip.HisAnchor, host.CoolTip.X, host.CoolTip.Y)
|
|
Tercio@11
|
2944
|
|
Tercio@11
|
2945 local options = host.CoolTip.Options
|
|
Tercio@11
|
2946 if (type (options) == "function") then
|
|
Tercio@11
|
2947 options = options()
|
|
Tercio@11
|
2948 end
|
|
Tercio@11
|
2949 if (options) then
|
|
Tercio@11
|
2950 for optionName, optionValue in pairs (options) do
|
|
Tercio@11
|
2951 CoolTip:SetOption (optionName, optionValue)
|
|
Tercio@11
|
2952 end
|
|
Tercio@11
|
2953 end
|
|
Tercio@11
|
2954
|
|
Tercio@11
|
2955 host.CoolTip.BuildFunc()
|
|
Tercio@11
|
2956
|
|
Tercio@11
|
2957 if (CoolTip.Indexes == 0) then
|
|
Tercio@11
|
2958 if (host.CoolTip.Default) then
|
|
Tercio@11
|
2959 CoolTip:SetType ("tooltip")
|
|
Tercio@11
|
2960 CoolTip:AddLine (host.CoolTip.Default, nil, 1, "white")
|
|
Tercio@11
|
2961 end
|
|
Tercio@11
|
2962 end
|
|
Tercio@11
|
2963
|
|
Tercio@11
|
2964 CoolTip:ShowCooltip()
|
|
Tercio@11
|
2965
|
|
Tercio@11
|
2966 if (fromClick) then
|
|
Tercio@11
|
2967 --UIFrameFlash (frame1, )
|
|
Tercio@11
|
2968 frame1:Flash (0.05, 0.05, 0.2, true, 0, 0)
|
|
Tercio@11
|
2969 end
|
|
Tercio@11
|
2970 end
|
|
Tercio@11
|
2971
|
|
Tercio@11
|
2972 local wait = 0.2
|
|
Tercio@11
|
2973
|
|
Tercio@11
|
2974 local InjectOnUpdateEnter = function (self, elapsed)
|
|
Tercio@11
|
2975 elapsedTime = elapsedTime+elapsed
|
|
Tercio@11
|
2976 if (elapsedTime > wait) then
|
|
Tercio@11
|
2977 self:SetScript ("OnUpdate", nil)
|
|
Tercio@11
|
2978 CoolTip:ExecFunc (self)
|
|
Tercio@11
|
2979 end
|
|
Tercio@11
|
2980 end
|
|
Tercio@11
|
2981
|
|
Tercio@11
|
2982 local InjectOnUpdateLeave = function (self, elapsed)
|
|
Tercio@11
|
2983 elapsedTime = elapsedTime+elapsed
|
|
Tercio@11
|
2984 if (elapsedTime > 0.2) then
|
|
Tercio@11
|
2985 if (not CoolTip.mouseOver and not CoolTip.buttonOver and self == CoolTip.Host) then
|
|
Tercio@11
|
2986 CoolTip:ShowMe (false)
|
|
Tercio@11
|
2987 end
|
|
Tercio@11
|
2988 self:SetScript ("OnUpdate", nil)
|
|
Tercio@11
|
2989 end
|
|
Tercio@11
|
2990 end
|
|
Tercio@11
|
2991
|
|
Tercio@11
|
2992 local InjectOnLeave = function (self)
|
|
Tercio@11
|
2993 CoolTip.buttonOver = false
|
|
Tercio@11
|
2994
|
|
Tercio@11
|
2995 if (CoolTip.active) then
|
|
Tercio@11
|
2996 elapsedTime = 0
|
|
Tercio@11
|
2997 self:SetScript ("OnUpdate", InjectOnUpdateLeave)
|
|
Tercio@11
|
2998 else
|
|
Tercio@11
|
2999 self:SetScript ("OnUpdate", nil)
|
|
Tercio@11
|
3000 end
|
|
Tercio@11
|
3001
|
|
Tercio@11
|
3002 if (self.CoolTip.OnLeaveFunc) then
|
|
Tercio@11
|
3003 self.CoolTip.OnLeaveFunc (self)
|
|
Tercio@11
|
3004 end
|
|
Tercio@11
|
3005
|
|
Tercio@11
|
3006 if (self.OldOnLeaveScript) then
|
|
Tercio@11
|
3007 self:OldOnLeaveScript()
|
|
Tercio@11
|
3008 end
|
|
Tercio@11
|
3009 end
|
|
Tercio@11
|
3010
|
|
Tercio@11
|
3011 local InjectOnEnter = function (self)
|
|
Tercio@11
|
3012 CoolTip.buttonOver = true
|
|
Tercio@11
|
3013 if (CoolTip.active) then
|
|
Tercio@11
|
3014 CoolTip:ExecFunc (self)
|
|
Tercio@11
|
3015 else
|
|
Tercio@11
|
3016 elapsedTime = 0
|
|
Tercio@11
|
3017 wait = self.CoolTip.ShowSpeed or 0.2
|
|
Tercio@11
|
3018 self:SetScript ("OnUpdate", InjectOnUpdateEnter)
|
|
Tercio@11
|
3019 end
|
|
Tercio@11
|
3020
|
|
Tercio@11
|
3021 if (self.CoolTip.OnEnterFunc) then
|
|
Tercio@11
|
3022 self.CoolTip.OnEnterFunc (self)
|
|
Tercio@11
|
3023 end
|
|
Tercio@11
|
3024
|
|
Tercio@11
|
3025 if (self.OldOnEnterScript) then
|
|
Tercio@11
|
3026 self:OldOnEnterScript()
|
|
Tercio@11
|
3027 end
|
|
Tercio@11
|
3028 end
|
|
Tercio@11
|
3029
|
|
Tercio@11
|
3030 function CoolTip:CoolTipInject (host, openOnClick)
|
|
Tercio@11
|
3031 if (host.dframework) then
|
|
Tercio@11
|
3032 if (not host.widget.CoolTip) then
|
|
Tercio@11
|
3033 host.widget.CoolTip = host.CoolTip
|
|
Tercio@11
|
3034 end
|
|
Tercio@11
|
3035 host = host.widget
|
|
Tercio@11
|
3036 end
|
|
Tercio@11
|
3037
|
|
Tercio@11
|
3038 local coolTable = host.CoolTip
|
|
Tercio@11
|
3039 if (not coolTable) then
|
|
Tercio@11
|
3040 print ("Host nao tem uma CoolTable.")
|
|
Tercio@11
|
3041 return false
|
|
Tercio@11
|
3042 end
|
|
Tercio@11
|
3043
|
|
Tercio@11
|
3044 host.OldOnEnterScript = host:GetScript ("OnEnter")
|
|
Tercio@11
|
3045 host.OldOnLeaveScript = host:GetScript ("OnLeave")
|
|
Tercio@11
|
3046
|
|
Tercio@11
|
3047 host:SetScript ("OnEnter", InjectOnEnter)
|
|
Tercio@11
|
3048 host:SetScript ("OnLeave", InjectOnLeave)
|
|
Tercio@11
|
3049
|
|
Tercio@11
|
3050 if (openOnClick) then
|
|
Tercio@11
|
3051 if (host:GetObjectType() == "Button") then
|
|
Tercio@11
|
3052 host:SetScript ("OnClick", function() CoolTip:ExecFunc (host, true) end)
|
|
Tercio@11
|
3053 end
|
|
Tercio@11
|
3054 end
|
|
Tercio@11
|
3055
|
|
Tercio@11
|
3056 return ture
|
|
Tercio@11
|
3057 end
|
|
Tercio@11
|
3058
|
|
Tercio@11
|
3059 --> all done
|
|
Tercio@11
|
3060 CoolTip:ClearAllOptions()
|
|
Tercio@11
|
3061
|
|
Tercio@39
|
3062 -- local preset2_backdrop = {bgFile = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]], edgeFile = DF.folder .. "border_3", tile=true,
|
|
Tercio@39
|
3063 -- edgeSize = 16, tileSize = 64, insets = {left = 3, right = 3, top = 4, bottom = 4}}
|
|
Tercio@11
|
3064
|
|
Tercio@39
|
3065 local preset2_backdrop = {bgFile = DF.folder .. "background", edgeFile = [[Interface\Buttons\WHITE8X8]], tile = true,
|
|
Tercio@39
|
3066 edgeSize = 1, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}}
|
|
Tercio@39
|
3067 local default_backdrop_color = {0.09019, 0.09019, 0.18823, 0.8}
|
|
Tercio@39
|
3068 local default_backdropborder_color = {1, 1, 1, 1}
|
|
Tercio@39
|
3069
|
|
Tercio@39
|
3070 local gray_table = {0.37, 0.37, 0.37, 0.95}
|
|
Tercio@11
|
3071 local white_table = {1, 1, 1, 1}
|
|
Tercio@39
|
3072 local black_table = {0.2, 0.2, 0.2, 1}
|
|
Tercio@11
|
3073
|
|
Tercio@11
|
3074 function CoolTip:Preset (number)
|
|
Tercio@11
|
3075 self:Reset()
|
|
Tercio@11
|
3076
|
|
Tercio@11
|
3077 if (number == 1) then
|
|
Tercio@11
|
3078 self:SetOption ("TextFont", "Friz Quadrata TT")
|
|
Tercio@11
|
3079 self:SetOption ("TextColor", "orange")
|
|
Tercio@11
|
3080 self:SetOption ("TextSize", 12)
|
|
Tercio@11
|
3081 self:SetOption ("ButtonsYMod", -4)
|
|
Tercio@11
|
3082 self:SetOption ("YSpacingMod", -4)
|
|
Tercio@11
|
3083 self:SetOption ("IgnoreButtonAutoHeight", true)
|
|
Tercio@11
|
3084 self:SetColor (1, 0.5, 0.5, 0.5, 0.5)
|
|
Tercio@11
|
3085
|
|
Tercio@11
|
3086 elseif (number == 2) then
|
|
Tercio@11
|
3087 self:SetOption ("TextFont", "Friz Quadrata TT")
|
|
Tercio@11
|
3088 self:SetOption ("TextColor", "orange")
|
|
Tercio@11
|
3089 self:SetOption ("TextSize", 12)
|
|
Tercio@11
|
3090 self:SetOption ("FixedWidth", 220)
|
|
Tercio@11
|
3091 self:SetOption ("ButtonsYMod", -4)
|
|
Tercio@11
|
3092 self:SetOption ("YSpacingMod", -4)
|
|
Tercio@11
|
3093 self:SetOption ("IgnoreButtonAutoHeight", true)
|
|
Tercio@11
|
3094
|
|
Tercio@39
|
3095 self:SetColor (1, 0.5, 0.5, 0.5, 0)
|
|
Tercio@39
|
3096
|
|
Tercio@39
|
3097 self:SetBackdrop (1, preset2_backdrop, gray_table, black_table)
|
|
Tercio@40
|
3098 self:SetBackdrop (2, preset2_backdrop, gray_table, black_table)
|
|
Tercio@11
|
3099 end
|
|
Tercio@11
|
3100 end
|
|
Tercio@11
|
3101
|
|
Tercio@11
|
3102 return CoolTip
|
|
Tercio@11
|
3103
|
|
Tercio@11
|
3104 end
|
|
Tercio@11
|
3105
|
|
Tercio@11
|
3106 DF:CreateCoolTip() |