comparison ObjectiveWidgets.lua @ 15:f660f1c1e0aa

Objective Widgets - determine completion by fractional value
author Nenue
date Mon, 04 Apr 2016 03:41:28 -0400
parents ed642234f017
children 880828018bf4
comparison
equal deleted inserted replaced
14:ed642234f017 15:f660f1c1e0aa
308 308
309 --- WidgetTemplate 'OnShow' 309 --- WidgetTemplate 'OnShow'
310 mod.InitializeWidget = setmetatable({}, { 310 mod.InitializeWidget = setmetatable({}, {
311 __call = function(t, frame) 311 __call = function(t, frame)
312 -- todo: config pull 312 -- todo: config pull
313 local maxWidth = 250 313
314 314 frame:SetWidth(mod.Conf.Wrapper.WrapperWidth - mod.Conf.Style.Format.status.Indent * 2)
315 frame:SetWidth(maxWidth)
316 frame:SetScript('OnEvent', mod.UpdateWidget[frame.widgetType]) 315 frame:SetScript('OnEvent', mod.UpdateWidget[frame.widgetType])
317 if frame.info.isCurrency then 316 if frame.info.isCurrency then
318 frame:RegisterEvent('CHAT_MSG_CURRENCY') 317 frame:RegisterEvent('CHAT_MSG_CURRENCY')
319 frame:RegisterEvent('CURRENCY_LIST_UPDATE') 318 frame:RegisterEvent('CURRENCY_LIST_UPDATE')
320 end 319 end
416 if self.line.format then 415 if self.line.format then
417 self.status:SetFormattedText(self.line.format, self.line.value, self.line.maxValue) 416 self.status:SetFormattedText(self.line.format, self.line.value, self.line.maxValue)
418 end 417 end
419 418
420 419
421 if self.line.finished then 420 if quantity == 0 then
421 self.fg:Hide()
422 elseif quantity >= requiredQuantity then
422 self.fg:SetWidth(self.bg:GetWidth() - self.indent) 423 self.fg:SetWidth(self.bg:GetWidth() - self.indent)
423 elseif quantity == 0 then
424 self.fg:Hide()
425 else 424 else
426 self.fg:Show() 425 self.fg:Show()
427 self.fg:SetWidth((self.bg:GetWidth() -self.indent) * (quantity / requiredQuantity)) 426 self.fg:SetWidth((self.bg:GetWidth() -self.indent) * (quantity / requiredQuantity))
428 end 427 end
429 end 428 end