3 * Copyright(c) 2006-2010 Ext JS, Inc.
5 * http://www.extjs.com/license
10 * <p>A specialized panel intended for use as an application window. Windows are floated, {@link #resizable}, and
11 * {@link #draggable} by default. Windows can be {@link #maximizable maximized} to fill the viewport,
12 * restored to their prior size, and can be {@link #minimize}d.</p>
13 * <p>Windows can also be linked to a {@link Ext.WindowGroup} or managed by the {@link Ext.WindowMgr} to provide
14 * grouping, activation, to front, to back and other application-specific behavior.</p>
15 * <p>By default, Windows will be rendered to document.body. To {@link #constrain} a Window to another element
16 * specify {@link Ext.Component#renderTo renderTo}.</p>
17 * <p><b>Note:</b> By default, the <code>{@link #closable close}</code> header tool <i>destroys</i> the Window resulting in
18 * destruction of any child Components. This makes the Window object, and all its descendants <b>unusable</b>. To enable
19 * re-use of a Window, use <b><code>{@link #closeAction closeAction: 'hide'}</code></b>.</p>
21 * @param {Object} config The config object
24 Ext.Window = Ext.extend(Ext.Panel, {
27 * The X position of the left edge of the window on initial showing. Defaults to centering the Window within
28 * the width of the Window's container {@link Ext.Element Element) (The Element that the Window is rendered to).
32 * The Y position of the top edge of the window on initial showing. Defaults to centering the Window within
33 * the height of the Window's container {@link Ext.Element Element) (The Element that the Window is rendered to).
36 * @cfg {Boolean} modal
37 * True to make the window modal and mask everything behind it when displayed, false to display it without
38 * restricting access to other UI elements (defaults to false).
41 * @cfg {String/Element} animateTarget
42 * Id or element from which the window should animate while opening (defaults to null with no animation).
45 * @cfg {String} resizeHandles
46 * A valid {@link Ext.Resizable} handles config string (defaults to 'all'). Only applies when resizable = true.
49 * @cfg {Ext.WindowGroup} manager
50 * A reference to the WindowGroup that should manage this window (defaults to {@link Ext.WindowMgr}).
53 * @cfg {String/Number/Component} defaultButton
54 * <p>Specifies a Component to receive focus when this Window is focussed.</p>
55 * <p>This may be one of:</p><div class="mdetail-params"><ul>
56 * <li>The index of a footer Button.</li>
57 * <li>The id of a Component.</li>
58 * <li>A Component.</li>
62 * @cfg {Function} onEsc
63 * Allows override of the built-in processing for the escape key. Default action
64 * is to close the Window (performing whatever action is specified in {@link #closeAction}.
65 * To prevent the Window closing when the escape key is pressed, specify this as
66 * Ext.emptyFn (See {@link Ext#emptyFn}).
69 * @cfg {Boolean} collapsed
70 * True to render the window collapsed, false to render it expanded (defaults to false). Note that if
71 * {@link #expandOnShow} is true (the default) it will override the <tt>collapsed</tt> config and the window
72 * will always be expanded when shown.
75 * @cfg {Boolean} maximized
76 * True to initially display the window in a maximized state. (Defaults to false).
80 * @cfg {String} baseCls
81 * The base CSS class to apply to this panel's element (defaults to 'x-window').
85 * @cfg {Boolean} resizable
86 * True to allow user resizing at each edge and corner of the window, false to disable resizing (defaults to true).
90 * @cfg {Boolean} draggable
91 * True to allow the window to be dragged by the header bar, false to disable dragging (defaults to true). Note
92 * that by default the window will be centered in the viewport, so if dragging is disabled the window may need
93 * to be positioned programmatically after render (e.g., myWindow.setPosition(100, 100);).
97 * @cfg {Boolean} closable
98 * <p>True to display the 'close' tool button and allow the user to close the window, false to
99 * hide the button and disallow closing the window (defaults to true).</p>
100 * <p>By default, when close is requested by either clicking the close button in the header
101 * or pressing ESC when the Window has focus, the {@link #close} method will be called. This
102 * will <i>{@link Ext.Component#destroy destroy}</i> the Window and its content meaning that
103 * it may not be reused.</p>
104 * <p>To make closing a Window <i>hide</i> the Window so that it may be reused, set
105 * {@link #closeAction} to 'hide'.
109 * @cfg {String} closeAction
110 * <p>The action to take when the close header tool is clicked:
111 * <div class="mdetail-params"><ul>
112 * <li><b><code>'{@link #close}'</code></b> : <b>Default</b><div class="sub-desc">
113 * {@link #close remove} the window from the DOM and {@link Ext.Component#destroy destroy}
114 * it and all descendant Components. The window will <b>not</b> be available to be
115 * redisplayed via the {@link #show} method.
117 * <li><b><code>'{@link #hide}'</code></b> : <div class="sub-desc">
118 * {@link #hide} the window by setting visibility to hidden and applying negative offsets.
119 * The window will be available to be redisplayed via the {@link #show} method.
122 * <p><b>Note:</b> This setting does not affect the {@link #close} method
123 * which will always {@link Ext.Component#destroy destroy} the window. To
124 * programatically <i>hide</i> a window, call {@link #hide}.</p>
126 closeAction : 'close',
128 * @cfg {Boolean} constrain
129 * True to constrain the window within its containing element, false to allow it to fall outside of its
130 * containing element. By default the window will be rendered to document.body. To render and constrain the
131 * window within another element specify {@link #renderTo}.
132 * (defaults to false). Optionally the header only can be constrained using {@link #constrainHeader}.
136 * @cfg {Boolean} constrainHeader
137 * True to constrain the window header within its containing element (allowing the window body to fall outside
138 * of its containing element) or false to allow the header to fall outside its containing element (defaults to
139 * false). Optionally the entire window can be constrained using {@link #constrain}.
141 constrainHeader : false,
143 * @cfg {Boolean} plain
144 * True to render the window body with a transparent background so that it will blend into the framing
145 * elements, false to add a lighter background color to visually highlight the body element and separate it
146 * more distinctly from the surrounding frame (defaults to false).
150 * @cfg {Boolean} minimizable
151 * True to display the 'minimize' tool button and allow the user to minimize the window, false to hide the button
152 * and disallow minimizing the window (defaults to false). Note that this button provides no implementation --
153 * the behavior of minimizing a window is implementation-specific, so the minimize event must be handled and a
154 * custom minimize behavior implemented for this option to be useful.
158 * @cfg {Boolean} maximizable
159 * True to display the 'maximize' tool button and allow the user to maximize the window, false to hide the button
160 * and disallow maximizing the window (defaults to false). Note that when a window is maximized, the tool button
161 * will automatically change to a 'restore' button with the appropriate behavior already built-in that will
162 * restore the window to its previous size.
166 * @cfg {Number} minHeight
167 * The minimum height in pixels allowed for this window (defaults to 100). Only applies when resizable = true.
171 * @cfg {Number} minWidth
172 * The minimum width in pixels allowed for this window (defaults to 200). Only applies when resizable = true.
176 * @cfg {Boolean} expandOnShow
177 * True to always expand the window when it is displayed, false to keep it in its current state (which may be
178 * {@link #collapsed}) when displayed (defaults to true).
182 // inherited docs, same default
186 * @cfg {Boolean} initHidden
187 * True to hide the window until show() is explicitly called (defaults to true).
190 initHidden : undefined,
193 * @cfg {Boolean} hidden
194 * Render this component hidden (default is <tt>true</tt>). If <tt>true</tt>, the
195 * {@link #hide} method will be called internally.
199 // The following configs are set to provide the basic functionality of a window.
200 // Changing them would require additional code to handle correctly and should
201 // usually only be done in subclasses that can provide custom behavior. Changing them
202 // may have unexpected or undesirable results.
203 /** @cfg {String} elements @hide */
204 elements : 'header,body',
205 /** @cfg {Boolean} frame @hide */
207 /** @cfg {Boolean} floating @hide */
211 initComponent : function(){
213 Ext.Window.superclass.initComponent.call(this);
217 * Fires after the window has been visually activated via {@link #setActive}.
218 * @param {Ext.Window} this
222 * Fires after the window has been visually deactivated via {@link #setActive}.
223 * @param {Ext.Window} this
227 * Fires after the window has been resized.
228 * @param {Ext.Window} this
229 * @param {Number} width The window's new width
230 * @param {Number} height The window's new height
235 * Fires after the window has been maximized.
236 * @param {Ext.Window} this
241 * Fires after the window has been minimized.
242 * @param {Ext.Window} this
247 * Fires after the window has been restored to its original size after being maximized.
248 * @param {Ext.Window} this
252 // for backwards compat, this should be removed at some point
253 if(Ext.isDefined(this.initHidden)){
254 this.hidden = this.initHidden;
256 if(this.hidden === false){
263 getState : function(){
264 return Ext.apply(Ext.Window.superclass.getState.call(this) || {}, this.getBox(true));
268 onRender : function(ct, position){
269 Ext.Window.superclass.onRender.call(this, ct, position);
272 this.el.addClass('x-window-plain');
275 // this element allows the Window to be focused for keyboard events
276 this.focusEl = this.el.createChild({
277 tag: 'a', href:'#', cls:'x-dlg-focus',
278 tabIndex:'-1', html: ' '});
279 this.focusEl.swallowEvent('click', true);
281 this.proxy = this.el.createProxy('x-window-proxy');
282 this.proxy.enableDisplayMode('block');
285 this.mask = this.container.createChild({cls:'ext-el-mask'}, this.el.dom);
286 this.mask.enableDisplayMode('block');
288 this.mon(this.mask, 'click', this.focus, this);
290 if(this.maximizable){
291 this.mon(this.header, 'dblclick', this.toggleMaximize, this);
296 initEvents : function(){
297 Ext.Window.superclass.initEvents.call(this);
298 if(this.animateTarget){
299 this.setAnimateTarget(this.animateTarget);
303 this.resizer = new Ext.Resizable(this.el, {
304 minWidth: this.minWidth,
305 minHeight:this.minHeight,
306 handles: this.resizeHandles || 'all',
308 resizeElement : this.resizerAction,
309 handleCls: 'x-window-handle'
311 this.resizer.window = this;
312 this.mon(this.resizer, 'beforeresize', this.beforeResize, this);
316 this.header.addClass('x-window-draggable');
318 this.mon(this.el, 'mousedown', this.toFront, this);
319 this.manager = this.manager || Ext.WindowMgr;
320 this.manager.register(this);
322 this.maximized = false;
326 var km = this.getKeyMap();
327 km.on(27, this.onEsc, this);
332 initDraggable : function(){
334 * <p>If this Window is configured {@link #draggable}, this property will contain
335 * an instance of {@link Ext.dd.DD} which handles dragging the Window's DOM Element.</p>
336 * <p>This has implementations of <code>startDrag</code>, <code>onDrag</code> and <code>endDrag</code>
337 * which perform the dragging action. If extra logic is needed at these points, use
338 * {@link Function#createInterceptor createInterceptor} or {@link Function#createSequence createSequence} to
339 * augment the existing implementations.</p>
343 this.dd = new Ext.Window.DD(this);
347 onEsc : function(k, e){
349 this[this.closeAction]();
353 beforeDestroy : function(){
365 Ext.Window.superclass.beforeDestroy.call(this);
369 onDestroy : function(){
371 this.manager.unregister(this);
373 Ext.Window.superclass.onDestroy.call(this);
377 initTools : function(){
378 if(this.minimizable){
381 handler: this.minimize.createDelegate(this, [])
384 if(this.maximizable){
387 handler: this.maximize.createDelegate(this, [])
391 handler: this.restore.createDelegate(this, []),
398 handler: this[this.closeAction].createDelegate(this, [])
404 resizerAction : function(){
405 var box = this.proxy.getBox();
407 this.window.handleResize(box);
412 beforeResize : function(){
413 this.resizer.minHeight = Math.max(this.minHeight, this.getFrameHeight() + 40); // 40 is a magic minimum content size?
414 this.resizer.minWidth = Math.max(this.minWidth, this.getFrameWidth() + 40);
415 this.resizeBox = this.el.getBox();
419 updateHandles : function(){
420 if(Ext.isIE && this.resizer){
421 this.resizer.syncHandleHeight();
427 handleResize : function(box){
428 var rz = this.resizeBox;
429 if(rz.x != box.x || rz.y != box.y){
433 if (Ext.isIE6 && Ext.isStrict) {
438 this.updateHandles();
443 * Focuses the window. If a defaultButton is set, it will receive focus, otherwise the
444 * window itself will receive focus.
447 var f = this.focusEl,
448 db = this.defaultButton,
452 if(Ext.isDefined(db)){
453 if(Ext.isNumber(db) && this.fbar){
454 f = this.fbar.items.get(db);
455 }else if(Ext.isString(db)){
461 ct = Ext.getDom(this.container);
463 if (!Ext.lib.Region.getRegion(ct).contains(Ext.lib.Region.getRegion(el.dom))){
468 f = f || this.focusEl;
469 f.focus.defer(10, f);
473 * Sets the target element from which the window should animate while opening.
474 * @param {String/Element} el The target element or id
476 setAnimateTarget : function(el){
478 this.animateTarget = el;
482 beforeShow : function(){
483 delete this.el.lastXY;
484 delete this.el.lastLT;
485 if(this.x === undefined || this.y === undefined){
486 var xy = this.el.getAlignToXY(this.container, 'c-c');
487 var pos = this.el.translatePoints(xy[0], xy[1]);
488 this.x = this.x === undefined? pos.left : this.x;
489 this.y = this.y === undefined? pos.top : this.y;
491 this.el.setLeftTop(this.x, this.y);
493 if(this.expandOnShow){
498 Ext.getBody().addClass('x-body-masked');
499 this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
505 * Shows the window, rendering it first if necessary, or activates it and brings it to front if hidden.
506 * @param {String/Element} animateTarget (optional) The target element or id from which the window should
507 * animate while opening (defaults to null with no animation)
508 * @param {Function} callback (optional) A callback function to call after the window is displayed
509 * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the callback is executed. Defaults to this Window.
510 * @return {Ext.Window} this
512 show : function(animateTarget, cb, scope){
514 this.render(Ext.getBody());
516 if(this.hidden === false){
520 if(this.fireEvent('beforeshow', this) === false){
524 this.on('show', cb, scope, {single:true});
527 if(Ext.isDefined(animateTarget)){
528 this.setAnimateTarget(animateTarget);
531 if(this.animateTarget){
540 afterShow : function(isAnim){
541 if (this.isDestroyed){
545 this.el.setStyle('display', 'block');
550 if(Ext.isMac && Ext.isGecko2){ // work around stupid FF 2.0/Mac scroll bar bug
551 this.cascade(this.setAutoScroll);
554 if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){
555 Ext.EventManager.onWindowResize(this.onWindowResize, this);
560 this.keyMap.enable();
563 this.updateHandles();
564 if(isAnim && (Ext.isIE || Ext.isWebKit)){
565 var sz = this.getSize();
566 this.onResize(sz.width, sz.height);
569 this.fireEvent('show', this);
573 animShow : function(){
575 this.proxy.setBox(this.animateTarget.getBox());
576 this.proxy.setOpacity(0);
577 var b = this.getBox();
578 this.el.setStyle('display', 'none');
579 this.proxy.shift(Ext.apply(b, {
580 callback: this.afterShow.createDelegate(this, [true], false),
589 * Hides the window, setting it to invisible and applying negative offsets.
590 * @param {String/Element} animateTarget (optional) The target element or id to which the window should
591 * animate while hiding (defaults to null with no animation)
592 * @param {Function} callback (optional) A callback function to call after the window is hidden
593 * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the callback is executed. Defaults to this Window.
594 * @return {Ext.Window} this
596 hide : function(animateTarget, cb, scope){
597 if(this.hidden || this.fireEvent('beforehide', this) === false){
601 this.on('hide', cb, scope, {single:true});
604 if(animateTarget !== undefined){
605 this.setAnimateTarget(animateTarget);
609 Ext.getBody().removeClass('x-body-masked');
611 if(this.animateTarget){
621 afterHide : function(){
623 if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){
624 Ext.EventManager.removeResizeListener(this.onWindowResize, this);
627 this.keyMap.disable();
630 this.fireEvent('hide', this);
634 animHide : function(){
635 this.proxy.setOpacity(0.5);
637 var tb = this.getBox(false);
638 this.proxy.setBox(tb);
640 this.proxy.shift(Ext.apply(this.animateTarget.getBox(), {
641 callback: this.afterHide,
650 * Method that is called immediately before the <code>show</code> event is fired.
651 * Defaults to <code>Ext.emptyFn</code>.
653 onShow : Ext.emptyFn,
656 * Method that is called immediately before the <code>hide</code> event is fired.
657 * Defaults to <code>Ext.emptyFn</code>.
659 onHide : Ext.emptyFn,
662 onWindowResize : function(){
667 this.mask.setSize('100%', '100%');
668 var force = this.mask.dom.offsetHeight;
669 this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
675 doConstrain : function(){
676 if(this.constrain || this.constrainHeader){
680 right:this.el.shadowOffset,
681 left:this.el.shadowOffset,
682 bottom:this.el.shadowOffset
685 var s = this.getSize();
687 right:-(s.width - 100),
688 bottom:-(s.height - 25)
692 var xy = this.el.getConstrainToXY(this.container, true, offsets);
694 this.setPosition(xy[0], xy[1]);
699 // private - used for dragging
700 ghost : function(cls){
701 var ghost = this.createGhost(cls);
702 var box = this.getBox(true);
703 ghost.setLeftTop(box.x, box.y);
704 ghost.setWidth(box.width);
706 this.activeGhost = ghost;
711 unghost : function(show, matchPosition){
712 if(!this.activeGhost) {
717 this.focus.defer(10, this);
718 if(Ext.isMac && Ext.isGecko2){ // work around stupid FF 2.0/Mac scroll bar bug
719 this.cascade(this.setAutoScroll);
722 if(matchPosition !== false){
723 this.setPosition(this.activeGhost.getLeft(true), this.activeGhost.getTop(true));
725 this.activeGhost.hide();
726 this.activeGhost.remove();
727 delete this.activeGhost;
731 * Placeholder method for minimizing the window. By default, this method simply fires the {@link #minimize} event
732 * since the behavior of minimizing a window is application-specific. To implement custom minimize behavior,
733 * either the minimize event can be handled or this method can be overridden.
734 * @return {Ext.Window} this
736 minimize : function(){
737 this.fireEvent('minimize', this);
742 * <p>Closes the Window, removes it from the DOM, {@link Ext.Component#destroy destroy}s
743 * the Window object and all its descendant Components. The {@link Ext.Panel#beforeclose beforeclose}
744 * event is fired before the close happens and will cancel the close action if it returns false.<p>
745 * <p><b>Note:</b> This method is not affected by the {@link #closeAction} setting which
746 * only affects the action triggered when clicking the {@link #closable 'close' tool in the header}.
747 * To hide the Window without destroying it, call {@link #hide}.</p>
750 if(this.fireEvent('beforeclose', this) !== false){
754 this.hide(null, this.doClose, this);
760 doClose : function(){
761 this.fireEvent('close', this);
766 * Fits the window within its current container and automatically replaces
767 * the {@link #maximizable 'maximize' tool button} with the 'restore' tool button.
768 * Also see {@link #toggleMaximize}.
769 * @return {Ext.Window} this
771 maximize : function(){
774 this.restoreSize = this.getSize();
775 this.restorePos = this.getPosition(true);
776 if (this.maximizable){
777 this.tools.maximize.hide();
778 this.tools.restore.show();
780 this.maximized = true;
781 this.el.disableShadow();
786 if(this.collapsible){
787 this.tools.toggle.hide();
789 this.el.addClass('x-window-maximized');
790 this.container.addClass('x-window-maximized-ct');
792 this.setPosition(0, 0);
794 this.fireEvent('maximize', this);
800 * Restores a {@link #maximizable maximized} window back to its original
801 * size and position prior to being maximized and also replaces
802 * the 'restore' tool button with the 'maximize' tool button.
803 * Also see {@link #toggleMaximize}.
804 * @return {Ext.Window} this
806 restore : function(){
809 this.el.removeClass('x-window-maximized');
816 this.setPosition(this.restorePos[0], this.restorePos[1]);
817 this.setSize(this.restoreSize.width, this.restoreSize.height);
818 delete this.restorePos;
819 delete this.restoreSize;
820 this.maximized = false;
821 this.el.enableShadow(true);
826 if(this.collapsible && t.toggle){
829 this.container.removeClass('x-window-maximized-ct');
832 this.fireEvent('restore', this);
838 * A shortcut method for toggling between {@link #maximize} and {@link #restore} based on the current maximized
839 * state of the window.
840 * @return {Ext.Window} this
842 toggleMaximize : function(){
843 return this[this.maximized ? 'restore' : 'maximize']();
847 fitContainer : function(){
848 var vs = this.container.getViewSize(false);
849 this.setSize(vs.width, vs.height);
853 // z-index is managed by the WindowManager and may be overwritten at any time
854 setZIndex : function(index){
856 this.mask.setStyle('z-index', index);
858 this.el.setZIndex(++index);
862 this.resizer.proxy.setStyle('z-index', ++index);
865 this.lastZIndex = index;
869 * Aligns the window to the specified element
870 * @param {Mixed} element The element to align to.
871 * @param {String} position (optional, defaults to "tl-bl?") The position to align to (see {@link Ext.Element#alignTo} for more details).
872 * @param {Array} offsets (optional) Offset the positioning by [x, y]
873 * @return {Ext.Window} this
875 alignTo : function(element, position, offsets){
876 var xy = this.el.getAlignToXY(element, position, offsets);
877 this.setPagePosition(xy[0], xy[1]);
882 * Anchors this window to another element and realigns it when the window is resized or scrolled.
883 * @param {Mixed} element The element to align to.
884 * @param {String} position The position to align to (see {@link Ext.Element#alignTo} for more details)
885 * @param {Array} offsets (optional) Offset the positioning by [x, y]
886 * @param {Boolean/Number} monitorScroll (optional) true to monitor body scroll and reposition. If this parameter
887 * is a number, it is used as the buffer delay (defaults to 50ms).
888 * @return {Ext.Window} this
890 anchorTo : function(el, alignment, offsets, monitorScroll){
892 this.anchorTarget = {
894 alignment: alignment,
898 Ext.EventManager.onWindowResize(this.doAnchor, this);
899 var tm = typeof monitorScroll;
900 if(tm != 'undefined'){
901 Ext.EventManager.on(window, 'scroll', this.doAnchor, this,
902 {buffer: tm == 'number' ? monitorScroll : 50});
904 return this.doAnchor();
908 * Performs the anchor, using the saved anchorTarget property.
909 * @return {Ext.Window} this
912 doAnchor : function(){
913 var o = this.anchorTarget;
914 this.alignTo(o.el, o.alignment, o.offsets);
919 * Removes any existing anchor from this window. See {@link #anchorTo}.
920 * @return {Ext.Window} this
922 clearAnchor : function(){
923 if(this.anchorTarget){
924 Ext.EventManager.removeResizeListener(this.doAnchor, this);
925 Ext.EventManager.un(window, 'scroll', this.doAnchor, this);
926 delete this.anchorTarget;
932 * Brings this window to the front of any other visible windows
933 * @param {Boolean} e (optional) Specify <tt>false</tt> to prevent the window from being focused.
934 * @return {Ext.Window} this
936 toFront : function(e){
937 if(this.manager.bringToFront(this)){
938 if(!e || !e.getTarget().focus){
946 * Makes this the active window by showing its shadow, or deactivates it by hiding its shadow. This method also
947 * fires the {@link #activate} or {@link #deactivate} event depending on which action occurred. This method is
948 * called internally by {@link Ext.WindowMgr}.
949 * @param {Boolean} active True to activate the window, false to deactivate it (defaults to false)
951 setActive : function(active){
954 this.el.enableShadow(true);
956 this.fireEvent('activate', this);
958 this.el.disableShadow();
959 this.fireEvent('deactivate', this);
964 * Sends this window to the back of (lower z-index than) any other visible windows
965 * @return {Ext.Window} this
968 this.manager.sendToBack(this);
973 * Centers this window in the viewport
974 * @return {Ext.Window} this
977 var xy = this.el.getAlignToXY(this.container, 'c-c');
978 this.setPagePosition(xy[0], xy[1]);
983 * @cfg {Boolean} autoWidth @hide
986 Ext.reg('window', Ext.Window);
988 // private - custom Window DD implementation
989 Ext.Window.DD = function(win){
991 Ext.Window.DD.superclass.constructor.call(this, win.el.id, 'WindowDD-'+win.id);
992 this.setHandleElId(win.header.id);
996 Ext.extend(Ext.Window.DD, Ext.dd.DD, {
998 headerOffsets:[100, 25],
999 startDrag : function(){
1001 this.proxy = w.ghost();
1002 if(w.constrain !== false){
1003 var so = w.el.shadowOffset;
1004 this.constrainTo(w.container, {right: so, left: so, bottom: so});
1005 }else if(w.constrainHeader !== false){
1006 var s = this.proxy.getSize();
1007 this.constrainTo(w.container, {right: -(s.width-this.headerOffsets[0]), bottom: -(s.height-this.headerOffsets[1])});
1010 b4Drag : Ext.emptyFn,
1012 onDrag : function(e){
1013 this.alignElWithMouse(this.proxy, e.getPageX(), e.getPageY());
1016 endDrag : function(e){
1018 this.win.saveState();