1
0
Fork 0

Canvas: LayoutItem.setVisible can be chained

Wrap LayoutItem::setVisible so it returns self, and hence can be chained,
similar to methods implemented in Nasal.
This commit is contained in:
James Turner 2023-01-04 15:21:59 +00:00
parent 1b07851374
commit fc842c17f0

View file

@ -361,6 +361,13 @@ static naRef f_customEventGetDetail( sc::CustomEvent& event,
); );
} }
static naRef f_layoutItemSetVisible(sc::LayoutItem& item,
const nasal::CallContext& ctx)
{
item.setVisible(ctx.getArg<bool>(0, true));
return ctx.me;
}
static naRef f_boxLayoutAddItem( sc::BoxLayout& box, static naRef f_boxLayoutAddItem( sc::BoxLayout& box,
const nasal::CallContext& ctx ) const nasal::CallContext& ctx )
{ {
@ -599,7 +606,7 @@ naRef initNasalCanvas(naRef globals, naContext c)
.method("minimumHeightForWidth", &sc::LayoutItem::minimumHeightForWidth) .method("minimumHeightForWidth", &sc::LayoutItem::minimumHeightForWidth)
.method("setAlignment", &sc::LayoutItem::setAlignment) .method("setAlignment", &sc::LayoutItem::setAlignment)
.method("alignment", &sc::LayoutItem::alignment) .method("alignment", &sc::LayoutItem::alignment)
.method("setVisible", &sc::LayoutItem::setVisible) .method("setVisible", f_layoutItemSetVisible)
.method("isVisible", &sc::LayoutItem::isVisible) .method("isVisible", &sc::LayoutItem::isVisible)
.method("isExplicitlyHidden", &sc::LayoutItem::isExplicitlyHidden) .method("isExplicitlyHidden", &sc::LayoutItem::isExplicitlyHidden)
.method("show", &sc::LayoutItem::show) .method("show", &sc::LayoutItem::show)