view modules/FuBar_ReActionFu/FuBar_ReActionFu.lua @ 30:0d95ce7a9ec2

- added Ace3 externs - converted ReAction_ConfigUI to use blizzard interface addons panel via AceConfigDialog-3.0 - partially converted FuBar module to LibRock, deprecated it (going to remove it entirely later) - cleaned up a couple other tidbits
author Flick <flickerstreak@gmail.com>
date Wed, 02 Apr 2008 23:31:13 +0000
parents 21bcaf8215ff
children
line wrap: on
line source
--[[
  FuBar plugin module for ReAction

--]]

-- local imports
local ReAction = ReAction

-- module declaration
local moduleID = "ReActionFu"
local module = ReAction:NewModule( moduleID,
  "FuBarPlugin-3.0"
)

local fubarOptions = {
  iconPath = "Interface\\Icons\\INV_Qiraj_JewelEncased",
  hasNoColor = true,
  tooltipType = "Tablet-2.0",
  configType = "Dewdrop-2.0",
  hasNoText = true,
  defaultPosition = "LEFT",
  defaultMinimapPosition = 240, -- degrees
  clickableTooltip = false,
  independentProfile = true
  cannotDetachTooltip = true
  hideMenuTitle = true
}

function module:OnInitialize()
  self.db = ReAction.db:RegisterNamespace(moduleID,
    {
      profile = {
        requireFuBar = false
      }
    }
  )
  self.db.RegisterCallback(self,"OnProfileChanged")

  if self.db.profile.requireFuBar == true then
    self:Hide()
  end

  self.OnMenuRequest = {
    type = "group",
    handler = ReAction,
    args = {
      -- include profile management by default
      profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(ReAction.db)
    }
  }

  -- insert each module's registered global opts into the table top level
  local opts = self.OnMenuRequest
  for m, tbl in pairs(ReAction:GetOptions("global")) do
    if tbl.args then
      for k, v in pairs(tbl.args) do
        opts.args[k] = v
      end
    end
  end

  -- listen for new module adds
  ReAction.RegisterCallback(self, "OnOptionsRegistered")

  -- configure FuBarPlugin
  for k, v in pairs(fubarOptions) do
    self:SetFuBarOption(k,v)
  end
end

function module:OnProfileChanged()
  if self.db.profile.requireFuBar == true then
    module:Hide()
  else
    self:Show()
  end
end

function module:OnOptionsRegistered( evtName, context, module, opts )
  if context == "global" then
    if opts.args then
      for k, v in pairs(tbl.args) do
        opts.args[k] = v
      end
    end
  end
end

function module:OnFuBarClick(button)
  -- TODO:
  -- alt, shift, ctrl clicks
end

function module:OnUpdateFuBarTooltip()
  -- TODO:
  -- display status of config mode, keybind mode, etc
end