Mercurial > wow > buffalo2
comparison Modules/TalkingHead.lua @ 90:6e2cb847c3c6
Implement a mixin template for the basic visual config widgets.
| author | Nenue |
|---|---|
| date | Mon, 24 Oct 2016 18:28:40 -0400 |
| parents | |
| children | caded2668701 |
comparison
equal
deleted
inserted
replaced
| 89:74e714637d6a | 90:6e2cb847c3c6 |
|---|---|
| 1 -- Veneer | |
| 2 -- TalkingHead.lua | |
| 3 -- Created: 10/23/2016 5:18 AM | |
| 4 -- %file-revision% | |
| 5 -- | |
| 6 | |
| 7 | |
| 8 local print = DEVIAN_WORKSPACE and function(...) print('VnTalkingHead', ...) end or nop | |
| 9 | |
| 10 VeneerTalkingHeadMixin = { | |
| 11 | |
| 12 anchorPoint = 'BOTTOMLEFT', | |
| 13 anchorFrom = 'TOPLEFT', | |
| 14 anchorX = -4, | |
| 15 anchorY = 24, | |
| 16 anchorFrame = 'ChatFrame1', | |
| 17 addonTrigger = 'Blizzard_TalkingHeadUI' | |
| 18 | |
| 19 } | |
| 20 function VeneerTalkingHeadMixin:OnLoad() | |
| 21 Veneer:AddHandler(self, self.anchorPoint) | |
| 22 end | |
| 23 | |
| 24 | |
| 25 | |
| 26 function VeneerTalkingHeadMixin:Setup() | |
| 27 print('|cFF00AAFF'..self:GetName()..'|r:Setup()', TalkingHeadFrame:IsShown(), self:IsShown()) | |
| 28 | |
| 29 self:SetSize(TalkingHeadFrame:GetSize()) | |
| 30 self:SetParent(TalkingHeadFrame) | |
| 31 TalkingHeadFrame:ClearAllPoints() | |
| 32 TalkingHeadFrame:SetPoint('BOTTOM', self, 'BOTTOM') | |
| 33 | |
| 34 hooksecurefunc(TalkingHeadFrame, 'SetPoint', function(...) | |
| 35 print('SetPoint', ...) | |
| 36 print(debugstack()) | |
| 37 end) | |
| 38 | |
| 39 self:SetShown(true) | |
| 40 self:ClearAnchor() | |
| 41 end | |
| 42 | |
| 43 function VeneerTalkingHeadMixin:ClearAnchor() | |
| 44 | |
| 45 UIPARENT_MANAGED_FRAME_POSITIONS["TalkingHeadFrame"] = nil | |
| 46 for i, alertSubSystem in pairs(AlertFrame.alertFrameSubSystems) do | |
| 47 if alertSubSystem.anchorFrame == TalkingHeadFrame then | |
| 48 tremove(AlertFrame.alertFrameSubSystems, i) | |
| 49 return | |
| 50 end | |
| 51 end | |
| 52 end | |
| 53 | |
| 54 function VeneerTalkingHeadMixin:OnShow() | |
| 55 if TalkingHeadFrame then | |
| 56 print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', TalkingHeadFrame:IsShown(), self:IsShown()) | |
| 57 print(debugstack()) | |
| 58 self:Update() | |
| 59 end | |
| 60 end | |
| 61 | |
| 62 function VeneerTalkingHeadMixin:Reanchor() | |
| 63 self:ClearAllPoints() | |
| 64 self:SetPoint('BOTTOMLEFT', _G[self.anchorFrame], 'TOPLEFT', -4, 24) | |
| 65 self:SetPoint('RIGHT', _G[self.anchorFrame], 'RIGHT', 2, 0) | |
| 66 -- independent module, | |
| 67 end | |
| 68 | |
| 69 function VeneerTalkingHeadMixin:OnHide() | |
| 70 if TalkingHeadFrame then | |
| 71 print('|cFF00AAFF'..self:GetName()..'|r:OnHide()', TalkingHeadFrame:IsShown(), self:IsShown()) | |
| 72 end | |
| 73 Veneer:Reanchor() | |
| 74 end | |
| 75 | |
| 76 function VeneerTalkingHeadMixin:Update() | |
| 77 | |
| 78 print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', TalkingHeadFrame:IsShown(), self:IsShown()) | |
| 79 TalkingHeadFrame:ClearAllPoints() | |
| 80 TalkingHeadFrame:SetAllPoints(self) | |
| 81 | |
| 82 Veneer:InternalReanchor(self) | |
| 83 end | |
| 84 |
