4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-Window'>/**
19 </span> * @class Ext.Window
23 <span id='Ext-Window-method-anchorTo'> /**
24 </span> * Anchors this window to another element and realigns it when the window is resized or scrolled.
25 * @param {Mixed} element The element to align to.
26 * @param {String} position The position to align to (see {@link Ext.core.Element#alignTo} for more details)
27 * @param {Array} offsets (optional) Offset the positioning by [x, y]
28 * @param {Boolean/Number} monitorScroll (optional) true to monitor body scroll and reposition. If this parameter
29 * is a number, it is used as the buffer delay (defaults to 50ms).
30 * @return {Ext.window.Window} this
32 anchorTo: function(el, alignment, offsets, monitorScroll) {
40 Ext.EventManager.onWindowResize(this.doAnchor, this);
41 var tm = typeof monitorScroll;
42 if (tm != 'undefined') {
43 Ext.EventManager.on(window, 'scroll', this.doAnchor, this,
45 buffer: tm == 'number' ? monitorScroll: 50
48 return this.doAnchor();
51 <span id='Ext-Window-method-doAnchor'> /**
52 </span> * Performs the anchor, using the saved anchorTarget property.
53 * @return {Ext.window.Window} this
56 doAnchor: function() {
57 var o = this.anchorTarget;
58 this.alignTo(o.el, o.alignment, o.offsets);
62 <span id='Ext-Window-method-clearAnchor'> /**
63 </span> * Removes any existing anchor from this window. See {@link #anchorTo}.
64 * @return {Ext.window.Window} this
66 clearAnchor: function() {
67 if (this.anchorTarget) {
68 Ext.EventManager.removeResizeListener(this.doAnchor, this);
69 Ext.EventManager.un(window, 'scroll', this.doAnchor, this);
70 delete this.anchorTarget;