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","PetToolTip",nil,"GameToolTipTemplate")
  elseif unit and unit == "target" then
    return CreateFrame("GameTooltip","TargetToolTip",nil,"GameToolTipTemplate")
  else
    return CreateFrame("GameTooltip","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",region.."SSMicroSphereTooltip"..index,nil,"GameToolTipTemplate")
  tooltip.FontString1 = tooltip:CreateFontString("FontString1")
  tooltip.FontString1:SetFont(ss.private.font["general"], 16)

  return tooltip
end

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