----------------------------
-- Sphere Tooltip Creator --
----------------------------
local addon, ns = ...
local ss = ns.SS

local setmetatable = setmetatable
local CreateFrame, ToggleDropDownMenu = CreateFrame, ToggleDropDownMenu
local PetFrameDropDown, TargetFrameDropDown, PlayerFrameDropDown = PetFrameDropDown, TargetFrameDropDown, PlayerFrameDropDown

local mtTooltipInfo = {};

function mtTooltipInfo:New(unit)
  if unit and unit == "pet" then
    return CreateFrame("GameTooltip", ss._f.."PetToolTip", nil, "GameToolTipTemplate")
  elseif unit and unit == "target" then
    return CreateFrame("GameTooltip", ss._f.."TargetToolTip", nil, "GameToolTipTemplate")
  else
    return CreateFrame("GameTooltip", ss._f.."PlayerToolTip", nil, "GameToolTipTemplate")
  end
end

ss["TooltipInfo"] = setmetatable({}, { __index = mtTooltipInfo });

local mtMenuInfo = {};

function mtMenuInfo:New(unit)
  if unit and unit == "pet" then
    return function(sphere) ToggleDropDownMenu(1, 1, PetFrameDropDown, "cursor", 0 ,0) end
  elseif unit and unit == "target" then
    return function(sphere) ToggleDropDownMenu(1, 1, TargetFrameDropDown, "cursor", 0 ,0) end
  else
    return function(sphere) ToggleDropDownMenu(1, 1, PlayerFrameDropDown, "cursor", 0 ,0) end
  end
end

ss["MenuInfo"] = setmetatable({}, { __index = mtMenuInfo });

local mtGeneralTooltip = {};

function mtGeneralTooltip:New(index, region)
  region = region or ""

  local tooltip = CreateFrame("GameTooltip", ss._f..region.."MicroSphereTooltip"..index, nil, "GameToolTipTemplate")
  tooltip.FontString1 = tooltip:CreateFontString("FontString1")
  tooltip.FontString1:SetFont(ss.private.font.general, 16)

  return tooltip
end

ss["GeneralTooltip"] = setmetatable({}, { __index = mtGeneralTooltip });
