wibox.widget.background: set foreground

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
dodo 2011-03-30 04:00:24 +02:00 committed by Uli Schlachter
parent 52dfb76819
commit af756bb0d1
1 changed files with 17 additions and 0 deletions

View File

@ -34,7 +34,14 @@ function draw(box, wibox, cr, width, height)
cr:restore()
if box.foreground then
cr:save()
cr:set_source(box.foreground)
end
layout_base.draw_widget(wibox, cr, box.widget, 0, 0, width, height)
if box.foreground then
cr:restore()
end
end
--- Fit this widget into the given area
@ -69,6 +76,16 @@ function set_bg(box, bg)
box._emit_updated()
end
--- Set the foreground to use
function set_fg(box, fg)
if fg then
box.foreground = color(fg)
else
box.foreground = nil
end
box._emit_updated()
end
--- Set the background image to use
function set_bgimage(box, image)
local image = image