1 jls.loader.provide('jls.win32.ComboBoxElement'); 2 3 jls.loader.require('jls.win32.WindowElement'); 4 jls.loader.require('jls.win32.ComboBox'); 5 6 jls.win32.ComboBoxElement = jls.lang.Class.create(jls.win32.WindowElement, 7 { 8 initialize : function($super, parameters, parent) { 9 this._text = ''; 10 // TODO Fix this 11 this._comboHeight = 100; 12 $super(parameters, parent); 13 //jls.logger.warn('jls.win32.ComboBoxElement id: ' + this._windowId + ', handle: ' + this._window.handle()); 14 }, 15 onCreate : function() { 16 this._window = new jls.win32.ComboBox(this.getText(), this.getWindowStyle(), 17 this.getX(), this.getY(), this.getW(), this.getH(), 18 this.getParentWindow(true), this.getWindowId(true), this.getWindowExStyle()); 19 }, 20 onWindowMessage: function($super, message, wParam, lParam) { 21 //jls.logger.warn('onWindowMessage(' + jls.win32.Window.getMessageName(message) + ', ' + wParam + ', ' + lParam + ')'); 22 switch(message) { 23 case jls.win32.Window.WM_CTLNOTIFY: 24 //jls.logger.warn('onCtlNotify(' + jls.win32.Window.getMessageName(lParam, jls.win32.ComboBox, 'CBN_') + ')'); 25 if (wParam != this._windowId) { 26 break; 27 } 28 switch(lParam) { 29 case jls.win32.ComboBox.CBN_SELENDOK : // jls.win32.ComboBox.CBN_SELCHANGE: 30 var event = new jls.gui.Event('change', this); 31 this.dispatch(event); 32 break; 33 } 34 35 break; 36 } 37 $super(message, wParam, lParam); 38 }, 39 getWindowStyle : function($super) { 40 return $super() | jls.win32.ComboBox.CBS_DROPDOWN | jls.win32.ComboBox.CBS_HASSTRINGS; 41 }, 42 getComboHeight : function() { 43 return this._comboHeight; 44 }, 45 setComboHeight : function(comboHeight) { 46 this._comboHeight = comboHeight; 47 }, 48 getText : function() { 49 if (this._window != null) { 50 return this._window.getCurrentSelectionText(); 51 } 52 return this._text; 53 }, 54 setText : function(value) { 55 if (this._window != null) { 56 // TODO 57 this._window.setText(value); 58 } 59 this._text = value; 60 return this; 61 }, 62 addChild : function(child) { 63 if (this._window != null) { 64 this._window.addString(child.toString()); 65 //this._children.push(child); 66 } 67 return this; 68 } 69 }); 70 71