-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
LDB.lua
87 lines (70 loc) · 1.91 KB
/
LDB.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
-- --------------------
-- TellMeWhen
-- Originally by NephMakes
-- Other contributions by:
-- Sweetmms of Blackrock, Oozebull of Twisting Nether, Oodyboo of Mug'thol,
-- Banjankri of Blackrock, Predeter of Proudmoore, Xenyr of Aszune
-- Currently maintained by
-- Cybeloras of Aerie Peak
-- --------------------
local TMW = TMW
local L = TMW.L
local print = TMW.print
function TellMeWhen_OnAddonCompartmentClick(addonName, button)
if not TMW then return end
if button == "RightButton" then
TMW:SlashCommand("options")
else
TMW:LockToggle()
end
end
function TellMeWhen_AddonCompartmentFuncOnEnter(name, btn)
local f
if btn and type(btn[0]) == "userdata" then
-- MAYBE WORKS IN TWW - Addon compartment onEnter functions seem to currently not be called
f = btn
elseif GetMouseFocus then
f = GetMouseFocus()
while f and not f.dropdown do
f = f:GetParent()
end
end
if not f then return end
GameTooltip:SetOwner(f, "ANCHOR_NONE")
GameTooltip:SetPoint("TOPRIGHT", f, "TOPLEFT", 0, 0)
if not TMW then
GameTooltip:AddLine("TellMeWhen failed to load.")
GameTooltip:Show()
return
end
GameTooltip:AddLine("TellMeWhen")
GameTooltip:AddLine(L["LDB_TOOLTIP1"])
GameTooltip:AddLine(L["LDB_TOOLTIP2"])
GameTooltip:Show()
end
function TellMeWhen_AddonCompartmentFuncOnLeave()
GameTooltip:Hide()
end
if not TMW then return end
local ldb = LibStub("LibDataBroker-1.1")
local dataobj = ldb:GetDataObjectByName("TellMeWhen") or
ldb:NewDataObject("TellMeWhen", {
type = "launcher",
icon = "Interface\\Addons\\TellMeWhen\\Textures\\LDB Icon",
})
dataobj.OnClick = function(self, button)
if not TMW.Initialized then
TMW:Print(L["ERROR_NOTINITIALIZED_NO_ACTION"])
return
end
if button == "RightButton" then
TMW:SlashCommand("options")
else
TMW:LockToggle()
end
end
dataobj.OnTooltipShow = function(tt)
tt:AddLine("TellMeWhen")
tt:AddLine(L["LDB_TOOLTIP1"])
tt:AddLine(L["LDB_TOOLTIP2"])
end