Mercurial > wow > ouroloot
comparison AceGUIWidget-lib-st.lua @ 49:fd3dd12f96ce
Handle text generation modules being LoadOnDemand. lib-st widget to v5 to fix handling multiple live ST instances.
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Sun, 29 Jan 2012 03:38:30 +0000 |
parents | 1070a14cfee4 |
children | 9232cacc9136 |
comparison
equal
deleted
inserted
replaced
48:22db12e97313 | 49:fd3dd12f96ce |
---|---|
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 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 -farmbuyer | 27 -farmbuyer |
27 -------------------------------------------------------------------------------]] | 28 -------------------------------------------------------------------------------]] |
28 local Type, Version = "lib-st", 4 | 29 local Type, Version = "lib-st", 4 |
29 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) | 30 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
30 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 |
74 local ShiftingSetPoint, ShiftingSetAllPoints | 75 local ShiftingSetPoint, ShiftingSetAllPoints |
75 local function WrapST (self, st) | 76 local function WrapST (self, st) |
76 if not st.frame then | 77 if not st.frame then |
77 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?" |
78 end | 79 end |
79 if st.frame.obj and (st.frame.obj ~= self) then | 80 --if st.frame.obj and (st.frame.obj ~= self) then |
80 error"lib-st instance already has an '.obj' field from a different widget, cannot use with AceGUI!" | 81 -- error"lib-st instance already has an '.obj' field from a different widget, cannot use with AceGUI!" |
81 end | 82 --end |
82 self.st = st | 83 self.st = st |
83 if not st.head then | 84 if not st.head then |
84 error"lib-st instance has no '.head' field, must use either ScrollingTable:CreateST or this widget's CreatST first" | 85 error"lib-st instance has no '.head' field, must use either ScrollingTable:CreateST or this widget's CreateST first" |
85 end | 86 end |
86 self.frame = st.frame -- gutsy, but looks doable | 87 self.frame = st.frame -- gutsy, but looks doable |
87 | 88 |
88 -- Possibly have already wrapped this ST in a previous widget, careful. | 89 -- Possibly have already wrapped this ST in a previous widget, careful. |
89 if st.frame.obj ~= self then | 90 --if st.frame.obj ~= self then |
90 self.frame.customSetPoint = rawget(self.frame,"SetPoint") | 91 self.frame.customSetPoint = rawget(self.frame,"SetPoint") |
91 self.frame.realSetPoint = self.frame.SetPoint | 92 self.frame.realSetPoint = self.frame.SetPoint |
92 self.frame.SetPoint = ShiftingSetPoint | 93 self.frame.SetPoint = ShiftingSetPoint |
93 self.frame.SetAllPoints = ShiftingSetAllPoints | 94 self.frame.SetAllPoints = ShiftingSetAllPoints |
94 end | 95 --end |
95 | 96 |
96 -- This needs the .frame field. This also unconditionally creates .obj | 97 -- This needs the .frame field. This also unconditionally creates .obj |
97 -- inside that field and calls a SetScript on it as well. | 98 -- inside that field and calls a SetScript on it as well. |
98 return AceGUI:RegisterAsWidget(self) | 99 return AceGUI:RegisterAsWidget(self) |
99 end | 100 end |