mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-05 16:09:07 -04:00
expressions: Add closure expressions
This commit is contained in:
parent
8a7941dcbf
commit
3f7688a563
6 changed files with 69 additions and 0 deletions
11
tests/samples/expr_closure.blp
Normal file
11
tests/samples/expr_closure.blp
Normal file
|
@ -0,0 +1,11 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
Box {
|
||||
Box box {
|
||||
}
|
||||
}
|
||||
|
||||
Stack {
|
||||
visible-child: bind ((Gtk.Button)my_closure(box.parent)).parent;
|
||||
visible: bind (bool) my_other_closure(box);
|
||||
}
|
25
tests/samples/expr_closure.ui
Normal file
25
tests/samples/expr_closure.ui
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkBox" id="box"></object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkStack">
|
||||
<binding name="visible-child">
|
||||
<lookup name="parent" type="GtkButton">
|
||||
<closure function="my_closure" type="GtkButton">
|
||||
<lookup name="parent">
|
||||
<constant>box</constant>
|
||||
</lookup>
|
||||
</closure>
|
||||
</lookup>
|
||||
</binding>
|
||||
<binding name="visible">
|
||||
<closure function="my_other_closure" type="gboolean">
|
||||
<constant>box</constant>
|
||||
</closure>
|
||||
</binding>
|
||||
</object>
|
||||
</interface>
|
Loading…
Add table
Add a link
Reference in a new issue