Mercurial > wow > inventory
comparison Modules/MinimapIcon.lua @ 210:1959e2b3dfe1
You can now toggle the minimap icon in the ?Extra? config category.
| author | Zerotorescue |
|---|---|
| date | Sat, 05 Feb 2011 20:28:55 +0100 |
| parents | 8cecfea6a254 |
| children |
comparison
equal
deleted
inserted
replaced
| 209:1ed7ce9b1c5d | 210:1959e2b3dfe1 |
|---|---|
| 1 local addon = select(2, ...); | 1 local addon = select(2, ...); |
| 2 local mod = addon:NewModule("MinimapIcon"); | 2 local mod = addon:NewModule("MinimapIcon"); |
| 3 | 3 |
| 4 local icon; | |
| 5 | |
| 4 function mod:OnEnable() | 6 function mod:OnEnable() |
| 5 self:Make(); | 7 if addon.db.profile.defaults.minimapIcon then |
| 8 self:MakeIcon(); | |
| 9 end | |
| 6 end | 10 end |
| 7 | 11 |
| 8 function mod:Make() | 12 function mod:MakeIcon() |
| 13 icon = LibStub("LibDBIcon-1.0"); | |
| 14 | |
| 9 local ldb = LibStub("LibDataBroker-1.1"); | 15 local ldb = LibStub("LibDataBroker-1.1"); |
| 10 | 16 |
| 11 local dataobject = ldb:GetDataObjectByName("Inventorium") or ldb:NewDataObject("Inventorium", { | 17 local dataobject = ldb:GetDataObjectByName("Inventorium") or ldb:NewDataObject("Inventorium", { |
| 12 ["type"] = "launcher", | 18 ["type"] = "launcher", |
| 13 ["label"] = "Inventorium", | 19 ["label"] = "Inventorium", |
| 37 tooltip:AddLine("|cfffed000Right-click|r to open the config window.", 0, 1, 0); | 43 tooltip:AddLine("|cfffed000Right-click|r to open the config window.", 0, 1, 0); |
| 38 tooltip:AddLine("|cfffed000Control left-click|r to try to queue tracked items.", 0, 1, 0); | 44 tooltip:AddLine("|cfffed000Control left-click|r to try to queue tracked items.", 0, 1, 0); |
| 39 end, | 45 end, |
| 40 }); | 46 }); |
| 41 | 47 |
| 42 local icon = LibStub("LibDBIcon-1.0"); | |
| 43 if icon and not icon:IsRegistered("Inventorium") then | 48 if icon and not icon:IsRegistered("Inventorium") then |
| 44 icon:Register("Inventorium", dataobject); | 49 icon:Register("Inventorium", dataobject); |
| 45 end | 50 end |
| 46 end | 51 end |
| 52 | |
| 53 function mod:ShowIcon() | |
| 54 if not icon then | |
| 55 self:MakeIcon(); | |
| 56 else | |
| 57 icon:Show("Inventorium"); | |
| 58 end | |
| 59 end | |
| 60 | |
| 61 function mod:HideIcon() | |
| 62 if icon then | |
| 63 icon:Hide("Inventorium"); | |
| 64 end | |
| 65 end |
