2014-12-09 10:41:16 -08:00
|
|
|
|
|
|
|
var efl = require('efl')
|
|
|
|
|
|
|
|
_add_cb = function(){
|
2017-05-18 17:23:58 -07:00
|
|
|
var btn = new efl.Efl.Ui.Button(win);
|
|
|
|
btn.setText("I do nothing");
|
2014-12-09 10:41:16 -08:00
|
|
|
bx.packEnd(btn);
|
|
|
|
btn.setVisible(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
_clear_cb = function(){
|
2016-07-26 14:21:02 -07:00
|
|
|
bx.clearPack();
|
2014-12-09 10:41:16 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
_unpack_cb = function(btn){
|
|
|
|
bx.unpack(btn);
|
|
|
|
btn.setColor(128, 64, 0, 128)
|
|
|
|
}
|
|
|
|
|
2017-05-18 17:23:58 -07:00
|
|
|
win = new efl.Efl.Ui.Win(null, "Efl JS Example", efl.Efl.Ui.Win.Type.BASIC, "hw");
|
2016-07-26 14:21:02 -07:00
|
|
|
win.setText("Box example");
|
2014-12-09 10:41:16 -08:00
|
|
|
win.setAutohide(true);
|
|
|
|
|
2016-07-26 14:21:02 -07:00
|
|
|
bigbox = new efl.Efl.Ui.Box(win)
|
|
|
|
bigbox.setHintWeight(1.0, 1.0);
|
2016-12-07 09:49:43 -08:00
|
|
|
win.setContent(bigbox);
|
2014-12-09 10:41:16 -08:00
|
|
|
|
2016-07-26 14:21:02 -07:00
|
|
|
bx = new efl.Efl.Ui.Box(win);
|
|
|
|
bx.setHintWeight(1.0, 1.0);
|
2017-08-22 21:39:10 -07:00
|
|
|
bx_orient = bx.cast("Efl.Ui.Direction");
|
|
|
|
bx_orient.setOrientation(efl.Efl.Ui.Dir.VERTICAL);
|
2014-12-09 10:41:16 -08:00
|
|
|
bigbox.packEnd(bx);
|
|
|
|
bx.setVisible(true);
|
|
|
|
|
2017-05-18 17:23:58 -07:00
|
|
|
bt = new efl.Efl.Ui.Button(win);
|
|
|
|
bt.setText("Add");
|
2014-12-09 10:41:16 -08:00
|
|
|
bx.packEnd(bt);
|
|
|
|
bt.setVisible(true);
|
|
|
|
bt.on('clicked', _add_cb);
|
|
|
|
|
2017-05-18 17:23:58 -07:00
|
|
|
bt = new efl.Efl.Ui.Button(win);
|
|
|
|
bt.setText("Clear");
|
2014-12-09 10:41:16 -08:00
|
|
|
bx.packEnd(bt);
|
|
|
|
bt.setVisible(true);
|
|
|
|
bt.on('clicked', _clear_cb);
|
|
|
|
|
2016-07-26 14:21:02 -07:00
|
|
|
bx = new efl.Efl.Ui.Box(win)
|
|
|
|
bx.setHintWeight(1.0, 1.0);
|
|
|
|
bx.setHintAlign(-1.0, -1.0);
|
2017-08-22 21:39:10 -07:00
|
|
|
bx_orient = bx.cast("Efl.Ui.Direction");
|
|
|
|
bx_orient.setDirection(efl.Efl.Ui.Dir.HORIZONTAL);
|
2014-12-09 10:41:16 -08:00
|
|
|
bigbox.packEnd(bx);
|
|
|
|
bx.setVisible(true);
|
|
|
|
|
2017-05-18 17:23:58 -07:00
|
|
|
bt = new efl.Efl.Ui.Button(win);
|
|
|
|
bt.setText("Button 1");
|
2014-12-09 10:41:16 -08:00
|
|
|
bx.packEnd(bt);
|
2016-07-26 14:21:02 -07:00
|
|
|
bt.setHintWeight(1.0, 1.0);
|
|
|
|
bt.setHintAlign(-1.0, -1.0);
|
2014-12-09 10:41:16 -08:00
|
|
|
bt.setVisible(true);
|
|
|
|
bt.on('clicked', _unpack_cb);
|
|
|
|
|
2017-05-18 17:23:58 -07:00
|
|
|
bt = new efl.Efl.Ui.Button(win);
|
|
|
|
bt.setText("Button 2");
|
2014-12-09 10:41:16 -08:00
|
|
|
bx.packEnd(bt);
|
2016-07-26 14:21:02 -07:00
|
|
|
bt.setHintWeight(1.0, 0.0);
|
|
|
|
bt.setHintAlign(1.0, 0.5);
|
2014-12-09 10:41:16 -08:00
|
|
|
bt.setVisible(true);
|
|
|
|
bt.on('clicked', _unpack_cb);
|
|
|
|
|
2017-05-18 17:23:58 -07:00
|
|
|
bt = new efl.Efl.Ui.Button(win);
|
|
|
|
bt.setText("Button 3");
|
2014-12-09 10:41:16 -08:00
|
|
|
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");
|