view Modules/TalkingHead.lua @ 121:1f68c46bc4de

BuffFrame: - Added interface framework for selectively hiding certain buff's auxiliary values.
author Nenue
date Mon, 17 Jul 2017 11:51:31 -0400
parents 1196c2bad31c
children ea2c616a3b4f
line wrap: on
line source
-- Veneer
-- TalkingHead.lua
-- Created: 10/23/2016 5:18 AM
-- %file-revision%
--

local print = DEVIAN_WORKSPACE and function(...) print('VnTalkingHead', ...) end or nop
local thf = TalkingHeadFrame
local m = {

  anchorPoint = 'BOTTOMLEFT',
  anchorFrom = 'TOPLEFT',
  anchorX = -4,
  anchorY = 96,
  anchorFrame = 'ChatFrame1',

}
VeneerTalkingHeadMixin = m

local qf = {}


function m:OnLoad()
  Veneer:AddHandler(self, self.anchorPoint)
  -- force this so we can implant
  LoadAddOn('Blizzard_TalkingHeadUI')
  thf = TalkingHeadFrame
end

function m:Setup()
  print('|cFF00AAFF'..self:GetName()..'|r:Setup()', thf:IsShown(), self:IsShown())

  self:SetSize(thf:GetSize())

  hooksecurefunc(thf, 'SetPoint', function(...)
    print('SetPoint', ...)
    print(debugstack())
  end)

  self:SetShown(true)
  self:ClearAnchor()
end

function m:ClearAnchor()

  UIPARENT_MANAGED_FRAME_POSITIONS["TalkingHeadFrame"] = nil
  for i, alertSubSystem in pairs(AlertFrame.alertFrameSubSystems) do
    if alertSubSystem.anchorFrame == thf then
      tremove(AlertFrame.alertFrameSubSystems, i)
      return
    end
  end
end

function m:OnShow()
  if thf then
    print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', thf:IsShown(), self:IsShown())
    print(debugstack())
    self:Update()
  end
end

function m:Reanchor()
  self:ClearAllPoints()
  self:SetPoint('BOTTOMLEFT', _G[self.anchorFrame], 'TOPLEFT', -4, 24)
  self:SetPoint('RIGHT', _G[self.anchorFrame], 'RIGHT', 2, 0)
  -- independent module,
end

function m:OnHide()
  if thf then
    print('|cFF00AAFF'..self:GetName()..'|r:OnHide()', thf:IsShown(), self:IsShown())
  end
  Veneer:Reanchor()
end

function m:Update()

  print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', thf:IsShown(), self:IsShown())
  thf:ClearAllPoints()
  thf:SetAllPoints(self)

  Veneer:InternalReanchor(self)
end