-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathstacksidebar.vala
52 lines (41 loc) · 1.18 KB
/
stacksidebar.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
/*
* The StackSidebar works in a similar way to the StackSwitcher, however it
* offers the choice of visible child in the Stack via a sidebar, with each item
* listed vertically.
*
* Compile using:
* valac stacksidebar.vala --pkg gtk+-3.0
*
* Author: Andrew Steele
*/
using Gtk;
public class Example : Window
{
public Example()
{
this.title = "StackSidebar";
this.destroy.connect(Gtk.main_quit);
var grid = new Grid();
this.add(grid);
var stacksidebar = new StackSidebar();
grid.attach(stacksidebar, 0, 0, 1, 1);
var stack = new Stack();
stack.set_vexpand(true);
stack.set_hexpand(true);
stacksidebar.set_stack(stack);
grid.attach(stack, 1, 0, 1, 1);
var label1 = new Label("Page 1 of Stack");
stack.add_titled(label1, "Page1", "Page 1");
var label2 = new Label("Page 2 of Stack");
stack.add_titled(label2, "Page2", "Page 2");
}
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;
}
}