mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-07-25 20:18:25 +02:00
+ ToggleMenuView
* Start of hotkeys for menus * General menu cleanup & rework
This commit is contained in:
parent
10d8812300
commit
028c5be418
10 changed files with 172 additions and 9 deletions
|
@ -4,8 +4,10 @@
|
|||
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');
|
||||
var _ = require('lodash');
|
||||
|
||||
exports.MenuView = MenuView;
|
||||
|
||||
|
@ -23,6 +25,8 @@ function MenuView(options) {
|
|||
this.items = [];
|
||||
}
|
||||
|
||||
this.setHotKeys(options.hotkeys);
|
||||
|
||||
this.focusedItemIndex = options.focusedItemIndex || 0;
|
||||
this.focusedItemIndex = this.items.length >= this.focusedItemIndex ? this.focusedItemIndex : 0;
|
||||
|
||||
|
@ -35,6 +39,7 @@ function MenuView(options) {
|
|||
this.fillChar = miscUtil.valueWithDefault(options.fillChar, ' ').substr(0, 1);
|
||||
this.justify = options.justify || 'none';
|
||||
|
||||
/*
|
||||
this.moveSelection = function(fromIndex, toIndex) {
|
||||
assert(!self.positionCacheExpired);
|
||||
assert(fromIndex >= 0 && fromIndex <= self.items.length);
|
||||
|
@ -47,6 +52,7 @@ function MenuView(options) {
|
|||
self.focusedItemIndex = toIndex;
|
||||
self.drawItem(toIndex);
|
||||
};
|
||||
*/
|
||||
|
||||
/*
|
||||
this.cachePositions = function() {
|
||||
|
@ -97,3 +103,9 @@ MenuView.prototype.setItems = function(items) {
|
|||
}
|
||||
};
|
||||
|
||||
MenuView.prototype.setHotKeys = function(hotkeys) {
|
||||
if(_.isObject(hotkeys)) {
|
||||
this.hotkeys = hotkeys;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue