Mercurial > wow > hansgar_and_franzok_assist
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 19:215f0dd37a6c | 20:dc1c77254f80 |
|---|---|
| 1 | |
| 2 | |
| 3 | 1 |
| 4 local DF = _G ["DetailsFramework"] | 2 local DF = _G ["DetailsFramework"] |
| 3 if (not DF or not DetailsFrameworkCanLoad) then | |
| 4 return | |
| 5 end | |
| 6 | |
| 5 local _ | 7 local _ |
| 6 | |
| 7 local _rawset = rawset --> lua local | 8 local _rawset = rawset --> lua local |
| 8 local _rawget = rawget --> lua local | 9 local _rawget = rawget --> lua local |
| 9 local _setmetatable = setmetatable --> lua local | 10 local _setmetatable = setmetatable --> lua local |
| 10 local _unpack = unpack --> lua local | 11 local _unpack = unpack --> lua local |
| 11 local _type = type --> lua local | 12 local _type = type --> lua local |
| 268 APILabelFunctions = true | 269 APILabelFunctions = true |
| 269 local idx = getmetatable (LabelObject.label).__index | 270 local idx = getmetatable (LabelObject.label).__index |
| 270 for funcName, funcAddress in pairs (idx) do | 271 for funcName, funcAddress in pairs (idx) do |
| 271 if (not LabelMetaFunctions [funcName]) then | 272 if (not LabelMetaFunctions [funcName]) then |
| 272 LabelMetaFunctions [funcName] = function (object, ...) | 273 LabelMetaFunctions [funcName] = function (object, ...) |
| 273 local x = loadstring ( "return _G."..object.label:GetName()..":"..funcName.."(...)") | 274 local x = loadstring ( "return _G['"..object.label:GetName().."']:"..funcName.."(...)") |
| 274 return x (...) | 275 return x (...) |
| 275 end | 276 end |
| 276 end | 277 end |
| 277 end | 278 end |
| 278 end | 279 end |
| 279 | 280 |
| 280 LabelObject.label:SetText (text) | 281 LabelObject.label:SetText (text) |
| 281 | 282 |
| 282 if (size) then | |
| 283 DF:SetFontSize (LabelObject.label, size) | |
| 284 end | |
| 285 | |
| 286 if (color) then | 283 if (color) then |
| 287 local r, g, b, a = DF:ParseColors (color) | 284 local r, g, b, a = DF:ParseColors (color) |
| 288 LabelObject.label:SetTextColor (r, g, b, a) | 285 LabelObject.label:SetTextColor (r, g, b, a) |
| 289 end | 286 end |
| 287 | |
| 288 if (size and type (size) == "number") then | |
| 289 DF:SetFontSize (LabelObject.label, size) | |
| 290 | |
| 291 elseif (size and type (size) == "table") then | |
| 292 local template = size | |
| 293 | |
| 294 if (template.size) then | |
| 295 DF:SetFontSize (LabelObject.label, template.size) | |
| 296 end | |
| 297 if (template.color) then | |
| 298 local r, g, b, a = DF:ParseColors (template.color) | |
| 299 LabelObject.label:SetTextColor (r, g, b, a) | |
| 300 end | |
| 301 if (template.font) then | |
| 302 local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0") | |
| 303 local font = SharedMedia:Fetch ("font", template.font) | |
| 304 DF:SetFontFace (LabelObject.label, font) | |
| 305 end | |
| 306 end | |
| 307 | |
| 308 | |
| 290 | 309 |
| 291 LabelObject.label:SetJustifyH ("LEFT") | 310 LabelObject.label:SetJustifyH ("LEFT") |
| 292 | 311 |
| 293 setmetatable (LabelObject, LabelMetaFunctions) | 312 setmetatable (LabelObject, LabelMetaFunctions) |
| 294 | 313 |
