From 8986729622d0d368bbf6aca34f38298686376a16 Mon Sep 17 00:00:00 2001 From: NuSkooler Date: Thu, 16 Oct 2014 22:03:32 -0600 Subject: [PATCH] + Start of Views --- core/view.js | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 core/view.js diff --git a/core/view.js b/core/view.js new file mode 100644 index 00000000..d367c257 --- /dev/null +++ b/core/view.js @@ -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) { + +} \ No newline at end of file