3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.2.1
11 * Copyright(c) 2006-2010 Ext JS, Inc.
13 * http://www.extjs.com/license
15 <div id="cls-Ext.dd.PanelProxy"></div>/**
16 * @class Ext.dd.PanelProxy
17 * A custom drag proxy implementation specific to {@link Ext.Panel}s. This class is primarily used internally
18 * for the Panel's drag drop implementation, and should never need to be created directly.
20 * @param panel The {@link Ext.Panel} to proxy for
21 * @param config Configuration options
23 Ext.dd.PanelProxy = function(panel, config){
25 this.id = this.panel.id +'-ddproxy';
26 Ext.apply(this, config);
29 Ext.dd.PanelProxy.prototype = {
30 <div id="cfg-Ext.dd.PanelProxy-insertProxy"></div>/**
31 * @cfg {Boolean} insertProxy True to insert a placeholder proxy element while dragging the panel,
32 * false to drag with no proxy (defaults to true).
37 setStatus : Ext.emptyFn,
43 <div id="method-Ext.dd.PanelProxy-getEl"></div>/**
44 * Gets the proxy's element
45 * @return {Element} The proxy's element
51 <div id="method-Ext.dd.PanelProxy-getGhost"></div>/**
52 * Gets the proxy's ghost element
53 * @return {Element} The proxy's ghost element
55 getGhost : function(){
59 <div id="method-Ext.dd.PanelProxy-getProxy"></div>/**
60 * Gets the proxy's element
61 * @return {Element} The proxy's element
63 getProxy : function(){
67 <div id="method-Ext.dd.PanelProxy-hide"></div>/**
76 this.panel.el.dom.style.display = '';
82 <div id="method-Ext.dd.PanelProxy-show"></div>/**
87 this.ghost = this.panel.createGhost(undefined, undefined, Ext.getBody());
88 this.ghost.setXY(this.panel.el.getXY());
90 this.proxy = this.panel.el.insertSibling({cls:'x-panel-dd-spacer'});
91 this.proxy.setSize(this.panel.getSize());
93 this.panel.el.dom.style.display = 'none';
98 repair : function(xy, callback, scope){
100 if(typeof callback == "function"){
101 callback.call(scope || this);
105 <div id="method-Ext.dd.PanelProxy-moveProxy"></div>/**
106 * Moves the proxy to a different position in the DOM. This is typically called while dragging the Panel
107 * to keep the proxy sync'd to the Panel's location.
108 * @param {HTMLElement} parentNode The proxy's parent DOM node
109 * @param {HTMLElement} before (optional) The sibling node before which the proxy should be inserted (defaults
110 * to the parent's last child if not specified)
112 moveProxy : function(parentNode, before){
114 parentNode.insertBefore(this.proxy.dom, before);
119 // private - DD implementation for Panels
120 Ext.Panel.DD = function(panel, cfg){
122 this.dragData = {panel: panel};
123 this.proxy = new Ext.dd.PanelProxy(panel, cfg);
124 Ext.Panel.DD.superclass.constructor.call(this, panel.el, cfg);
125 var h = panel.header;
127 this.setHandleElId(h.id);
129 (h ? h : this.panel.body).setStyle('cursor', 'move');
133 Ext.extend(Ext.Panel.DD, Ext.dd.DragSource, {
134 showFrame: Ext.emptyFn,
135 startDrag: Ext.emptyFn,
136 b4StartDrag: function(x, y) {
139 b4MouseDown: function(e) {
140 var x = e.getPageX();
141 var y = e.getPageY();
142 this.autoOffset(x, y);
144 onInitDrag : function(x, y){
145 this.onStartDrag(x, y);
148 createFrame : Ext.emptyFn,
149 getDragEl : function(e){
150 return this.proxy.ghost.dom;
152 endDrag : function(e){
154 this.panel.saveState();
157 autoOffset : function(x, y) {
158 x -= this.startPageX;
159 y -= this.startPageY;