diff Libs/DF/label.lua @ 20:dc1c77254f80

- added close button to users panel. - framework update.
author Tercio
date Tue, 11 Aug 2015 12:46:46 -0300
parents 2f09fe4be15c
children dbd417f413a8
line wrap: on
line diff
--- a/Libs/DF/label.lua	Sat Jul 18 17:32:30 2015 -0300
+++ b/Libs/DF/label.lua	Tue Aug 11 12:46:46 2015 -0300
@@ -1,9 +1,10 @@
-
-
 
 local DF = _G ["DetailsFramework"]
+if (not DF or not DetailsFrameworkCanLoad) then
+	return 
+end
+
 local _
-
 local _rawset = rawset --> lua local
 local _rawget = rawget --> lua local
 local _setmetatable = setmetatable --> lua local
@@ -270,7 +271,7 @@
 		for funcName, funcAddress in pairs (idx) do 
 			if (not LabelMetaFunctions [funcName]) then
 				LabelMetaFunctions [funcName] = function (object, ...)
-					local x = loadstring ( "return _G."..object.label:GetName()..":"..funcName.."(...)")
+					local x = loadstring ( "return _G['"..object.label:GetName().."']:"..funcName.."(...)")
 					return x (...)
 				end
 			end
@@ -279,15 +280,33 @@
 	
 	LabelObject.label:SetText (text)
 	
-	if (size) then
-		DF:SetFontSize (LabelObject.label, size)
-	end
-	
 	if (color) then
 		local r, g, b, a = DF:ParseColors (color)
 		LabelObject.label:SetTextColor (r, g, b, a)
+	end	
+	
+	if (size and type (size) == "number") then
+		DF:SetFontSize (LabelObject.label, size)
+		
+	elseif (size and type (size) == "table") then
+		local template = size
+		
+		if (template.size) then
+			DF:SetFontSize (LabelObject.label, template.size)
+		end
+		if (template.color) then
+			local r, g, b, a = DF:ParseColors (template.color)
+			LabelObject.label:SetTextColor (r, g, b, a)
+		end
+		if (template.font) then
+			local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0")
+			local font = SharedMedia:Fetch ("font", template.font)
+			DF:SetFontFace (LabelObject.label, font)
+		end
 	end
 	
+
+	
 	LabelObject.label:SetJustifyH ("LEFT")
 	
 	setmetatable (LabelObject, LabelMetaFunctions)