comparison 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
comparison
equal deleted inserted replaced
19:215f0dd37a6c 20:dc1c77254f80
1 1
2 local DF = _G ["DetailsFramework"] 2 local DF = _G ["DetailsFramework"]
3 if (not DF or not DetailsFrameworkCanLoad) then
4 return
5 end
6
3 local _ 7 local _
4
5 local _rawset = rawset --> lua local 8 local _rawset = rawset --> lua local
6 local _rawget = rawget --> lua local 9 local _rawget = rawget --> lua local
7 local _setmetatable = setmetatable --> lua local 10 local _setmetatable = setmetatable --> lua local
8 local _unpack = unpack --> lua local 11 local _unpack = unpack --> lua local
9 local _type = type --> lua local 12 local _type = type --> lua local
820 end 823 end
821 824
822 self.MyObject:Close() 825 self.MyObject:Close()
823 end 826 end
824 827
825 828 function DF:BuildDropDownFontList (on_click, icon, icon_texcoord, icon_size)
829 local t = {}
830 local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0")
831 for name, fontPath in pairs (SharedMedia:HashTable ("font")) do
832 t[#t+1] = {value = name, label = name, onclick = on_click, icon = icon, iconsize = icon_size, texcoord = icon_texcoord, font = fontPath, descfont = "abcdefg ABCDEFG"}
833 end
834 table.sort (t, function (t1, t2) return t1.label < t2.label end)
835 return t
836 end
826 837
827 ------------------------------------------------------------------------------------------------------------ 838 ------------------------------------------------------------------------------------------------------------
828 --> object constructor 839 --> object constructor
829 840
830 function DF:CreateDropDown (parent, func, default, w, h, member, name) 841 function DF:CreateDropDown (parent, func, default, w, h, member, name)
886 APIDropDownFunctions = true 897 APIDropDownFunctions = true
887 local idx = getmetatable (DropDownObject.dropdown).__index 898 local idx = getmetatable (DropDownObject.dropdown).__index
888 for funcName, funcAddress in pairs (idx) do 899 for funcName, funcAddress in pairs (idx) do
889 if (not DropDownMetaFunctions [funcName]) then 900 if (not DropDownMetaFunctions [funcName]) then
890 DropDownMetaFunctions [funcName] = function (object, ...) 901 DropDownMetaFunctions [funcName] = function (object, ...)
891 local x = loadstring ( "return _G."..object.dropdown:GetName()..":"..funcName.."(...)") 902 local x = loadstring ( "return _G['"..object.dropdown:GetName().."']:"..funcName.."(...)")
892 return x (...) 903 return x (...)
893 end 904 end
894 end 905 end
895 end 906 end
896 end 907 end