]> git.mxchange.org Git - flightgear.git/commitdiff
Nasal: Expose BoxLayout methods for spacer and stretch.
authorThomas Geymayer <tomgey@gmail.com>
Sun, 8 Jun 2014 21:34:37 +0000 (23:34 +0200)
committerThomas Geymayer <tomgey@gmail.com>
Sun, 8 Jun 2014 21:34:37 +0000 (23:34 +0200)
src/Scripting/NasalCanvas.cxx

index 348aed41389e79a4ce98a51ebfe58c7a99497f0d..2d3783b74cd4b1fc932f69122e52614de6cba3e4 100644 (file)
@@ -349,6 +349,28 @@ static naRef f_boxLayoutAddItem( sc::BoxLayout& box,
                ctx.getArg<int>(1) );
   return naNil();
 }
+static naRef f_boxLayoutInsertItem( sc::BoxLayout& box,
+                                    const nasal::CallContext& ctx )
+{
+  box.insertItem( ctx.requireArg<int>(0),
+                  ctx.requireArg<sc::LayoutItemRef>(1),
+                  ctx.getArg<int>(2) );
+  return naNil();
+}
+
+static naRef f_boxLayoutAddStretch( sc::BoxLayout& box,
+                                    const nasal::CallContext& ctx )
+{
+  box.addStretch( ctx.getArg<int>(0) );
+  return naNil();
+}
+static naRef f_boxLayoutInsertStretch( sc::BoxLayout& box,
+                                       const nasal::CallContext& ctx )
+{
+  box.insertStretch( ctx.requireArg<int>(0),
+                     ctx.getArg<int>(1) );
+  return naNil();
+}
 
 template<class Type, class Base>
 static naRef f_newAsBase(const nasal::CallContext& ctx)
@@ -458,7 +480,12 @@ naRef initNasalCanvas(naRef globals, naContext c)
 
   NasalBoxLayout::init("canvas.BoxLayout")
     .bases<NasalLayout>()
-    .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<sc::HBoxLayout, sc::BoxLayout>);