summaryrefslogtreecommitdiffstats
path: root/manual tests/7 vala composite widgets/mywidget.vala
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
commit7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch)
tree4a2738d69fa2814659fdadddf5826282e73d81f4 /manual tests/7 vala composite widgets/mywidget.vala
parentInitial commit. (diff)
downloadmeson-upstream.tar.xz
meson-upstream.zip
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--manual tests/7 vala composite widgets/mywidget.vala41
1 files changed, 41 insertions, 0 deletions
diff --git a/manual tests/7 vala composite widgets/mywidget.vala b/manual tests/7 vala composite widgets/mywidget.vala
new file mode 100644
index 0000000..68eaecc
--- /dev/null
+++ b/manual tests/7 vala composite widgets/mywidget.vala
@@ -0,0 +1,41 @@
+using Gtk;
+
+[GtkTemplate (ui = "/org/foo/my/mywidget.ui")]
+public class MyWidget : Box {
+ public string text {
+ get { return entry.text; }
+ set { entry.text = value; }
+ }
+
+ [GtkChild]
+ private Entry entry;
+
+ public MyWidget (string text) {
+ this.text = text;
+ }
+
+ [GtkCallback]
+ private void on_button_clicked (Button button) {
+ print ("The button was clicked with entry text: %s\n", entry.text);
+ }
+
+ [GtkCallback]
+ private void on_entry_changed (Editable editable) {
+ print ("The entry text changed: %s\n", entry.text);
+
+ notify_property ("text");
+ }
+}
+
+void main(string[] args) {
+ Gtk.init (ref args);
+ var win = new Window();
+ win.destroy.connect (Gtk.main_quit);
+
+ var widget = new MyWidget ("The entry text!");
+
+ win.add (widget);
+ win.show_all ();
+
+ Gtk.main ();
+}