-<html>\r
-<head>\r
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> \r
- <title>The source code</title>\r
- <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
- <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
-</head>\r
-<body onload="prettyPrint();">\r
- <pre class="prettyprint lang-js"><div id="cls-Ext.Window"></div>/**
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>The source code</title>
+ <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
+ <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
+</head>
+<body onload="prettyPrint();">
+ <pre class="prettyprint lang-js">/*!
+ * Ext JS Library 3.2.1
+ * Copyright(c) 2006-2010 Ext JS, Inc.
+ * licensing@extjs.com
+ * http://www.extjs.com/license
+ */
+<div id="cls-Ext.Window"></div>/**
* @class Ext.Window
* @extends Ext.Panel
* <p>A specialized panel intended for use as an application window. Windows are floated, {@link #resizable}, and
initDraggable : function(){
<div id="prop-Ext.Window-dd"></div>/**
- * If this Window is configured {@link #draggable}, this property will contain
- * an instance of {@link Ext.dd.DD} which handles dragging the Window's DOM Element.
+ * <p>If this Window is configured {@link #draggable}, this property will contain
+ * an instance of {@link Ext.dd.DD} which handles dragging the Window's DOM Element.</p>
+ * <p>This has implementations of <code>startDrag</code>, <code>onDrag</code> and <code>endDrag</code>
+ * which perform the dragging action. If extra logic is needed at these points, use
+ * {@link Function#createInterceptor createInterceptor} or {@link Function#createSequence createSequence} to
+ * augment the existing implementations.</p>
* @type Ext.dd.DD
* @property dd
*/
// private
beforeDestroy : function(){
- if (this.rendered){
+ if(this.rendered){
this.hide();
- if(this.doAnchor){
- Ext.EventManager.removeResizeListener(this.doAnchor, this);
- Ext.EventManager.un(window, 'scroll', this.doAnchor, this);
- }
+ this.clearAnchor();
Ext.destroy(
this.focusEl,
this.resizer,
this.updateBox(box);
}else{
this.setSize(box);
+ if (Ext.isIE6 && Ext.isStrict) {
+ this.doLayout();
+ }
}
this.focus();
this.updateHandles();
this.saveState();
- this.doLayout();
},
<div id="method-Ext.Window-focus"></div>/**
* window itself will receive focus.
*/
focus : function(){
- var f = this.focusEl, db = this.defaultButton, t = typeof db;
+ var f = this.focusEl,
+ db = this.defaultButton,
+ t = typeof db,
+ el,
+ ct;
if(Ext.isDefined(db)){
if(Ext.isNumber(db) && this.fbar){
f = this.fbar.items.get(db);
}else{
f = db;
}
+ el = f.getEl();
+ ct = Ext.getDom(this.container);
+ if (el && ct) {
+ if (!Ext.lib.Region.getRegion(ct).contains(Ext.lib.Region.getRegion(el.dom))){
+ return;
+ }
+ }
}
f = f || this.focusEl;
f.focus.defer(10, f);
}
if(show !== false){
this.el.show();
- this.focus();
+ this.focus.defer(10, this);
if(Ext.isMac && Ext.isGecko2){ // work around stupid FF 2.0/Mac scroll bar bug
this.cascade(this.setAutoScroll);
}
* @return {Ext.Window} this
*/
anchorTo : function(el, alignment, offsets, monitorScroll){
- if(this.doAnchor){
- Ext.EventManager.removeResizeListener(this.doAnchor, this);
- Ext.EventManager.un(window, 'scroll', this.doAnchor, this);
- }
- this.doAnchor = function(){
- 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,
- {buffer: tm == 'number' ? monitorScroll : 50});
- }
- return this;
+ this.clearAnchor();
+ this.anchorTarget = {
+ el: el,
+ alignment: alignment,
+ offsets: offsets
+ };
+
+ Ext.EventManager.onWindowResize(this.doAnchor, this);
+ var tm = typeof monitorScroll;
+ if(tm != 'undefined'){
+ Ext.EventManager.on(window, 'scroll', this.doAnchor, this,
+ {buffer: tm == 'number' ? monitorScroll : 50});
+ }
+ return this.doAnchor();
+ },
+
+ /**
+ * Performs the anchor, using the saved anchorTarget property.
+ * @return {Ext.Window} this
+ * @private
+ */
+ doAnchor : function(){
+ var o = this.anchorTarget;
+ this.alignTo(o.el, o.alignment, o.offsets);
+ return this;
+ },
+
+ <div id="method-Ext.Window-clearAnchor"></div>/**
+ * Removes any existing anchor from this window. See {@link #anchorTo}.
+ * @return {Ext.Window} this
+ */
+ clearAnchor : function(){
+ if(this.anchorTarget){
+ Ext.EventManager.removeResizeListener(this.doAnchor, this);
+ Ext.EventManager.un(window, 'scroll', this.doAnchor, this);
+ delete this.anchorTarget;
+ }
+ return this;
},
<div id="method-Ext.Window-toFront"></div>/**
this.win.saveState();
}
});
-</pre> \r
-</body>\r
+</pre>
+</body>
</html>
\ No newline at end of file