mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-08-02 16:01:55 +02:00
* A bit of work on VerticalMenuView
* Inheritance updates for Views * Fixes and better handling of MCI factory
This commit is contained in:
parent
c3aa4c44e2
commit
edc8266310
12 changed files with 125 additions and 73 deletions
|
@ -3,26 +3,39 @@
|
|||
|
||||
var View = require('./view.js').View;
|
||||
var ansi = require('./ansi_term.js');
|
||||
var miscUtil = require('./misc_util.js');
|
||||
var util = require('util');
|
||||
var assert = require('assert');
|
||||
|
||||
exports.MenuView = MenuView;
|
||||
|
||||
function MenuView(client, options) {
|
||||
options.acceptsFocus = miscUtil.valueWithDefault(options.acceptsFocus, true);
|
||||
var self = this;
|
||||
|
||||
View.call(this, client, options);
|
||||
|
||||
this.focusedItemIndex = 0;
|
||||
|
||||
|
||||
//// --- TESTING
|
||||
options.items = [ 'Login', 'Apply', 'Logout' ];
|
||||
//options.itemSpacing = 2;
|
||||
//// --- TESTING
|
||||
|
||||
this.items = [];
|
||||
if(this.options.items) {
|
||||
this.options.items.forEach(function onItem(itemText) {
|
||||
this.items.push({
|
||||
self.items.push({
|
||||
text : itemText,
|
||||
focused : false,
|
||||
selected : false,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
this.itemSpacing = this.options.itemSpacing || 1;
|
||||
this.itemSpacing = parseInt(this.itemSpacing, 10);
|
||||
|
||||
this.focusPrefix = this.options.focusPrefix || '';
|
||||
this.focusSuffix = this.options.focusSuffix || '';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue