comparison AceGUIWidget-lib-st.lua @ 9:6ccfe2249edb

Finally restore frame methods
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Fri, 27 Jan 2012 19:22:29 +0000
parents e6382ba088c3
children c2e4ad7fa458
comparison
equal deleted inserted replaced
8:e6382ba088c3 9:6ccfe2249edb
20 20
21 21
22 Version 1 initial functioning implementation 22 Version 1 initial functioning implementation
23 Version 2 reshuffle to follow new AceGUI widget coding style 23 Version 2 reshuffle to follow new AceGUI widget coding style
24 Version 3 add .tail_offset, defaulting to same absolute value as .head_offset 24 Version 3 add .tail_offset, defaulting to same absolute value as .head_offset
25 Version 4 25 Version 4 restore original frame methods, as fortold by ancient prophecy
26 -farmbuyer 26 -farmbuyer
27 -------------------------------------------------------------------------------]] 27 -------------------------------------------------------------------------------]]
28 local Type, Version = "lib-st", 4 28 local Type, Version = "lib-st", 4
29 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) 29 local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
30 if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end 30 if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
85 end 85 end
86 self.frame = st.frame -- gutsy, but looks doable 86 self.frame = st.frame -- gutsy, but looks doable
87 87
88 -- Possibly have already wrapped this ST in a previous widget, careful. 88 -- Possibly have already wrapped this ST in a previous widget, careful.
89 if st.frame.obj ~= self then 89 if st.frame.obj ~= self then
90 self.frame.customSetPoint = rawget(self.frame,"SetPoint")
90 self.frame.realSetPoint = self.frame.SetPoint 91 self.frame.realSetPoint = self.frame.SetPoint
91 self.frame.SetPoint = ShiftingSetPoint 92 self.frame.SetPoint = ShiftingSetPoint
92 self.frame.SetAllPoints = ShiftingSetAllPoints 93 self.frame.SetAllPoints = ShiftingSetAllPoints
93 end 94 end
94 95
149 if self.st then 150 if self.st then
150 self.st.frame:ClearAllPoints() 151 self.st.frame:ClearAllPoints()
151 self.st:Hide() 152 self.st:Hide()
152 end 153 end
153 self.st = nil 154 self.st = nil
154 -- XXX should also undo the frame hooks. would most likely be wasted 155 self.frame.realSetPoint = nil
155 -- cycles. if somebody actually wants to make an ST, include it inside 156 self.frame.SetAllPoints = nil
156 -- an ace container, then hide the container and continue displaying 157 self.frame.SetPoint = self.frame.customSetPoint
157 -- the ST by other means, they can file a ticket
158 end, 158 end,
159 159
160 --[[ 160 --[[
161 STs don't use a "normal" SetWidth, if we define "normal" to be the 161 STs don't use a "normal" SetWidth, if we define "normal" to be the
162 behavior of the blizzard :SetWidth. Column width is passed in during 162 behavior of the blizzard :SetWidth. Column width is passed in during