Apply colors to children of Progress
This commit is contained in:
parent
99c9158488
commit
b816a81f3b
@ -23,10 +23,19 @@ local Progress = Prop.attach(Element:new{
|
||||
}, Orientation, Orientation.VERTICAL)
|
||||
|
||||
function Progress:new(o)
|
||||
local obj = o or {}
|
||||
local obj = Element.new(self, o or {})
|
||||
obj.active = BlankElement:new()
|
||||
obj.inactive = BlankElement:new()
|
||||
return Element.new(self, obj)
|
||||
obj:_refreshColors()
|
||||
return obj
|
||||
end
|
||||
|
||||
function Progress:setFgColor(color)
|
||||
self.active:setFgColor(color)
|
||||
end
|
||||
|
||||
function Progress:setBgColor(color)
|
||||
self.inactive:setFgColor(color)
|
||||
end
|
||||
|
||||
function Progress:_updateProgress()
|
||||
@ -52,6 +61,13 @@ function Progress:_updateProgress()
|
||||
}
|
||||
self.inactive:setX(self.active:setX() + self.active:getWidth())
|
||||
end
|
||||
|
||||
self:_refreshColors()
|
||||
end
|
||||
|
||||
function Progress:_refreshColors()
|
||||
self:setFgColor(self:getFgColor())
|
||||
self:setBgColor(self:getBgColor())
|
||||
end
|
||||
|
||||
function Progress:setProgress(progress)
|
||||
|
Loading…
x
Reference in New Issue
Block a user