1 jls.loader.provide('jls.win32.DeviceContext');
  2 
  3 jls.loader.requireLibrary('jls_win32');
  4 
  5 jls.loader.require('jls.win32.Window');
  6 jls.loader.require('jls.win32.Font');
  7 jls.loader.require('jls.win32.Pen');
  8 jls.loader.require('jls.win32.Brush');
  9 
 10 jls.win32.DeviceContext = jls.lang.Class.create(
 11 {
 12     initialize : function(window) {
 13         if (! (window instanceof jls.win32.Window)) {
 14             throw new jls.lang.Exception('Invalid window argument type (' + (typeof window) + ')');
 15         }
 16         this._no = new _native.win32.DeviceContext(window._no);
 17     },
 18     drawText : function(text, left, top, right, bottom, count, flags) {
 19         this._no.drawText(text, left, top, right, bottom, count || -1, flags || jls.win32.DeviceContext.DT_LEFT);
 20         return this;
 21     },
 22     setDIBits : function(buffer, width, height, left, top, topDown) {
 23         this._no.setDIBits(buffer._barray, width, height, left, top, topDown);
 24         return this;
 25     },
 26     stretchDIBits : function(buffer, width, height, destWidth, destHeight, topDown) {
 27         this._no.stretchDIBits(buffer._barray, width, height, destWidth, destHeight, topDown);
 28         return this;
 29     },
 30     selectObject : function(obj) {
 31         if (! ((obj instanceof jls.win32.Font) || (obj instanceof jls.win32.Brush) || (obj instanceof jls.win32.Pen))) {
 32             throw new jls.lang.Exception('Invalid Object argument type (' + (typeof obj) + ')');
 33         }
 34         this._no.selectObject(obj._no);
 35         return this;
 36     },
 37     setBkMode : function(transparent) {
 38         this._no.setBkMode(transparent);
 39         return this;
 40     },
 41     setTextColor : function(r, g, b) {
 42         this._no.setTextColor(r, g, b);
 43         return this;
 44     },
 45     setBkColor : function(r, g, b) {
 46         this._no.setBkColor(r, g, b);
 47         return this;
 48     },
 49     rectangle : function(left, top, right, bottom, width, height) {
 50         this._no.rectangle(left, top, right, bottom, width, height);
 51         return this;
 52     },
 53     ellipse : function(left, top, right, bottom, width, height) {
 54         this._no.ellipse(left, top, right, bottom, width, height);
 55         return this;
 56     },
 57     fillRect : function(left, top, right, bottom, brush) {
 58         this._no.fillRect(left, top, right, bottom, brush._no);
 59         return this;
 60     },
 61     release : function() {
 62         this._no.release();
 63         this._no = null;
 64         return this;
 65     }
 66 });
 67 
 68 /*Object.extend(jls.win32.DeviceContext,
 69 {
 70     _nop : null,
 71     nop : function() {
 72     }
 73 });*/
 74 
 75 Object.inheritConstants(jls.win32.DeviceContext, _native.win32.DeviceContext);
 76