+ Start of Views
This commit is contained in:
51
core/view.js
Normal file
51
core/view.js
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
/* jslint node: true */
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var util = require('util');
|
||||||
|
var ansi = require('./ansi_term.js');
|
||||||
|
|
||||||
|
exports.View = View;
|
||||||
|
exports.LabelView = LabelView;
|
||||||
|
|
||||||
|
function View(client) {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
console.log('View ctor');
|
||||||
|
|
||||||
|
this.client = client;
|
||||||
|
|
||||||
|
// this.width = width;
|
||||||
|
// this.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
// :TODO: allow pos[] or x, y
|
||||||
|
View.prototype.draw = function(x, y) {
|
||||||
|
};
|
||||||
|
|
||||||
|
function LabelView(client, text, width) {
|
||||||
|
View.call(this, client);
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
this.text = text;
|
||||||
|
this.width = width || text.length;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
util.inherits(LabelView, View);
|
||||||
|
|
||||||
|
LabelView.prototype.draw = function(x, y) {
|
||||||
|
LabelView.super_.prototype.draw.call(this, x, y);
|
||||||
|
|
||||||
|
this.client.term.write(ansi.goto(x, y));
|
||||||
|
this.client.term.write(this.text);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function MenuView(options) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function VerticalMenuView(options) {
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user