layout.margin: Fix the documentation

This commit is contained in:
Emmanuel Lepage Vallee 2016-03-26 01:46:47 -04:00
parent 87813a5597
commit 35ece57a78
1 changed files with 8 additions and 6 deletions

View File

@ -14,7 +14,7 @@ local cairo = require("lgi").cairo
local margin = { mt = {} } local margin = { mt = {} }
--- Draw a margin layout -- Draw a margin layout
function margin:draw(_, cr, width, height) function margin:draw(_, cr, width, height)
local x = self.left local x = self.left
local y = self.top local y = self.top
@ -35,7 +35,7 @@ function margin:draw(_, cr, width, height)
end end
end end
--- Layout a margin layout -- Layout a margin layout
function margin:layout(_, width, height) function margin:layout(_, width, height)
if self.widget then if self.widget then
local x = self.left local x = self.left
@ -47,7 +47,7 @@ function margin:layout(_, width, height)
end end
end end
--- Fit a margin layout into the given space -- Fit a margin layout into the given space
function margin:fit(context, width, height) function margin:fit(context, width, height)
local extra_w = self.left + self.right local extra_w = self.left + self.right
local extra_h = self.top + self.bottom local extra_h = self.top + self.bottom
@ -72,13 +72,13 @@ function margin:set_widget(widget)
self:emit_signal("widget::layout_changed") self:emit_signal("widget::layout_changed")
end end
--- Get the number of children element -- Get the number of children element
-- @treturn table The children -- @treturn table The children
function margin:get_children() function margin:get_children()
return {self.widget} return {self.widget}
end end
--- Replace the layout children -- Replace the layout children
-- This layout only accept one children, all others will be ignored -- This layout only accept one children, all others will be ignored
-- @tparam table children A table composed of valid widgets -- @tparam table children A table composed of valid widgets
function margin:set_children(children) function margin:set_children(children)
@ -86,6 +86,7 @@ function margin:set_children(children)
end end
--- Set all the margins to val. --- Set all the margins to val.
-- @tparam number val The margin value
function margin:set_margins(val) function margin:set_margins(val)
if self.left == val and if self.left == val and
self.right == val and self.right == val and
@ -101,7 +102,8 @@ function margin:set_margins(val)
self:emit_signal("widget::layout_changed") self:emit_signal("widget::layout_changed")
end end
--- Set the margins color to color --- Set the margins color to create a border.
-- @param color A color used to fill the margin.
function margin:set_color(color) function margin:set_color(color)
self.color = color and gcolor(color) self.color = color and gcolor(color)
self:emit_signal("widget::redraw_needed") self:emit_signal("widget::redraw_needed")