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
77
78
79
80
81
82
83
84
85
86
|
var efl = require('efl')
var elm = require('elm')
_add_cb = function(){
var btn = new elm.Elm.Button(win);
btn.setText("elm.text", "I do nothing");
bx.packEnd(btn);
btn.setVisible(true);
}
_clear_cb = function(){
bx.clear();
}
_unpack_cb = function(btn){
bx.unpack(btn);
btn.setColor(128, 64, 0, 128)
}
win = new elm.Elm.WinStandard(null);
win.setTitle("Box example");
win.setAutohide(true);
bg = new elm.Elm.Bg(win);
bg.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(bg);
bg.setVisible(true);
bigbox = new elm.Elm.Box(win)
bigbox.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(bigbox);
bx = new elm.Elm.Box(win)
bx.setSizeHintWeight(1.0, 1.0);
bx.setHorizontal(true);
bigbox.packEnd(bx);
bx.setVisible(true);
bt = new elm.Elm.Button(win);
bt.textSet("elm.text", "Add");
bx.packEnd(bt);
bt.setVisible(true);
bt.on('clicked', _add_cb);
bt = new elm.Elm.Button(win);
bt.textSet("elm.text", "Clear");
bx.packEnd(bt);
bt.setVisible(true);
bt.on('clicked', _clear_cb);
bx = new elm.Elm.Box(win)
bx.setSizeHintWeight(1.0, 1.0);
bx.setSizeHintAlign(-1.0, -1.0);
bx.setHorizontal(true);
bigbox.packEnd(bx);
bx.setVisible(true);
bt = new elm.Elm.Button(win);
bt.textSet("elm.text", "Button 1");
bx.packEnd(bt);
bt.setSizeHintWeight(1.0, 1.0);
bt.setSizeHintAlign(-1.0, -1.0);
bt.setVisible(true);
bt.on('clicked', _unpack_cb);
bt = new elm.Elm.Button(win);
bt.textSet("elm.text", "Button 2");
bx.packEnd(bt);
bt.setSizeHintWeight(1.0, 0.0);
bt.setSizeHintAlign(1.0, 0.5);
bt.setVisible(true);
bt.on('clicked', _unpack_cb);
bt = new elm.Elm.Button(win);
bt.textSet("elm.text", "Button 3");
bx.packEnd(bt);
bt.setVisible(true);
bt.on('clicked', _unpack_cb);
bigbox.setVisible(true);
win.setSize(300, 320);
win.setVisible(true);
console.log("Going to wait now\n");
|