1 jls.loader.provide('jls.win32.Frame'); 2 3 jls.loader.require('jls.win32.WindowElement'); 4 5 jls.win32.Frame = jls.lang.Class.create(jls.win32.WindowElement, 6 { 7 initialize : function($super, parameters, parent) { 8 $super(parameters, parent); 9 this._windowId = 0; 10 this._childSize = this.getStyle().getPropertyValue('childSize'); 11 if (this._childSize == null) { 12 this._childSize = 'auto'; 13 } 14 if (this._childSize == 'auto') { 15 this.observe('resize', this.onResize.bind(this)); 16 } 17 this.setBounds(this._getBounds()); 18 19 this._window.show(this.getStyle().getPropertyValue('visibility') == 'visible' ? jls.win32.Window.SW_SHOW : jls.win32.Window.SW_HIDE); 20 this._window.update(); 21 }, 22 onCreate : function() { 23 var x = (this.getX() != null) ? this.getX() : jls.win32.Window.CW_USEDEFAULT; 24 var y = (this.getY() != null) ? this.getY() : jls.win32.Window.CW_USEDEFAULT; 25 var w = (this.getW() != null) ? this.getW() : jls.win32.Window.CW_USEDEFAULT; 26 var h = (this.getH() != null) ? this.getH() : jls.win32.Window.CW_USEDEFAULT; 27 this._window = new jls.win32.Window(jls.win32.Frame.classname, this.getTitle(), this.getWindowStyle(), 28 x, y, w, h, 29 this.getParentWindow(true), this.getWindowId(), this.getWindowExStyle()); 30 }, 31 createDefaultLayout : function() { 32 return new jls.gui.FlowLayout(this); 33 }, 34 onResize : function(event) { 35 jls.logger.debug('Frame resized to ' + event.width + 'x' + event.height); 36 this.setBounds([0, 0, event.width, event.height]); 37 this.update(); 38 }, 39 onWindowUpdate : jls.lang.Class.emptyFunction, 40 getWindowStyle : function() { 41 return jls.win32.Window.WS_OVERLAPPEDWINDOW; 42 } 43 }); 44 45 Object.extend(jls.win32.Frame, 46 { 47 classname : 'JLSFrameClass' 48 }); 49 50 jls.win32.Window.registerClass(jls.win32.Frame.classname); 51 52