Convert the imagebox to the new layout system

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2015-06-14 16:36:00 +02:00
parent 091ca697e6
commit 121a5050b1
1 changed files with 4 additions and 6 deletions

View File

@ -20,8 +20,6 @@ function imagebox:draw(context, cr, width, height)
if not self._image then return end
if width == 0 or height == 0 then return end
cr:save()
if not self.resize_forbidden then
-- Let's scale the image so that it fits into (width, height)
local w = self._image:get_width()
@ -34,8 +32,6 @@ function imagebox:draw(context, cr, width, height)
end
cr:set_source_surface(self._image, 0, 0)
cr:paint()
cr:restore()
end
--- Fit the imagebox into the given geometry
@ -101,7 +97,8 @@ function imagebox:set_image(image)
self._image = image
self:emit_signal("widget::updated")
self:emit_signal("widget::redraw_needed")
self:emit_signal("widget::layout_changed")
return true
end
@ -110,7 +107,8 @@ end
-- to fit into the available space.
function imagebox:set_resize(allowed)
self.resize_forbidden = not allowed
self:emit_signal("widget::updated")
self:emit_signal("widget::redraw_needed")
self:emit_signal("widget::layout_changed")
end
--- Returns a new imagebox