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