From 9c0b5a5c5416aba64d5e7defb78c9aca0e809016 Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Sun, 8 Jun 2014 23:34:37 +0200 Subject: [PATCH] Nasal: Expose BoxLayout methods for spacer and stretch. --- src/Scripting/NasalCanvas.cxx | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/Scripting/NasalCanvas.cxx b/src/Scripting/NasalCanvas.cxx index 348aed413..2d3783b74 100644 --- a/src/Scripting/NasalCanvas.cxx +++ b/src/Scripting/NasalCanvas.cxx @@ -349,6 +349,28 @@ static naRef f_boxLayoutAddItem( sc::BoxLayout& box, ctx.getArg(1) ); return naNil(); } +static naRef f_boxLayoutInsertItem( sc::BoxLayout& box, + const nasal::CallContext& ctx ) +{ + box.insertItem( ctx.requireArg(0), + ctx.requireArg(1), + ctx.getArg(2) ); + return naNil(); +} + +static naRef f_boxLayoutAddStretch( sc::BoxLayout& box, + const nasal::CallContext& ctx ) +{ + box.addStretch( ctx.getArg(0) ); + return naNil(); +} +static naRef f_boxLayoutInsertStretch( sc::BoxLayout& box, + const nasal::CallContext& ctx ) +{ + box.insertStretch( ctx.requireArg(0), + ctx.getArg(1) ); + return naNil(); +} template static naRef f_newAsBase(const nasal::CallContext& ctx) @@ -458,7 +480,12 @@ naRef initNasalCanvas(naRef globals, naContext c) NasalBoxLayout::init("canvas.BoxLayout") .bases() - .method("addItem", &f_boxLayoutAddItem); + .method("addItem", &f_boxLayoutAddItem) + .method("addSpacing", &sc::BoxLayout::addSpacing) + .method("addStretch", &f_boxLayoutAddStretch) + .method("insertItem", &f_boxLayoutInsertItem) + .method("insertSpacing", &sc::BoxLayout::insertSpacing) + .method("insertStretch", &f_boxLayoutInsertStretch); canvas_module.createHash("HBoxLayout") .set("new", &f_newAsBase); -- 2.39.5