annotate 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
rev   line source
Nenue@90 1 -- Veneer
Nenue@90 2 -- TalkingHead.lua
Nenue@90 3 -- Created: 10/23/2016 5:18 AM
Nenue@90 4 -- %file-revision%
Nenue@90 5 --
Nenue@90 6
Nenue@90 7 local print = DEVIAN_WORKSPACE and function(...) print('VnTalkingHead', ...) end or nop
Nenue@121 8 local thf = TalkingHeadFrame
Nenue@121 9 local m = {
Nenue@90 10
Nenue@90 11 anchorPoint = 'BOTTOMLEFT',
Nenue@90 12 anchorFrom = 'TOPLEFT',
Nenue@90 13 anchorX = -4,
Nenue@102 14 anchorY = 96,
Nenue@90 15 anchorFrame = 'ChatFrame1',
Nenue@90 16
Nenue@90 17 }
Nenue@121 18 VeneerTalkingHeadMixin = m
Nenue@93 19
Nenue@93 20 local qf = {}
Nenue@93 21
Nenue@93 22
Nenue@121 23 function m:OnLoad()
Nenue@90 24 Veneer:AddHandler(self, self.anchorPoint)
Nenue@121 25 -- force this so we can implant
Nenue@121 26 LoadAddOn('Blizzard_TalkingHeadUI')
Nenue@121 27 thf = TalkingHeadFrame
Nenue@90 28 end
Nenue@90 29
Nenue@121 30 function m:Setup()
Nenue@121 31 print('|cFF00AAFF'..self:GetName()..'|r:Setup()', thf:IsShown(), self:IsShown())
Nenue@90 32
Nenue@121 33 self:SetSize(thf:GetSize())
Nenue@90 34
Nenue@121 35 hooksecurefunc(thf, 'SetPoint', function(...)
Nenue@90 36 print('SetPoint', ...)
Nenue@90 37 print(debugstack())
Nenue@90 38 end)
Nenue@90 39
Nenue@90 40 self:SetShown(true)
Nenue@90 41 self:ClearAnchor()
Nenue@90 42 end
Nenue@90 43
Nenue@121 44 function m:ClearAnchor()
Nenue@90 45
Nenue@90 46 UIPARENT_MANAGED_FRAME_POSITIONS["TalkingHeadFrame"] = nil
Nenue@90 47 for i, alertSubSystem in pairs(AlertFrame.alertFrameSubSystems) do
Nenue@121 48 if alertSubSystem.anchorFrame == thf then
Nenue@90 49 tremove(AlertFrame.alertFrameSubSystems, i)
Nenue@90 50 return
Nenue@90 51 end
Nenue@90 52 end
Nenue@90 53 end
Nenue@90 54
Nenue@121 55 function m:OnShow()
Nenue@121 56 if thf then
Nenue@121 57 print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', thf:IsShown(), self:IsShown())
Nenue@90 58 print(debugstack())
Nenue@90 59 self:Update()
Nenue@90 60 end
Nenue@90 61 end
Nenue@90 62
Nenue@121 63 function m:Reanchor()
Nenue@90 64 self:ClearAllPoints()
Nenue@90 65 self:SetPoint('BOTTOMLEFT', _G[self.anchorFrame], 'TOPLEFT', -4, 24)
Nenue@90 66 self:SetPoint('RIGHT', _G[self.anchorFrame], 'RIGHT', 2, 0)
Nenue@90 67 -- independent module,
Nenue@90 68 end
Nenue@90 69
Nenue@121 70 function m:OnHide()
Nenue@121 71 if thf then
Nenue@121 72 print('|cFF00AAFF'..self:GetName()..'|r:OnHide()', thf:IsShown(), self:IsShown())
Nenue@90 73 end
Nenue@90 74 Veneer:Reanchor()
Nenue@90 75 end
Nenue@90 76
Nenue@121 77 function m:Update()
Nenue@90 78
Nenue@121 79 print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', thf:IsShown(), self:IsShown())
Nenue@121 80 thf:ClearAllPoints()
Nenue@121 81 thf:SetAllPoints(self)
Nenue@90 82
Nenue@90 83 Veneer:InternalReanchor(self)
Nenue@90 84 end