1 jls.loader.provide('jls.win32.EditElement');
  2 
  3 jls.loader.require('jls.win32.WindowElement');
  4 jls.loader.require('jls.win32.Edit');
  5 
  6 jls.win32.EditElement = jls.lang.Class.create(jls.win32.WindowElement,
  7 {
  8     initialize : function($super, parameters, parent) {
  9         this._text = '';
 10         this._readonly = false;
 11         this._password = false;
 12         $super(parameters, parent);
 13     },
 14     onCreate : function() {
 15         this._window = new jls.win32.Edit(this.getText(), this.getWindowStyle(),
 16                 this.getX(), this.getY(), this.getW(), this.getH(),
 17                 this.getParentWindow(true), this.getWindowId(true), this.getWindowExStyle());
 18     },
 19     getWindowStyle : function($super) {
 20     	var style = $super();
 21     	if (this.getStyle().getPropertyValue('border') != null) {
 22     		style |= jls.win32.Window.WS_BORDER;
 23     	}
 24         // TODO Fix
 25     	//if (this.getStyle().getPropertyValue('overflow') == 'auto') {
 26     		style |= jls.win32.Edit.ES_AUTOVSCROLL | jls.win32.Edit.ES_AUTOHSCROLL;
 27     	//}
 28     	if (this._password) {
 29     		style |= jls.win32.Edit.ES_PASSWORD;
 30     	}
 31     	if (this._readonly) {
 32     		style |= jls.win32.Edit.ES_READONLY;
 33     	}
 34         return style;
 35     },
 36     setSelection : function(start, end) {
 37         this._window.setSelection(start, end);
 38     },
 39     replaceSelection : function(text) {
 40         this._window.replaceSelection(text);
 41     },
 42     replaceLastLine : function(text) {
 43         this._window.replaceLastLine(text);
 44     },
 45     appendText : function(text) {
 46         this._window.appendText(text);
 47     },
 48     getReadonly : function() {
 49         return this._readonly;
 50     },
 51     setReadonly : function(value) {
 52         this._readonly = value;
 53         return this;
 54     },
 55     getPassword : function() {
 56         return this._password;
 57     },
 58     setPassword : function(value) {
 59         this._password = value;
 60         return this;
 61     },
 62     getText : function() {
 63         if (this._window != null) {
 64             this._text = this._window.getText();
 65         }
 66         return this._text;
 67     },
 68     setText : function(value) {
 69         if (this._window != null) {
 70             this._window.setText(value);
 71         }
 72         this._text = value;
 73         return this;
 74     }
 75 });
 76 
 77