comparison AceGUIWidget-lib-st.lua @ 126:9232cacc9136 beta-mhg-4

lib-st notes and minor cosmetic cleanup; properly bump version from previous change
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Sun, 19 Aug 2012 22:00:59 -0400
parents fd3dd12f96ce
children
comparison
equal deleted inserted replaced
125:a9cf9b2fbf9b 126:9232cacc9136
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 restore original frame methods, as fortold by ancient prophecy 25 Version 4 restore original frame methods, as fortold by ancient prophecy
26 Version 5 don't bogart the widget object 26 Version 5 don't bogart the widget object
27 -farmbuyer 27 -farmbuyer
28 -------------------------------------------------------------------------------]] 28 -------------------------------------------------------------------------------]]
29 local Type, Version = "lib-st", 4 29 local Type, Version = "lib-st", 5
30 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) 30 local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
31 if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end 31 if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
32 32
33 -- Lua APIs 33 -- Lua APIs
34 local ipairs, error = ipairs, error 34 local ipairs, error = ipairs, error
75 local ShiftingSetPoint, ShiftingSetAllPoints 75 local ShiftingSetPoint, ShiftingSetAllPoints
76 local function WrapST (self, st) 76 local function WrapST (self, st)
77 if not st.frame then 77 if not st.frame then
78 error"lib-st instance has no '.frame' field... wtf did you pass to this function?" 78 error"lib-st instance has no '.frame' field... wtf did you pass to this function?"
79 end 79 end
80 --if st.frame.obj and (st.frame.obj ~= self) then
81 -- error"lib-st instance already has an '.obj' field from a different widget, cannot use with AceGUI!"
82 --end
83 self.st = st 80 self.st = st
84 if not st.head then 81 if not st.head then
85 error"lib-st instance has no '.head' field, must use either ScrollingTable:CreateST or this widget's CreateST first" 82 error"lib-st instance has no '.head' field, must use either ScrollingTable:CreateST or this widget's CreateST first"
86 end 83 end
87 self.frame = st.frame -- gutsy, but looks doable 84 self.frame = st.frame -- gutsy, but looks doable
88 85
89 -- Possibly have already wrapped this ST in a previous widget, careful. 86 -- Possibly have already wrapped this ST in a previous widget, careful.
90 --if st.frame.obj ~= self then 87 self.frame.customSetPoint = rawget(self.frame,"SetPoint")
91 self.frame.customSetPoint = rawget(self.frame,"SetPoint") 88 self.frame.realSetPoint = self.frame.SetPoint
92 self.frame.realSetPoint = self.frame.SetPoint 89 self.frame.SetPoint = ShiftingSetPoint
93 self.frame.SetPoint = ShiftingSetPoint 90 self.frame.SetAllPoints = ShiftingSetAllPoints
94 self.frame.SetAllPoints = ShiftingSetAllPoints
95 --end
96 91
97 -- This needs the .frame field. This also unconditionally creates .obj 92 -- This needs the .frame field. This also unconditionally creates .obj
98 -- inside that field and calls a SetScript on it as well. 93 -- inside that field and calls a SetScript on it as well.
99 return AceGUI:RegisterAsWidget(self) 94 return AceGUI:RegisterAsWidget(self)
100 end 95 end