forked from gerito1/vala-gtk-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
popover.vala
55 lines (42 loc) · 1.35 KB
/
popover.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
/*
* The Popover provides a menu, much like the Menu widget. The major difference
* however is the ability add a variety of sub-widgets as children.
*/
using Gtk;
public class Example : Window
{
private Gtk.Popover popover;
public Example()
{
this.title = "Popover";
this.destroy.connect(Gtk.main_quit);
var box = new Gtk.Box(Gtk.Orientation.VERTICAL, 5);
this.add(box);
var button = new Gtk.Button.with_label("Popover Launcher");
button.clicked.connect(on_button_clicked);
box.add(button);
popover = new Gtk.Popover(button);
popover.set_position(Gtk.PositionType.RIGHT);
var box2 = new Gtk.Box(Gtk.Orientation.VERTICAL, 5);
popover.add(box2);
var label = new Gtk.Label("A Label Widget");
box2.add(label);
var checkbutton = new Gtk.CheckButton.with_label("A CheckButton Widget");
box2.add(checkbutton);
var radiobutton = new Gtk.RadioButton.with_label(null, "A RadioButton Widget");
box2.add(radiobutton);
}
private void on_button_clicked()
{
popover.show_all();
}
public static int main(string[] args)
{
Gtk.init(ref args);
var window = new Example();
window.set_default_size(200, 200);
window.show_all();
Gtk.main();
return 0;
}
}