2013-07-18 22:56:05 +00:00
|
|
|
var blessed = require('../')
|
2013-07-28 19:29:07 +00:00
|
|
|
, screen;
|
|
|
|
|
2014-01-12 01:32:43 +00:00
|
|
|
var auto = true;
|
|
|
|
|
2013-07-28 19:29:07 +00:00
|
|
|
screen = blessed.screen({
|
2014-01-12 01:28:14 +00:00
|
|
|
dump: __dirname + '/logs/listbar.log',
|
2015-07-22 02:23:57 +00:00
|
|
|
autoPadding: auto,
|
|
|
|
warnings: true
|
2013-07-28 19:29:07 +00:00
|
|
|
});
|
2013-07-17 15:29:42 +00:00
|
|
|
|
2014-01-11 22:52:33 +00:00
|
|
|
var box = blessed.box({
|
|
|
|
parent: screen,
|
|
|
|
top: 0,
|
|
|
|
right: 0,
|
|
|
|
width: 'shrink',
|
|
|
|
height: 'shrink',
|
|
|
|
content: '...'
|
|
|
|
});
|
|
|
|
|
2013-07-17 15:29:42 +00:00
|
|
|
var bar = blessed.listbar({
|
2015-07-18 01:52:07 +00:00
|
|
|
//parent: screen,
|
2013-07-17 15:29:42 +00:00
|
|
|
bottom: 0,
|
2014-01-12 01:28:14 +00:00
|
|
|
left: 3,
|
|
|
|
right: 3,
|
2014-01-12 01:32:43 +00:00
|
|
|
height: auto ? 'shrink' : 3,
|
2013-07-17 15:29:42 +00:00
|
|
|
mouse: true,
|
|
|
|
keys: true,
|
2014-01-12 00:54:26 +00:00
|
|
|
autoCommandKeys: true,
|
2015-04-04 06:43:24 +00:00
|
|
|
border: 'line',
|
2014-01-11 22:52:33 +00:00
|
|
|
vi: true,
|
2013-07-17 15:29:42 +00:00
|
|
|
style: {
|
|
|
|
bg: 'green',
|
|
|
|
item: {
|
|
|
|
bg: 'red',
|
|
|
|
hover: {
|
|
|
|
bg: 'blue'
|
|
|
|
},
|
2014-01-11 22:52:33 +00:00
|
|
|
//focus: {
|
|
|
|
// bg: 'blue'
|
|
|
|
//}
|
2013-07-17 15:29:42 +00:00
|
|
|
},
|
2014-01-11 22:52:33 +00:00
|
|
|
selected: {
|
|
|
|
bg: 'blue'
|
|
|
|
}
|
2013-07-17 15:29:42 +00:00
|
|
|
},
|
2014-01-11 22:52:33 +00:00
|
|
|
commands: {
|
2014-01-12 03:02:19 +00:00
|
|
|
'one': {
|
|
|
|
keys: ['a'],
|
|
|
|
callback: function() {
|
|
|
|
box.setContent('Pressed one.');
|
|
|
|
screen.render();
|
|
|
|
}
|
2014-01-11 22:52:33 +00:00
|
|
|
},
|
|
|
|
'two': function() {
|
|
|
|
box.setContent('Pressed two.');
|
|
|
|
screen.render();
|
|
|
|
},
|
|
|
|
'three': function() {
|
|
|
|
box.setContent('Pressed three.');
|
|
|
|
screen.render();
|
|
|
|
},
|
|
|
|
'four': function() {
|
|
|
|
box.setContent('Pressed four.');
|
|
|
|
screen.render();
|
|
|
|
},
|
|
|
|
'five': function() {
|
|
|
|
box.setContent('Pressed five.');
|
|
|
|
screen.render();
|
|
|
|
},
|
|
|
|
'six': function() {
|
|
|
|
box.setContent('Pressed six.');
|
|
|
|
screen.render();
|
|
|
|
},
|
|
|
|
'seven': function() {
|
|
|
|
box.setContent('Pressed seven.');
|
|
|
|
screen.render();
|
|
|
|
},
|
|
|
|
'eight': function() {
|
|
|
|
box.setContent('Pressed eight.');
|
|
|
|
screen.render();
|
|
|
|
},
|
|
|
|
'nine': function() {
|
|
|
|
box.setContent('Pressed nine.');
|
|
|
|
screen.render();
|
|
|
|
},
|
|
|
|
'ten': function() {
|
|
|
|
box.setContent('Pressed ten.');
|
|
|
|
screen.render();
|
|
|
|
},
|
|
|
|
'eleven': function() {
|
|
|
|
box.setContent('Pressed eleven.');
|
|
|
|
screen.render();
|
|
|
|
},
|
|
|
|
'twelve': function() {
|
|
|
|
box.setContent('Pressed twelve.');
|
|
|
|
screen.render();
|
|
|
|
},
|
|
|
|
'thirteen': function() {
|
|
|
|
box.setContent('Pressed thirteen.');
|
|
|
|
screen.render();
|
|
|
|
},
|
|
|
|
'fourteen': function() {
|
|
|
|
box.setContent('Pressed fourteen.');
|
|
|
|
screen.render();
|
|
|
|
},
|
|
|
|
'fifteen': function() {
|
|
|
|
box.setContent('Pressed fifteen.');
|
|
|
|
screen.render();
|
|
|
|
}
|
|
|
|
}
|
2013-07-17 15:29:42 +00:00
|
|
|
});
|
|
|
|
|
2015-07-18 01:52:07 +00:00
|
|
|
screen.append(bar);
|
|
|
|
|
2013-07-17 15:29:42 +00:00
|
|
|
bar.focus();
|
|
|
|
|
|
|
|
screen.key('q', function() {
|
2015-08-08 04:00:31 +00:00
|
|
|
return screen.destroy();
|
2013-07-17 15:29:42 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
screen.render();
|