X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..10a866c12701c0a0afd0ac85dcdcf32a421514ac:/docs/source/Window.html?ds=sidebyside diff --git a/docs/source/Window.html b/docs/source/Window.html index 91d0a856..a22ece55 100644 --- a/docs/source/Window.html +++ b/docs/source/Window.html @@ -1,5 +1,6 @@
+A specialized panel intended for use as an application window. Windows are floated, {@link #resizable}, and * {@link #draggable} by default. Windows can be {@link #maximizable maximized} to fill the viewport, * restored to their prior size, and can be {@link #minimize}d.
- *Windows can also be linked to a {@link Ext.WindowGroup} or managed by the {@link Ext.WindowMgr} to provide + *
Windows can also be linked to a {@link Ext.WindowGroup} or managed by the {@link Ext.WindowMgr} to provide * grouping, activation, to front, to back and other application-specific behavior.
*By default, Windows will be rendered to document.body. To {@link #constrain} a Window to another element * specify {@link Ext.Component#renderTo renderTo}.
@@ -51,8 +52,13 @@ Ext.Window = Ext.extend(Ext.Panel, { * A reference to the WindowGroup that should manage this window (defaults to {@link Ext.WindowMgr}). */ /** - * @cfg {String/Number/Button} defaultButton - * The id / index of a button or a button instance to focus when this window received the focus. + * @cfg {String/Number/Component} defaultButton + *Specifies a Component to receive focus when this Window is focussed.
+ *This may be one of:
this
reference) in which the callback is executed. Defaults to this Window.
* @return {Ext.Window} this
*/
show : function(animateTarget, cb, scope){
@@ -497,7 +515,7 @@ Ext.Window = Ext.extend(Ext.Panel, {
this.on('show', cb, scope, {single:true});
}
this.hidden = false;
- if(animateTarget !== undefined){
+ if(Ext.isDefined(animateTarget)){
this.setAnimateTarget(animateTarget);
}
this.beforeShow();
@@ -517,7 +535,7 @@ Ext.Window = Ext.extend(Ext.Panel, {
if(this.maximized){
this.fitContainer();
}
- if(Ext.isMac && Ext.isGecko){ // work around stupid FF 2.0/Mac scroll bar bug
+ if(Ext.isMac && Ext.isGecko2){ // work around stupid FF 2.0/Mac scroll bar bug
this.cascade(this.setAutoScroll);
}
@@ -535,6 +553,7 @@ Ext.Window = Ext.extend(Ext.Panel, {
var sz = this.getSize();
this.onResize(sz.width, sz.height);
}
+ this.onShow();
this.fireEvent('show', this);
},
@@ -543,15 +562,15 @@ Ext.Window = Ext.extend(Ext.Panel, {
this.proxy.show();
this.proxy.setBox(this.animateTarget.getBox());
this.proxy.setOpacity(0);
- var b = this.getBox(false);
- b.callback = this.afterShow.createDelegate(this, [true], false);
- b.scope = this;
- b.duration = 0.25;
- b.easing = 'easeNone';
- b.opacity = 0.5;
- b.block = true;
+ var b = this.getBox();
this.el.setStyle('display', 'none');
- this.proxy.shift(b);
+ this.proxy.shift(Ext.apply(b, {
+ callback: this.afterShow.createDelegate(this, [true], false),
+ scope: this,
+ easing: 'easeNone',
+ duration: 0.25,
+ opacity: 0.5
+ }));
},
/**
@@ -559,7 +578,7 @@ Ext.Window = Ext.extend(Ext.Panel, {
* @param {String/Element} animateTarget (optional) The target element or id to which the window should
* animate while hiding (defaults to null with no animation)
* @param {Function} callback (optional) A callback function to call after the window is hidden
- * @param {Object} scope (optional) The scope in which to execute the callback
+ * @param {Object} scope (optional) The scope (this
reference) in which the callback is executed. Defaults to this Window.
* @return {Ext.Window} this
*/
hide : function(animateTarget, cb, scope){
@@ -595,6 +614,7 @@ Ext.Window = Ext.extend(Ext.Panel, {
if(this.keyMap){
this.keyMap.disable();
}
+ this.onHide();
this.fireEvent('hide', this);
},
@@ -605,16 +625,27 @@ Ext.Window = Ext.extend(Ext.Panel, {
var tb = this.getBox(false);
this.proxy.setBox(tb);
this.el.hide();
- var b = this.animateTarget.getBox();
- b.callback = this.afterHide;
- b.scope = this;
- b.duration = 0.25;
- b.easing = 'easeNone';
- b.block = true;
- b.opacity = 0;
- this.proxy.shift(b);
+ this.proxy.shift(Ext.apply(this.animateTarget.getBox(), {
+ callback: this.afterHide,
+ scope: this,
+ duration: 0.25,
+ easing: 'easeNone',
+ opacity: 0
+ }));
},
+ /**
+ * Method that is called immediately before the show
event is fired.
+ * Defaults to Ext.emptyFn
.
+ */
+ onShow : Ext.emptyFn,
+
+ /**
+ * Method that is called immediately before the hide
event is fired.
+ * Defaults to Ext.emptyFn
.
+ */
+ onHide : Ext.emptyFn,
+
// private
onWindowResize : function(){
if(this.maximized){
@@ -672,7 +703,7 @@ Ext.Window = Ext.extend(Ext.Panel, {
if(show !== false){
this.el.show();
this.focus();
- if(Ext.isMac && Ext.isGecko){ // work around stupid FF 2.0/Mac scroll bar bug
+ if(Ext.isMac && Ext.isGecko2){ // work around stupid FF 2.0/Mac scroll bar bug
this.cascade(this.setAutoScroll);
}
}
@@ -705,13 +736,20 @@ Ext.Window = Ext.extend(Ext.Panel, {
*/
close : function(){
if(this.fireEvent('beforeclose', this) !== false){
- this.hide(null, function(){
- this.fireEvent('close', this);
- this.destroy();
- }, this);
+ if(this.hidden){
+ this.doClose();
+ }else{
+ this.hide(null, this.doClose, this);
+ }
}
},
+ // private
+ doClose : function(){
+ this.fireEvent('close', this);
+ this.destroy();
+ },
+
/**
* Fits the window within its current container and automatically replaces
* the {@link #maximizable 'maximize' tool button} with the 'restore' tool button.
@@ -755,9 +793,14 @@ Ext.Window = Ext.extend(Ext.Panel, {
*/
restore : function(){
if(this.maximized){
+ var t = this.tools;
this.el.removeClass('x-window-maximized');
- this.tools.restore.hide();
- this.tools.maximize.show();
+ if(t.restore){
+ t.restore.hide();
+ }
+ if(t.maximize){
+ t.maximize.show();
+ }
this.setPosition(this.restorePos[0], this.restorePos[1]);
this.setSize(this.restoreSize.width, this.restoreSize.height);
delete this.restorePos;
@@ -768,8 +811,8 @@ Ext.Window = Ext.extend(Ext.Panel, {
if(this.dd){
this.dd.unlock();
}
- if(this.collapsible){
- this.tools.toggle.show();
+ if(this.collapsible && t.toggle){
+ t.toggle.show();
}
this.container.removeClass('x-window-maximized-ct');
@@ -790,7 +833,7 @@ Ext.Window = Ext.extend(Ext.Panel, {
// private
fitContainer : function(){
- var vs = this.container.getViewSize();
+ var vs = this.container.getViewSize(false);
this.setSize(vs.width, vs.height);
},
@@ -813,7 +856,7 @@ Ext.Window = Ext.extend(Ext.Panel, {
/**
* Aligns the window to the specified element
* @param {Mixed} element The element to align to.
- * @param {String} position The position to align to (see {@link Ext.Element#alignTo} for more details).
+ * @param {String} position (optional, defaults to "tl-bl?") The position to align to (see {@link Ext.Element#alignTo} for more details).
* @param {Array} offsets (optional) Offset the positioning by [x, y]
* @return {Ext.Window} this
*/
@@ -841,7 +884,7 @@ Ext.Window = Ext.extend(Ext.Panel, {
this.alignTo(el, alignment, offsets);
};
Ext.EventManager.onWindowResize(this.doAnchor, this);
-
+
var tm = typeof monitorScroll;
if(tm != 'undefined'){
Ext.EventManager.on(window, 'scroll', this.doAnchor, this,
@@ -867,7 +910,8 @@ Ext.Window = Ext.extend(Ext.Panel, {
/**
* Makes this the active window by showing its shadow, or deactivates it by hiding its shadow. This method also
- * fires the {@link #activate} or {@link #deactivate} event depending on which action occurred.
+ * fires the {@link #activate} or {@link #deactivate} event depending on which action occurred. This method is
+ * called internally by {@link Ext.WindowMgr}.
* @param {Boolean} active True to activate the window, false to deactivate it (defaults to false)
*/
setActive : function(active){