annotate Modules/MinimapIcon.lua @ 209:1ed7ce9b1c5d

Cleaned up Queue; errors should now stop a queue all loop rather than occur at every single group.
author Zerotorescue
date Sat, 05 Feb 2011 20:09:03 +0100
parents 8cecfea6a254
children 1959e2b3dfe1
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@208 20 if IsControlKeyDown() then
Zerotorescue@208 21 -- Queue
Zerotorescue@208 22 InventoriumCommandHandler("queue");
Zerotorescue@208 23 else
Zerotorescue@208 24 -- Open the summary
Zerotorescue@208 25 InventoriumCommandHandler("summary");
Zerotorescue@208 26 end
Zerotorescue@203 27 elseif button == "MiddleButton" then
Zerotorescue@203 28 -- Check stock and provide the alert if needed
Zerotorescue@203 29 InventoriumCommandHandler("alert");
Zerotorescue@203 30 end
Zerotorescue@203 31 end,
Zerotorescue@203 32 ["OnTooltipShow"] = function(tooltip)
Zerotorescue@203 33 tooltip:AddLine("Inventorium");
Zerotorescue@203 34 tooltip:AddLine(" ");
Zerotorescue@203 35 tooltip:AddLine("|cfffed000Left-click|r to open the summary window.", 0, 1, 0);
Zerotorescue@203 36 tooltip:AddLine("|cfffed000Middle-click|r to generate a stock alert.", 0, 1, 0);
Zerotorescue@203 37 tooltip:AddLine("|cfffed000Right-click|r to open the config window.", 0, 1, 0);
Zerotorescue@208 38 tooltip:AddLine("|cfffed000Control left-click|r to try to queue tracked items.", 0, 1, 0);
Zerotorescue@203 39 end,
Zerotorescue@203 40 });
Zerotorescue@203 41
Zerotorescue@203 42 local icon = LibStub("LibDBIcon-1.0");
Zerotorescue@208 43 if icon and not icon:IsRegistered("Inventorium") then
Zerotorescue@203 44 icon:Register("Inventorium", dataobject);
Zerotorescue@203 45 end
Zerotorescue@203 46 end