drawing requests wrappers, set/get title, 'handle' helper

This commit is contained in:
sidorares 2011-07-25 13:42:42 +10:00
parent 71f6317e92
commit 2e280aa78f

View file

@ -23,12 +23,32 @@ GraphicContext.prototype.noop = function()
//testing triggering gc creation
}
GraphicContext.prototype.drawText = function(x, y, text)
GraphicContext.prototype.rectangles = function(x, y, xyWHpoints)
{
this.xclient.PolyFillRectangle(this.win.id, this.id, xyWHpoints);
}
GraphicContext.prototype.text = function(x, y, text)
{
//console.log([0, this.win.id, this.id, x, y, [text]]);
this.xclient.PolyText8(this.win.id, this.id, x, y, [text]);
}
GraphicContext.prototype.polyLine = function(points, opts)
{
var coordinateMode = 0;
if (opts && opts.coordinateMode === 'previous')
coordinateMode = 1;
this.xclient.PolyLine(coordinateMode, this.win.id, this.id, points);
}
GraphicContext.prototype.points = function(points, opts)
{
var coordinateMode = 0;
if (opts && opts.coordinateMode === 'previous')
coordinateMode = 1;
this.xclient.PolyPoint(coordinateMode, this.win.id, this.id, points);
}
function Window(parent, x, y, w, h)
{
if (parent.constructor && parent.constructor.name == 'XClient')
@ -118,4 +138,10 @@ Window.prototype.unmap = function() {
this.xclient.UnmapWindow(this.id);
}
Window.prototype.handle = function(handlers) {
for (var eventName in handlers) {
this.on(eventName, handlers[eventName]);
}
}
module.exports = Window;