diff 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 diff
--- a/Modules/TalkingHead.lua	Sun Jun 04 18:20:40 2017 -0400
+++ b/Modules/TalkingHead.lua	Mon Jul 17 11:51:31 2017 -0400
@@ -5,32 +5,34 @@
 --
 
 local print = DEVIAN_WORKSPACE and function(...) print('VnTalkingHead', ...) end or nop
-
-VeneerTalkingHeadMixin = {
+local thf = TalkingHeadFrame
+local m = {
 
   anchorPoint = 'BOTTOMLEFT',
   anchorFrom = 'TOPLEFT',
   anchorX = -4,
   anchorY = 96,
   anchorFrame = 'ChatFrame1',
-  addonTrigger = 'Blizzard_TalkingHeadUI'
 
 }
+VeneerTalkingHeadMixin = m
 
 local qf = {}
 
 
-function VeneerTalkingHeadMixin:OnLoad()
+function m:OnLoad()
   Veneer:AddHandler(self, self.anchorPoint)
+  -- force this so we can implant
+  LoadAddOn('Blizzard_TalkingHeadUI')
+  thf = TalkingHeadFrame
 end
 
-function VeneerTalkingHeadMixin:Setup()
-  print('|cFF00AAFF'..self:GetName()..'|r:Setup()', TalkingHeadFrame:IsShown(), self:IsShown())
+function m:Setup()
+  print('|cFF00AAFF'..self:GetName()..'|r:Setup()', thf:IsShown(), self:IsShown())
 
-  self:SetSize(TalkingHeadFrame:GetSize())
-  self:SetParent(TalkingHeadFrame)
+  self:SetSize(thf:GetSize())
 
-  hooksecurefunc(TalkingHeadFrame, 'SetPoint', function(...)
+  hooksecurefunc(thf, 'SetPoint', function(...)
     print('SetPoint', ...)
     print(debugstack())
   end)
@@ -39,44 +41,44 @@
   self:ClearAnchor()
 end
 
-function VeneerTalkingHeadMixin:ClearAnchor()
+function m:ClearAnchor()
 
   UIPARENT_MANAGED_FRAME_POSITIONS["TalkingHeadFrame"] = nil
   for i, alertSubSystem in pairs(AlertFrame.alertFrameSubSystems) do
-    if alertSubSystem.anchorFrame == TalkingHeadFrame then
+    if alertSubSystem.anchorFrame == thf then
       tremove(AlertFrame.alertFrameSubSystems, i)
       return
     end
   end
 end
 
-function VeneerTalkingHeadMixin:OnShow()
-  if TalkingHeadFrame then
-    print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', TalkingHeadFrame:IsShown(), self:IsShown())
+function m:OnShow()
+  if thf then
+    print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', thf:IsShown(), self:IsShown())
     print(debugstack())
     self:Update()
   end
 end
 
-function VeneerTalkingHeadMixin:Reanchor()
+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 VeneerTalkingHeadMixin:OnHide()
-  if TalkingHeadFrame then
-    print('|cFF00AAFF'..self:GetName()..'|r:OnHide()', TalkingHeadFrame:IsShown(), self:IsShown())
+function m:OnHide()
+  if thf then
+    print('|cFF00AAFF'..self:GetName()..'|r:OnHide()', thf:IsShown(), self:IsShown())
   end
   Veneer:Reanchor()
 end
 
-function VeneerTalkingHeadMixin:Update()
+function m:Update()
 
-  print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', TalkingHeadFrame:IsShown(), self:IsShown())
-  TalkingHeadFrame:ClearAllPoints()
-  TalkingHeadFrame:SetAllPoints(self)
+  print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', thf:IsShown(), self:IsShown())
+  thf:ClearAllPoints()
+  thf:SetAllPoints(self)
 
   Veneer:InternalReanchor(self)
 end