Mercurial > wow > buffalo2
comparison 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 |
comparison
equal
deleted
inserted
replaced
89:74e714637d6a | 90:6e2cb847c3c6 |
---|---|
1 -- Veneer | |
2 -- Templates.lua | |
3 -- Created: 10/24/2016 9:16 AM | |
4 -- %file-revision% | |
5 -- | |
6 -- Mover Widget base | |
7 local print = DEVIAN_WORKSPACE and function(...) _G.print('VnTemplate', ...) end or nop | |
8 | |
9 VeneerConfigLayerMixin = {} | |
10 VeneerAnimationMixin = {} | |
11 VeneerHandlerMixin = { anchorPoint = 'CENTER' } | |
12 | |
13 function VeneerConfigLayerMixin:OnLoad() | |
14 local handler = self:GetParent() | |
15 print(handler:GetName(), 'configLayers') | |
16 handler.ConfigLayers = handler.ConfigLayers or {} | |
17 for i, region in ipairs(handler.ConfigLayers) do | |
18 region:SetShown(Veneer.ConfigMode) | |
19 end | |
20 end | |
21 | |
22 | |
23 function VeneerConfigLayerMixin:OnUpdate() | |
24 local handler = self:GetParent() | |
25 handler.ConfigLayers = handler.ConfigLayers or {} | |
26 | |
27 self.ConfigName:SetText(handler:GetName()) | |
28 self.ConfigID:SetText(handler:GetID()) | |
29 end | |
30 | |
31 | |
32 function VeneerHandlerMixin:OnShow() | |
33 self:Reanchor() | |
34 Veneer:StaticReanchor(self) | |
35 end | |
36 function VeneerHandlerMixin:OnHide() | |
37 Veneer:DynamicReanchor() | |
38 end | |
39 function VeneerHandlerMixin:Reanchor (anchorAll) | |
40 if not anchorAll then | |
41 Veneer:InternalReanchor(self) | |
42 end | |
43 end | |
44 | |
45 function VeneerAnimationMixin:OnPlay() | |
46 PlaySoundKitID(229) | |
47 self.animating = true | |
48 print('|cFF00FF00Anim:OnPlay|r @', unpack(self.sourcePoint)) | |
49 end | |
50 function VeneerAnimationMixin:OnStop() | |
51 PlaySoundKitID(229) | |
52 self.animating = nil | |
53 print('|cFF00FF00Anim:OnFinish|r @', unpack(self.destPoint)) | |
54 end | |
55 function VeneerAnimationMixin:OnFinished() | |
56 PlaySoundKitID(229) | |
57 self.animating = nil | |
58 print('|cFF00FF00Anim:OnFinish|r @', unpack(self.destPoint)) | |
59 end |