3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js"><div id="cls-Ext.dd.PanelProxy"></div>/**
\r
9 * @class Ext.dd.PanelProxy
\r
10 * A custom drag proxy implementation specific to {@link Ext.Panel}s. This class is primarily used internally
\r
11 * for the Panel's drag drop implementation, and should never need to be created directly.
\r
13 * @param panel The {@link Ext.Panel} to proxy for
\r
14 * @param config Configuration options
\r
16 Ext.dd.PanelProxy = function(panel, config){
\r
18 this.id = this.panel.id +'-ddproxy';
\r
19 Ext.apply(this, config);
\r
22 Ext.dd.PanelProxy.prototype = {
\r
23 <div id="cfg-Ext.dd.PanelProxy-insertProxy"></div>/**
\r
24 * @cfg {Boolean} insertProxy True to insert a placeholder proxy element while dragging the panel,
\r
25 * false to drag with no proxy (defaults to true).
\r
29 // private overrides
\r
30 setStatus : Ext.emptyFn,
\r
31 reset : Ext.emptyFn,
\r
32 update : Ext.emptyFn,
\r
36 <div id="method-Ext.dd.PanelProxy-getEl"></div>/**
\r
37 * Gets the proxy's element
\r
38 * @return {Element} The proxy's element
\r
44 <div id="method-Ext.dd.PanelProxy-getGhost"></div>/**
\r
45 * Gets the proxy's ghost element
\r
46 * @return {Element} The proxy's ghost element
\r
48 getGhost : function(){
\r
52 <div id="method-Ext.dd.PanelProxy-getProxy"></div>/**
\r
53 * Gets the proxy's element
\r
54 * @return {Element} The proxy's element
\r
56 getProxy : function(){
\r
60 <div id="method-Ext.dd.PanelProxy-hide"></div>/**
\r
66 this.proxy.remove();
\r
69 this.panel.el.dom.style.display = '';
\r
70 this.ghost.remove();
\r
75 <div id="method-Ext.dd.PanelProxy-show"></div>/**
\r
80 this.ghost = this.panel.createGhost(undefined, undefined, Ext.getBody());
\r
81 this.ghost.setXY(this.panel.el.getXY())
\r
82 if(this.insertProxy){
\r
83 this.proxy = this.panel.el.insertSibling({cls:'x-panel-dd-spacer'});
\r
84 this.proxy.setSize(this.panel.getSize());
\r
86 this.panel.el.dom.style.display = 'none';
\r
91 repair : function(xy, callback, scope){
\r
93 if(typeof callback == "function"){
\r
94 callback.call(scope || this);
\r
98 <div id="method-Ext.dd.PanelProxy-moveProxy"></div>/**
\r
99 * Moves the proxy to a different position in the DOM. This is typically called while dragging the Panel
\r
100 * to keep the proxy sync'd to the Panel's location.
\r
101 * @param {HTMLElement} parentNode The proxy's parent DOM node
\r
102 * @param {HTMLElement} before (optional) The sibling node before which the proxy should be inserted (defaults
\r
103 * to the parent's last child if not specified)
\r
105 moveProxy : function(parentNode, before){
\r
107 parentNode.insertBefore(this.proxy.dom, before);
\r
112 // private - DD implementation for Panels
\r
113 Ext.Panel.DD = function(panel, cfg){
\r
114 this.panel = panel;
\r
115 this.dragData = {panel: panel};
\r
116 this.proxy = new Ext.dd.PanelProxy(panel, cfg);
\r
117 Ext.Panel.DD.superclass.constructor.call(this, panel.el, cfg);
\r
118 var h = panel.header;
\r
120 this.setHandleElId(h.id);
\r
122 (h ? h : this.panel.body).setStyle('cursor', 'move');
\r
123 this.scroll = false;
\r
126 Ext.extend(Ext.Panel.DD, Ext.dd.DragSource, {
\r
127 showFrame: Ext.emptyFn,
\r
128 startDrag: Ext.emptyFn,
\r
129 b4StartDrag: function(x, y) {
\r
132 b4MouseDown: function(e) {
\r
133 var x = e.getPageX();
\r
134 var y = e.getPageY();
\r
135 this.autoOffset(x, y);
\r
137 onInitDrag : function(x, y){
\r
138 this.onStartDrag(x, y);
\r
141 createFrame : Ext.emptyFn,
\r
142 getDragEl : function(e){
\r
143 return this.proxy.ghost.dom;
\r
145 endDrag : function(e){
\r
147 this.panel.saveState();
\r
150 autoOffset : function(x, y) {
\r
151 x -= this.startPageX;
\r
152 y -= this.startPageY;
\r
153 this.setDelta(x, y);
\r