annotate Modules/MinimapIcon.lua @ 203:585cfb690080

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