view 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 source
-- 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