flickerstreak@23: --[[ flickerstreak@23: FuBar plugin module for ReAction flickerstreak@23: flickerstreak@23: --]] flickerstreak@23: flickerstreak@23: -- local imports flickerstreak@23: local ReAction = ReAction flickerstreak@23: flickerstreak@23: -- module declaration flickerstreak@23: local moduleID = "ReActionFu" flickerstreak@30: local module = ReAction:NewModule( moduleID, flickerstreak@30: "FuBarPlugin-3.0" flickerstreak@30: ) flickerstreak@23: flickerstreak@30: local fubarOptions = { flickerstreak@30: iconPath = "Interface\\Icons\\INV_Qiraj_JewelEncased", flickerstreak@30: hasNoColor = true, flickerstreak@30: tooltipType = "Tablet-2.0", flickerstreak@30: configType = "Dewdrop-2.0", flickerstreak@30: hasNoText = true, flickerstreak@30: defaultPosition = "LEFT", flickerstreak@30: defaultMinimapPosition = 240, -- degrees flickerstreak@30: clickableTooltip = false, flickerstreak@30: independentProfile = true flickerstreak@30: cannotDetachTooltip = true flickerstreak@30: hideMenuTitle = true flickerstreak@30: } flickerstreak@23: flickerstreak@30: function module:OnInitialize() flickerstreak@28: self.db = ReAction.db:RegisterNamespace(moduleID, flickerstreak@23: { flickerstreak@28: profile = { flickerstreak@28: requireFuBar = false flickerstreak@28: } flickerstreak@23: } flickerstreak@23: ) flickerstreak@28: self.db.RegisterCallback(self,"OnProfileChanged") flickerstreak@23: flickerstreak@23: if self.db.profile.requireFuBar == true then flickerstreak@23: self:Hide() flickerstreak@23: end flickerstreak@23: flickerstreak@30: self.OnMenuRequest = { flickerstreak@30: type = "group", flickerstreak@30: handler = ReAction, flickerstreak@30: args = { flickerstreak@30: -- include profile management by default flickerstreak@30: profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(ReAction.db) flickerstreak@30: } flickerstreak@30: } flickerstreak@30: flickerstreak@30: -- insert each module's registered global opts into the table top level flickerstreak@30: local opts = self.OnMenuRequest flickerstreak@30: for m, tbl in pairs(ReAction:GetOptions("global")) do flickerstreak@30: if tbl.args then flickerstreak@30: for k, v in pairs(tbl.args) do flickerstreak@30: opts.args[k] = v flickerstreak@30: end flickerstreak@30: end flickerstreak@30: end flickerstreak@30: flickerstreak@30: -- listen for new module adds flickerstreak@30: ReAction.RegisterCallback(self, "OnOptionsRegistered") flickerstreak@30: flickerstreak@30: -- configure FuBarPlugin flickerstreak@30: for k, v in pairs(fubarOptions) do flickerstreak@30: self:SetFuBarOption(k,v) flickerstreak@30: end flickerstreak@23: end flickerstreak@23: flickerstreak@30: function module:OnProfileChanged() flickerstreak@23: if self.db.profile.requireFuBar == true then flickerstreak@28: module:Hide() flickerstreak@23: else flickerstreak@23: self:Show() flickerstreak@23: end flickerstreak@23: end flickerstreak@23: flickerstreak@30: function module:OnOptionsRegistered( evtName, context, module, opts ) flickerstreak@30: if context == "global" then flickerstreak@30: if opts.args then flickerstreak@30: for k, v in pairs(tbl.args) do flickerstreak@30: opts.args[k] = v flickerstreak@28: end flickerstreak@23: end flickerstreak@23: end flickerstreak@23: end flickerstreak@23: flickerstreak@30: function module:OnFuBarClick(button) flickerstreak@30: -- TODO: flickerstreak@30: -- alt, shift, ctrl clicks flickerstreak@30: end flickerstreak@30: flickerstreak@30: function module:OnUpdateFuBarTooltip() flickerstreak@30: -- TODO: flickerstreak@30: -- display status of config mode, keybind mode, etc flickerstreak@30: end flickerstreak@30: