mirror of
https://github.com/danbulant/node-x11
synced 2026-05-22 22:09:14 +00:00
drawing requests wrappers, set/get title, 'handle' helper
This commit is contained in:
parent
71f6317e92
commit
2e280aa78f
1 changed files with 28 additions and 2 deletions
|
|
@ -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;
|
||||
Loading…
Reference in a new issue