vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 AceGUIFontString = AceGUIElement:new()
2  
3 function AceGUIFontString:Setup()
4 -- Determine if it's an actual FontString or if it's encapsulated
5 -- GetFrameType method not available until 1.9 so relying on a different method until then
6 -- if(self.GetFrameType and self:GetFrameType() == "Frame") then
7 if(not self.SetText) then
8 -- Store the real FontString for later use
9 self._text = getglobal(self:GetName().."Text")
10 if(not self._text) then
11 error("Invalid Frame used with AceGUIFontString",3)
12 end
13  
14 -- Set up a metatable to take care of wrapping the methods for the frame
15 local index = getmetatable(self).__index
16 local text = self._text
17 if(type(index) == "function") then
18 setmetatable(self,{__index = function(t,k)
19 if(text[k]) then
20 t[k] = function(a,b,c,d) return text[k](text,a,b,c,d) end
21 end
22 return t[k] or index(t,k)
23 end})
24 else
25 setmetatable(self,{__index = function(t,k)
26 if(text[k]) then
27 t[k] = function(a,b,c,d) return text[k](text,a,b,c,d) end
28 end
29 return t[k] or index[k]
30 end})
31 end
32 end
33 end
34  
35 function AceGUIFontString:Configure()
36  
37 local def = self._def
38 -- GetFont method not available until 1.9. I will assume the font is set for testing
39 --[[if(not self:GetFont()) then
40 self:SetFont(def.Font or "Fonts\\FRIZQT__.TTF",def.FontHeight or 12,unpack(def.flags or {}))
41 end]]
42 def.Color = def.Color or {r = 1,g = 0.82,b = 0}
43 self:SetTextColor(def.Color.r,def.Color.g,def.Color.b,def.Color.a)
44 -- SetNonSpaceWrap Method not available until 1.9
45 -- self:SetNonSpaceWrap(def.NonSpaceWrap)
46 if(def.VertexColor) then
47 self:SetVertexColor(def.VertexColor.r,def.VertexColor.g,def.VertexColor.b,def.VertexColor.a)
48 end
49 if(def.AlphaGradient) then
50 self:SetAlphaGradient(def.AlphaGradient.start,def.AlphaGradient.length)
51 end
52 if(def.justifyH) then
53 self:SetJustifyH(def.justifyH)
54 end
55 if(def.justifyV) then
56 self:SetJustifyV(def.justfyV)
57 end
58  
59  
60 end
61  
62 function AceGUIFontString:GetValue()
63 return self:GetText()
64 end
65  
66 function AceGUIFontString:SetValue(val)
67 return self:SetText(val)
68 end