-
Notifications
You must be signed in to change notification settings - Fork 0
/
doupdate.vala
57 lines (46 loc) · 1018 Bytes
/
doupdate.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
using Curses;
using Posix;
public class Demo {
public MainLoop loop;
private TimeoutSource time;
public Demo() {
loop = new MainLoop();
time = new TimeoutSource (5000);
time.set_callback (() => { loop.quit(); return false; });
time.attach(loop.get_context());
}
public void start() {
initscr();
noecho();
}
public void stop() {
endwin();
}
private Window window1;
private Window window2;
public void activate() {
window1 = new Window(5, 20, 1, 1);
window1.box(0, 0);
window1.mvprintw(1, 1, "I am in window 1");
window1.noutrefresh();
window2 = new Window(5, 20, 1, 21);
window2.box(0, 0);
window2.mvprintw(1, 1, "I am in window 2");
window2.noutrefresh();
}
public void run() {
loop.run();
}
public void redraw() {
doupdate();
}
static int main(string[] args) {
var app = new Demo();
app.start();
app.activate();
app.redraw();
app.run();
app.stop();
return EXIT_SUCCESS;
}
}