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

- added close button to users panel. - framework update.
author Tercio
date Tue, 11 Aug 2015 12:46:46 -0300
parents 0c160948ac5e
children dbd417f413a8
line wrap: on
line diff
--- a/Libs/DF/dropdown.lua	Sat Jul 18 17:32:30 2015 -0300
+++ b/Libs/DF/dropdown.lua	Tue Aug 11 12:46:46 2015 -0300
@@ -1,7 +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
@@ -822,7 +825,15 @@
 	self.MyObject:Close()
 end
 
-
+function DF:BuildDropDownFontList (on_click, icon, icon_texcoord, icon_size)
+	local t = {}
+	local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0")
+	for name, fontPath in pairs (SharedMedia:HashTable ("font")) do 
+		t[#t+1] = {value = name, label = name, onclick = on_click, icon = icon, iconsize = icon_size, texcoord = icon_texcoord, font = fontPath, descfont = "abcdefg ABCDEFG"}
+	end
+	table.sort (t, function (t1, t2) return t1.label < t2.label end)
+	return t
+end
 
 ------------------------------------------------------------------------------------------------------------
 --> object constructor
@@ -888,7 +899,7 @@
 		for funcName, funcAddress in pairs (idx) do 
 			if (not DropDownMetaFunctions [funcName]) then
 				DropDownMetaFunctions [funcName] = function (object, ...)
-					local x = loadstring ( "return _G."..object.dropdown:GetName()..":"..funcName.."(...)")
+					local x = loadstring ( "return _G['"..object.dropdown:GetName().."']:"..funcName.."(...)")
 					return x (...)
 				end
 			end