comparison Templates.lua @ 125:3f4794dca91b

template load order and Script handlers linkage
author Nenue
date Sun, 15 Oct 2017 16:47:22 -0400
parents ea2c616a3b4f
children 414e37af1b1b
comparison
equal deleted inserted replaced
124:07fe8fae8ca8 125:3f4794dca91b
2 -- Templates.lua 2 -- Templates.lua
3 -- Created: 10/24/2016 9:16 AM 3 -- Created: 10/24/2016 9:16 AM
4 -- %file-revision% 4 -- %file-revision%
5 -- 5 --
6 -- Mover Widget base 6 -- Mover Widget base
7 local ADDON, Veneer = ... 7 local ADDON, addon = ...
8 local print = DEVIAN_WORKSPACE and function(...) _G.print('Veneer', ...) end or nop 8 local print = DEVIAN_WORKSPACE and function(...) _G.print('VnTpl', ...) end or nop
9 local PlaySoundKitID = DEVIAN_WORKSPACE and PlaySoundKitID or nop 9 local PlaySoundKitID = DEVIAN_WORKSPACE and PlaySoundKitID or nop
10 local ipairs, pairs = ipairs, pairs 10 local ipairs, pairs = ipairs, pairs
11 local pack, unpack = pack, unpack 11 local pack, unpack = pack, unpack
12 12
13 local Handler, ConfigLayer, Animation = {}, {}, {} 13 local Handler, ConfigLayer, Animation = {}, {}, {}
16 VeneerAnimationMixin = Animation 16 VeneerAnimationMixin = Animation
17 VeneerHandlerMixin = Handler 17 VeneerHandlerMixin = Handler
18 Handler.anchorPoint = 'CENTER' 18 Handler.anchorPoint = 'CENTER'
19 Handler.anchorPriority = 4 19 Handler.anchorPriority = 4
20 Handler.data = {} 20 Handler.data = {}
21 Veneer.HandlerBase = Handler 21 addon.HandlerBase = Handler
22 Veneer.ConfigLayerBase = ConfigLayer 22 addon.ConfigLayerBase = ConfigLayer
23 Veneer.AnimationBase = Animation 23 addon.AnimationBase = Animation
24 24
25 local ANCHOR_BUTTON_TYPES = { 25 local ANCHOR_BUTTON_TYPES = {
26 'TOPLEFT', 'TOP', 'TOPRIGHT', 'RIGHT', 'LEFT', 'CENTER', 'BOTTOMLEFT', 'BOTTOM', 'BOTTOMRIGHT' 26 'TOPLEFT', 'TOP', 'TOPRIGHT', 'RIGHT', 'LEFT', 'CENTER', 'BOTTOMLEFT', 'BOTTOM', 'BOTTOMRIGHT'
27 } 27 }
28 28
29 function ConfigLayer:OnLoad() 29 function ConfigLayer:OnLoad()
30 local handler = self:GetParent() 30 local handler = self:GetParent()
31 print(handler:GetName(), 'configLayers') 31 print(handler:GetName(), '-> ConfigLayer loaded', addon.ConfigMode)
32 handler.ConfigLayers = handler.ConfigLayers or {} 32 handler.ConfigLayers = handler.ConfigLayers or {}
33 for i, region in ipairs(handler.ConfigLayers) do 33 for i, region in ipairs(handler.ConfigLayers) do
34 region:SetShown(Veneer.ConfigMode) 34 region:SetShown(addon.ConfigMode)
35 end 35 end
36 self.handler = handler 36 self.handler = handler
37 end 37 end
38 38
39 function ConfigLayer:OnShow() 39 function ConfigLayer:OnShow()
142 PlaySoundKitID(229) 142 PlaySoundKitID(229)
143 self.animating = nil 143 self.animating = nil
144 print('|cFF00FF00Anim:OnFinish|r @', unpack(self.destPoint)) 144 print('|cFF00FF00Anim:OnFinish|r @', unpack(self.destPoint))
145 end 145 end
146 146
147
148 function Handler:OnLoad()
149 print(self:GetName(), 'loaded')
150 self.debug = DEVIAN_WORKSPACE and function(...) _G.print(self:GetName(), ...) end or nop
151 self.debug('OnLoad() template')
152 end
153
147 -- Replace if module requires anything besides fixing frame anchors 154 -- Replace if module requires anything besides fixing frame anchors
155
156
148 function Handler:OnShow() 157 function Handler:OnShow()
149 self:Reanchor() 158 self:Reanchor()
150 _G.Veneer:StaticReanchor(self) 159 _G.Veneer:DynamicReanchor()
151 end 160 end
152 function Handler:OnHide() 161 function Handler:OnHide()
153 _G.Veneer:DynamicReanchor() 162 _G.Veneer:DynamicReanchor()
154 end 163 end
155 function Handler:Reanchor (anchorAll) 164 function Handler:Reanchor (anchorAll)