Mercurial > wow > hansgar_and_franzok_assist
diff Libs/DF/button.lua @ 20:dc1c77254f80
- added close button to users panel.
- framework update.
| author | Tercio |
|---|---|
| date | Tue, 11 Aug 2015 12:46:46 -0300 |
| parents | 215f0dd37a6c |
| children | dbd417f413a8 |
line wrap: on
line diff
--- a/Libs/DF/button.lua Sat Jul 18 17:32:30 2015 -0300 +++ b/Libs/DF/button.lua Tue Aug 11 12:46:46 2015 -0300 @@ -1,6 +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 @@ -860,11 +864,11 @@ ------------------------------------------------------------------------------------------------------------ --> object constructor -function DF:CreateButton (parent, func, w, h, text, param1, param2, texture, member, name, short_method) - return DF:NewButton (parent, parent, name, member, w, h, func, param1, param2, texture, text, short_method) +function DF:CreateButton (parent, func, w, h, text, param1, param2, texture, member, name, short_method, text_template) + return DF:NewButton (parent, parent, name, member, w, h, func, param1, param2, texture, text, short_method, text_template) end -function DF:NewButton (parent, container, name, member, w, h, func, param1, param2, texture, text, short_method) +function DF:NewButton (parent, container, name, member, w, h, func, param1, param2, texture, text, short_method, template) if (not name) then name = "DetailsFrameworkButtonNumber" .. DF.ButtonCounter @@ -923,7 +927,7 @@ for funcName, funcAddress in pairs (idx) do if (not ButtonMetaFunctions [funcName]) then ButtonMetaFunctions [funcName] = function (object, ...) - local x = loadstring ( "return _G."..object.button:GetName()..":"..funcName.."(...)") + local x = loadstring ( "return _G['"..object.button:GetName().."']:"..funcName.."(...)") return x (...) end end @@ -973,6 +977,21 @@ ButtonObject.short_method = short_method + if (template) then + if (template.size) then + DF:SetFontSize (ButtonObject.button.text, template.size) + end + if (template.color) then + local r, g, b, a = DF:ParseColors (template.color) + ButtonObject.button.text: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 (ButtonObject.button.text, font) + end + end + --> hooks ButtonObject.button:SetScript ("OnEnter", OnEnter) ButtonObject.button:SetScript ("OnLeave", OnLeave)
