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