# HG changeset patch # User Zerotorescue # Date 1296930873 -3600 # Node ID 585cfb69008029342cce1fbaa7ee7501c851e551 # Parent 15f22a466596fdee65363fca719d1c4bae743610 Added a minimap icon. diff -r 15f22a466596 -r 585cfb690080 Inventorium.toc --- a/Inventorium.toc Sat Feb 05 17:36:08 2011 +0100 +++ b/Inventorium.toc Sat Feb 05 19:34:33 2011 +0100 @@ -24,6 +24,7 @@ # Modules Modules\Alerts.lua Modules\Config.lua +Modules\MinimapIcon.lua Modules\Mover.lua Modules\Scanner.lua Modules\Summary.lua diff -r 15f22a466596 -r 585cfb690080 Modules/MinimapIcon.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Modules/MinimapIcon.lua Sat Feb 05 19:34:33 2011 +0100 @@ -0,0 +1,40 @@ +local addon = select(2, ...); +local mod = addon:NewModule("MinimapIcon"); + +function mod:OnEnable() + self:Make(); +end + +function mod:Make() + local ldb = LibStub("LibDataBroker-1.1"); + + local dataobject = ldb:GetDataObjectByName("Inventorium") or ldb:NewDataObject("Inventorium", { + ["type"] = "launcher", + ["label"] = "Inventorium", + ["icon"] = [[Interface\Icons\INV_Misc_Bag_15]], + ["OnClick"] = function(frame, button) + if button == "RightButton" then + -- Open up the config + InventoriumCommandHandler("config"); + elseif button == "LeftButton" then + -- Open the summary + InventoriumCommandHandler("summary"); + elseif button == "MiddleButton" then + -- Check stock and provide the alert if needed + InventoriumCommandHandler("alert"); + end + end, + ["OnTooltipShow"] = function(tooltip) + tooltip:AddLine("Inventorium"); + tooltip:AddLine(" "); + tooltip:AddLine("|cfffed000Left-click|r to open the summary window.", 0, 1, 0); + tooltip:AddLine("|cfffed000Middle-click|r to generate a stock alert.", 0, 1, 0); + tooltip:AddLine("|cfffed000Right-click|r to open the config window.", 0, 1, 0); + end, + }); + + local icon = LibStub("LibDBIcon-1.0"); + if icon then + icon:Register("Inventorium", dataobject); + end +end