comparison Modules/MinimapIcon.lua @ 203:585cfb690080

Added a minimap icon.
author Zerotorescue
date Sat, 05 Feb 2011 19:34:33 +0100
parents
children 8cecfea6a254
comparison
equal deleted inserted replaced
202:15f22a466596 203:585cfb690080
1 local addon = select(2, ...);
2 local mod = addon:NewModule("MinimapIcon");
3
4 function mod:OnEnable()
5 self:Make();
6 end
7
8 function mod:Make()
9 local ldb = LibStub("LibDataBroker-1.1");
10
11 local dataobject = ldb:GetDataObjectByName("Inventorium") or ldb:NewDataObject("Inventorium", {
12 ["type"] = "launcher",
13 ["label"] = "Inventorium",
14 ["icon"] = [[Interface\Icons\INV_Misc_Bag_15]],
15 ["OnClick"] = function(frame, button)
16 if button == "RightButton" then
17 -- Open up the config
18 InventoriumCommandHandler("config");
19 elseif button == "LeftButton" then
20 -- Open the summary
21 InventoriumCommandHandler("summary");
22 elseif button == "MiddleButton" then
23 -- Check stock and provide the alert if needed
24 InventoriumCommandHandler("alert");
25 end
26 end,
27 ["OnTooltipShow"] = function(tooltip)
28 tooltip:AddLine("Inventorium");
29 tooltip:AddLine(" ");
30 tooltip:AddLine("|cfffed000Left-click|r to open the summary window.", 0, 1, 0);
31 tooltip:AddLine("|cfffed000Middle-click|r to generate a stock alert.", 0, 1, 0);
32 tooltip:AddLine("|cfffed000Right-click|r to open the config window.", 0, 1, 0);
33 end,
34 });
35
36 local icon = LibStub("LibDBIcon-1.0");
37 if icon then
38 icon:Register("Inventorium", dataobject);
39 end
40 end