client/js/controls/window/window.js in rsence-pre-3.0.0.8 vs client/js/controls/window/window.js in rsence-pre-3.0.0.9

- old
+ new

@@ -7,17 +7,17 @@ ** See #controlDefaults ** ***/ var//RSence.Controls HWindow = HDynControl.extend({ - + componentName: 'window', - + /** = Description * In addition to the standard HControl#constructor options, * the following properties can be set: - * + * * Key:: Description * +minX+:: The minimum X-coordinate allowed to be dragged or resized to. * Defaults to +0+. * +minY+:: The minimum Y-coordinate allowed to be dragged or resized to. * Defaults to +0+. @@ -43,68 +43,34 @@ * Defaults to +[ 6, 6 ]+ * +resizeSE+:: The size of the south-east (right bottom) resizable corner. * Defaults to +[ 16, 16 ]+ * +noResize+:: A flag (when true) disables all resizing and only allows * moving. Does not disable the (-) and (+) buttons. - * +fullWindowMove+:: A flag (when true) enables the full HWindow area + * +fullWindowMove+:: A flag (when true) enables the full HWindow area * responds to drag events. By default it's false, * meaning only the title bar is draggable. * +closeButton+:: A flag (when true) enables the close button of HWindow. * By default, it's disabled. When enabled, extend the * HWindow#windowClose method. By default it destructs * the HWindow instance. * +collapseButton+:: A flag (when true) enables the collapse (or minimize) * button of the HWindow instance. By default it's - * disabled. When enabled, extend the + * disabled. When enabled, extend the * HWindow#windowCollapse method, which by default * zooms the window to its +minSize+. * +minimizeButton+:: An alias for +collapseButton+ * +zoomButton+:: A flag (when true) enables the zoom (or maximize) * button of the HWindow instance. By default it's - * disabled. When enabled, extend the + * disabled. When enabled, extend the * HWindow#windowZoom method, which by default zooms the * contents of the HWindow to fit or the +maxSize+ depending * on which is smaller. * +resizeButton+:: An alias for +zoomButton+ * +maximizeButton+:: An alias for +zoomButton+ * **/ - controlDefaults: (HDynControl.prototype.controlDefaults.extend({ - constructor: function(_ctrl){ - var _winSize = ELEM.windowSize(), - _winWidth = _winSize[0], - _winHeight = _winSize[1]; - if(!this.minSize){ - this.minSize = [96,54]; - } - if(!this.maxSize){ - this.maxSize = _winSize; - } - if(!this.maxX){ - this.maxX = _winWidth-this.minSize[0]; - } - if(!this.maxY){ - this.maxY = _winHeight-this.minSize[1]; - } - if(!this.events){ - this.events = { - draggable: true - }; - } - if(!this.resizeNW){ - this.resizeNW = [ 6, 6 ]; - } - if(!this.resizeNE){ - this.resizeNE = [ 6, 6 ]; - } - if(!this.resizeSW){ - this.resizeSW = [ 6, 6 ]; - } - if(!this.resizeSE){ - this.resizeSE = [ 25, 25 ]; - } - }, + controlDefaults: HDynControl.prototype.controlDefaults.extend({ maxX: 'auto', maxY: 'auto', maxSize: 'auto', resizeW: 4, resizeE: 4, @@ -115,12 +81,33 @@ collapseButton: false, minimizeButton: false, zoomButton: false, resizeButton: false, maximizeButton: false - })), - + }), + + customOptions: function(_options){ + var + _winSize = ELEM.windowSize(), + _winWidth = _winSize[0], + _winHeight = _winSize[1]; + if(!_options.minSize){ _options.minSize = [96,54]; } + + if(!_options.maxSize){ _options.maxSize = _winSize; } + if(!_options.maxX ){ _options.maxX = _winWidth-_options.minSize[0]; } + if(!_options.maxY ){ _options.maxY = _winHeight-_options.minSize[1]; } + + if(!_options.resizeNW){ _options.resizeNW = [ 6, 6 ]; } + if(!_options.resizeNE){ _options.resizeNE = [ 6, 6 ]; } + if(!_options.resizeSW){ _options.resizeSW = [ 6, 6 ]; } + if(!_options.resizeSE){ _options.resizeSE = [ 25, 25 ]; } + }, + + defaultEvents: { + draggable: true + }, + draw: function(){ var _drawn = this.drawn; this.base(); if(!_drawn){ HSystem.windowFocus(this); @@ -179,11 +166,11 @@ setEnabled: function(_state){ this.base(_state); this.refreshWidgetStates(); }, - + // -- overrides the drag rules to adapt to the !fullWindowMove as well // as disabling draggability in window button areas. ++ /** = Description * makeRectRules function @@ -208,11 +195,11 @@ } _rectRules[8] = [_leftPx,_opts.resizeN,_rect.width-_opts.resizeE,25]; } return _rectRules; }, - + maxRect: function(){ var _rect = this.base(), _opts = this.options; if(_rect[2]<_opts.minSize[0]){ _rect[2] = _opts.minSize[0]; } @@ -228,33 +215,33 @@ return _rect; }, hasWindowFocus: false, -/** Reports to HSystem that this window has the focus and the - * previously active window needs to blur +/** Reports to HSystem that this window has the focus and the + * previously active window needs to blur **/ gainedActiveStatus: function(){ HSystem.windowFocus(this); }, - + /** HSystem calls this method, whenever this window is allowed to be focused **/ windowFocus: function(){ this.hasWindowFocus = true; this.toggleCSSClass(this.elemId, 'inactive', false); }, - -/** HSystem calls this method, whenever this window needs to lose its - * focus (another window focused) + +/** HSystem calls this method, whenever this window needs to lose its + * focus (another window focused) **/ windowBlur: function(){ this.hasWindowFocus = false; this.toggleCSSClass(this.elemId, 'inactive', true); this.setStyle('cursor','default'); }, - + /** This method gets called, whenever the close button has been clicked **/ windowClose: function(){ this.die(); // extend this to this.app.die(), if your app needs to die instead of just the window }, @@ -272,12 +259,12 @@ else{ this.options.minSize[0] = this._origMinWidth; } this.makeRectRules(); }, - -/** This method gets called, whenever the collapse (minimize) button has + +/** This method gets called, whenever the collapse (minimize) button has * been clicked **/ windowCollapse: function(_rectOnly){ var _win = this, _opts = _win.options; @@ -306,11 +293,11 @@ _win.animateTo( _minRect ); } } this.makeRectRules(); }, - -/** This method gets called, whenever the zoom (maximize/restore) + +/** This method gets called, whenever the zoom (maximize/restore) * button has been clicked **/ windowZoom: function(){ var _maxSize = this.options.maxSize === 'auto' ? this.parentSize() : this.options.maxSize,