-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtest.js
50 lines (50 loc) · 1.45 KB
/
test.js
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
var gtk;
console.log('test.js');
gtk = require('./build/default/gtk');
process.nextTick(function() {
var button, entry, hbox, hbox2, hbox3, img, progress_hbox, progressbar, window;
gtk.init();
window = new gtk.Window;
hbox = new gtk.Hbox;
progress_hbox = new gtk.Hbox;
window.add(hbox);
hbox2 = new gtk.Hbox;
hbox3 = new gtk.Hbox;
entry = new gtk.Entry;
progressbar = new gtk.ProgressBar;
hbox.add(hbox2);
hbox.add(hbox3);
hbox.add(progress_hbox);
progress_hbox.add(progressbar);
progressbar.setFraction(0.45);
entry.setText('A teeheehee!');
entry.setVisibility(true);
entry.on('changed', function() {
return console.log('changed');
});
button = new gtk.Button;
button.setLabel('Test Button');
img = new gtk.Image;
img.setFromFile('./data/ngtk.png');
button.setImage(img);
button.on('clicked', function() {
var dialog;
console.log('clicked');
dialog = new gtk.MessageDialog(window, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, 'Node.js + GTK <3');
return dialog.show();
});
hbox2.add(button);
hbox3.add(entry);
window.setTitle('Node');
window.setResizable(true);
window.setDefaultSize();
window.on('destroy', function() {
console.log(window.getOpacity());
console.log(window.getPosition());
console.log(window.getSize());
console.log(window.getResizable(true));
console.log(window.getTitle());
return console.log('OMG');
});
return window.show();
});