1 jls.loader.provide('jls.win32.Edit');
  2 
  3 jls.loader.require('jls.win32.Window');
  4 
  5 jls.win32.Edit = jls.lang.Class.create(jls.win32.Window,
  6 {
  7     initialize : function($super, name, style, x, y, w, h, parent, id, exStyle, param) {
  8         $super(jls.win32.Edit.CLASSNAME, name, style, x, y, w, h, parent, id, exStyle, param);
  9     },
 10     setSelection : function(start, end) {
 11     	if (typeof start == 'undefined') {
 12     		start = -1;
 13     	}
 14     	if (typeof end == 'undefined') {
 15     		start = -1;
 16     	}
 17         this.sendMessage(jls.win32.Edit.EM_SETSEL, start, end);
 18     },
 19     appendText : function(text) {
 20         this.setSelection(-1, -1);
 21         this.replaceSelection(text);
 22     },
 23     replaceLastLine : function(text) {
 24         var lineCount = this.sendMessage(jls.win32.Edit.EM_GETLINECOUNT);
 25         var lineIndex = this.sendMessage(jls.win32.Edit.EM_LINEINDEX, lineCount - 1);
 26         var textLength = this.getTextLength();
 27         //jls.logger.warn('replaceLastLine() lineCount: ' + lineCount + ', lineIndex: ' + lineIndex + ', textLength: ' + textLength);
 28         this.setSelection(lineIndex, -1);
 29         this.replaceSelection(text);
 30     },
 31     replaceSelection : function(text) {
 32         this.sendMessage(jls.win32.Edit.EM_REPLACESEL, 0, text, true);
 33     }
 34 });
 35 
 36 Object.extend(jls.win32.Edit,
 37 {
 38     ES_AUTOHSCROLL           : 0x00000080,
 39     ES_AUTOVSCROLL           : 0x00000040,
 40     ES_CENTER                : 0x00000001,
 41     ES_LEFT                  : 0x00000000,
 42     ES_LOWERCASE             : 0x00000010,
 43     ES_MULTILINE             : 0x00000004,
 44     ES_NOHIDESEL             : 0x00000100,
 45     ES_NUMBER                : 0x00002000,
 46     ES_OEMCONVERT            : 0x00000400,
 47     ES_PASSWORD              : 0x00000020,
 48     ES_READONLY              : 0x00000800,
 49     ES_RIGHT                 : 0x00000002,
 50     ES_UPPERCASE             : 0x00000008,
 51     ES_WANTRETURN            : 0x00001000,
 52     
 53     EM_CANUNDO               : 0x000000c6,
 54     EM_CHARFROMPOS           : 0x000000d7,
 55     EM_EMPTYUNDOBUFFER       : 0x000000cd,
 56     EM_FMTLINES              : 0x000000c8,
 57     EM_GETFIRSTVISIBLELINE   : 0x000000ce,
 58     EM_GETHANDLE             : 0x000000bd,
 59     EM_GETLIMITTEXT          : 0x000000d5,
 60     EM_GETLINE               : 0x000000c4,
 61     EM_GETLINECOUNT          : 0x000000ba,
 62     EM_GETMARGINS            : 0x000000d4,
 63     EM_GETMODIFY             : 0x000000b8,
 64     EM_GETPASSWORDCHAR       : 0x000000d2,
 65     EM_GETRECT               : 0x000000b2,
 66     EM_GETSEL                : 0x000000b0,
 67     EM_GETTHUMB              : 0x000000be,
 68     EM_GETWORDBREAKPROC      : 0x000000d1,
 69     EM_LIMITTEXT             : 0x000000c5,
 70     EM_LINEFROMCHAR          : 0x000000c9,
 71     EM_LINEINDEX             : 0x000000bb,
 72     EM_LINELENGTH            : 0x000000c1,
 73     EM_LINESCROLL            : 0x000000b6,
 74     EM_POSFROMCHAR           : 0x000000d6,
 75     EM_REPLACESEL            : 0x000000c2,
 76     EM_SCROLL                : 0x000000b5,
 77     EM_SCROLLCARET           : 0x000000b7,
 78     EM_SETHANDLE             : 0x000000bc,
 79     EM_SETLIMITTEXT          : 0x000000c5,
 80     EM_SETMARGINS            : 0x000000d3,
 81     EM_SETMODIFY             : 0x000000b9,
 82     EM_SETPASSWORDCHAR       : 0x000000cc,
 83     EM_SETREADONLY           : 0x000000cf,
 84     EM_SETRECT               : 0x000000b3,
 85     EM_SETRECTNP             : 0x000000b4,
 86     EM_SETSEL                : 0x000000b1,
 87     EM_SETTABSTOPS           : 0x000000cb,
 88     EM_SETWORDBREAKPROC      : 0x000000d0,
 89     EM_UNDO                  : 0x000000c7,
 90     
 91     EN_CHANGE                : 0x00000300,
 92     EN_ERRSPACE              : 0x00000500,
 93     EN_HSCROLL               : 0x00000601,
 94     EN_KILLFOCUS             : 0x00000200,
 95     EN_MAXTEXT               : 0x00000501,
 96     EN_SETFOCUS              : 0x00000100,
 97     EN_UPDATE                : 0x00000400,
 98     EN_VSCROLL               : 0x00000602,
 99 
100     CLASSNAME: 'Edit'
101 });
102