-
Notifications
You must be signed in to change notification settings - Fork 0
/
FGtkWindow.vala
76 lines (66 loc) · 2.44 KB
/
FGtkWindow.vala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using FGtk;
int main (string[] args) {
Gtk.init (ref args);
new Window (
(widget) => {
widget.title = "First FGtk Program";
widget.border_width = 10;
widget.window_position = Gtk.WindowPosition.CENTER;
widget.set_default_size (350, 70);
widget.destroy.connect (Gtk.main_quit);
widget.show_all ();
},
new Box (
// here you have a lambda function that
// modifies the container's properties
(widget) => {
widget.orientation = Gtk.Orientation.VERTICAL;
widget.spacing = 6;
widget.get_style_context ().add_class ("StyleClassForBoxes");
widget.margin = 12;
},
// here you have an array with all its children
{
new Button (
(widget) => {
widget.label = "";
widget.hexpand = false;
widget.vexpand = false;
widget.get_style_context ().add_class ("flat");
widget.clicked.connect (() => {
//some action
});
},
// here there is no {} (array braces), because Button is a
// Gtk.Bin, which means it can only hold one widget at a time.
new Gtk.Image.from_icon_name ("distributor-logo-symbolic", Gtk.IconSize.BUTTON)
),
new Box (
(widget) => {
widget.orientation = Gtk.Orientation.HORIZONTAL;
widget.spacing = 6;
widget.get_style_context ().add_class ("StyleClassForBoxes");
},
{
new Button (
(widget) => {
widget.label = "Hello, World!";
widget.clicked.connect (() => {
//some action
some_function ();
});
}
),
new Button.with_label ("Yeet")
}
)
}
)
);
Gtk.main ();
return 0;
}
void some_function () {
//do something
print ("YEET!\n");
}