Mercurial > wow > buffalo2
diff Templates.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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Templates.lua Mon Oct 24 18:28:40 2016 -0400 @@ -0,0 +1,59 @@ +-- Veneer +-- Templates.lua +-- Created: 10/24/2016 9:16 AM +-- %file-revision% +-- +-- Mover Widget base +local print = DEVIAN_WORKSPACE and function(...) _G.print('VnTemplate', ...) end or nop + +VeneerConfigLayerMixin = {} +VeneerAnimationMixin = {} +VeneerHandlerMixin = { anchorPoint = 'CENTER' } + +function VeneerConfigLayerMixin:OnLoad() + local handler = self:GetParent() + print(handler:GetName(), 'configLayers') + handler.ConfigLayers = handler.ConfigLayers or {} + for i, region in ipairs(handler.ConfigLayers) do + region:SetShown(Veneer.ConfigMode) + end +end + + +function VeneerConfigLayerMixin:OnUpdate() + local handler = self:GetParent() + handler.ConfigLayers = handler.ConfigLayers or {} + + self.ConfigName:SetText(handler:GetName()) + self.ConfigID:SetText(handler:GetID()) +end + + +function VeneerHandlerMixin:OnShow() + self:Reanchor() + Veneer:StaticReanchor(self) +end +function VeneerHandlerMixin:OnHide() + Veneer:DynamicReanchor() +end +function VeneerHandlerMixin:Reanchor (anchorAll) + if not anchorAll then + Veneer:InternalReanchor(self) + end +end + +function VeneerAnimationMixin:OnPlay() + PlaySoundKitID(229) + self.animating = true + print('|cFF00FF00Anim:OnPlay|r @', unpack(self.sourcePoint)) +end +function VeneerAnimationMixin:OnStop() + PlaySoundKitID(229) + self.animating = nil + print('|cFF00FF00Anim:OnFinish|r @', unpack(self.destPoint)) +end +function VeneerAnimationMixin:OnFinished() + PlaySoundKitID(229) + self.animating = nil + print('|cFF00FF00Anim:OnFinish|r @', unpack(self.destPoint)) +end \ No newline at end of file