Mercurial > wow > hansgar_and_franzok_assist
comparison Libs/DF/label.lua @ 22:dbd417f413a8
- framework update.
| author | Tercio |
|---|---|
| date | Tue, 08 Sep 2015 13:16:49 -0300 |
| parents | dc1c77254f80 |
| children | 5da06cb420d4 |
comparison
equal
deleted
inserted
replaced
| 21:7fef991992f6 | 22:dbd417f413a8 |
|---|---|
| 217 end | 217 end |
| 218 return self.widget:SetPoint (v1, v2, v3, v4, v5) | 218 return self.widget:SetPoint (v1, v2, v3, v4, v5) |
| 219 end | 219 end |
| 220 | 220 |
| 221 ------------------------------------------------------------------------------------------------------------ | 221 ------------------------------------------------------------------------------------------------------------ |
| 222 | |
| 223 function LabelMetaFunctions:SetTemplate (template) | |
| 224 if (template.size) then | |
| 225 DF:SetFontSize (self.label, template.size) | |
| 226 end | |
| 227 if (template.color) then | |
| 228 local r, g, b, a = DF:ParseColors (template.color) | |
| 229 self:SetTextColor (r, g, b, a) | |
| 230 end | |
| 231 if (template.font) then | |
| 232 local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0") | |
| 233 local font = SharedMedia:Fetch ("font", template.font) | |
| 234 DF:SetFontFace (self.label, font) | |
| 235 end | |
| 236 end | |
| 237 | |
| 238 ------------------------------------------------------------------------------------------------------------ | |
| 222 --> object constructor | 239 --> object constructor |
| 223 function DF:CreateLabel (parent, text, size, color, font, member, name, layer) | 240 function DF:CreateLabel (parent, text, size, color, font, member, name, layer) |
| 224 return DF:NewLabel (parent, nil, name, member, text, font, size, color, layer) | 241 return DF:NewLabel (parent, nil, name, member, text, font, size, color, layer) |
| 225 end | 242 end |
| 226 | 243 |
| 285 LabelObject.label:SetTextColor (r, g, b, a) | 302 LabelObject.label:SetTextColor (r, g, b, a) |
| 286 end | 303 end |
| 287 | 304 |
| 288 if (size and type (size) == "number") then | 305 if (size and type (size) == "number") then |
| 289 DF:SetFontSize (LabelObject.label, size) | 306 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 end |
| 307 | 308 |
| 308 | 309 |
| 309 | 310 |
| 310 LabelObject.label:SetJustifyH ("LEFT") | 311 LabelObject.label:SetJustifyH ("LEFT") |
| 311 | 312 |
| 312 setmetatable (LabelObject, LabelMetaFunctions) | 313 setmetatable (LabelObject, LabelMetaFunctions) |
| 314 | |
| 315 if (size and type (size) == "table") then | |
| 316 LabelObject:SetTemplate (size) | |
| 317 end | |
| 313 | 318 |
| 314 return LabelObject | 319 return LabelObject |
| 315 end | 320 end |
