3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
4 <title>The source code</title>
\r
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
8 <body onload="prettyPrint();">
\r
9 <pre class="prettyprint lang-js"><div id="cls-Ext.dd.PanelProxy"></div>/**
\r
10 * @class Ext.dd.PanelProxy
\r
11 * A custom drag proxy implementation specific to {@link Ext.Panel}s. This class is primarily used internally
\r
12 * for the Panel's drag drop implementation, and should never need to be created directly.
\r
14 * @param panel The {@link Ext.Panel} to proxy for
\r
15 * @param config Configuration options
\r
17 Ext.dd.PanelProxy = function(panel, config){
\r
19 this.id = this.panel.id +'-ddproxy';
\r
20 Ext.apply(this, config);
\r
23 Ext.dd.PanelProxy.prototype = {
\r
24 <div id="cfg-Ext.dd.PanelProxy-insertProxy"></div>/**
\r
25 * @cfg {Boolean} insertProxy True to insert a placeholder proxy element while dragging the panel,
\r
26 * false to drag with no proxy (defaults to true).
\r
30 // private overrides
\r
31 setStatus : Ext.emptyFn,
\r
32 reset : Ext.emptyFn,
\r
33 update : Ext.emptyFn,
\r
37 <div id="method-Ext.dd.PanelProxy-getEl"></div>/**
\r
38 * Gets the proxy's element
\r
39 * @return {Element} The proxy's element
\r
45 <div id="method-Ext.dd.PanelProxy-getGhost"></div>/**
\r
46 * Gets the proxy's ghost element
\r
47 * @return {Element} The proxy's ghost element
\r
49 getGhost : function(){
\r
53 <div id="method-Ext.dd.PanelProxy-getProxy"></div>/**
\r
54 * Gets the proxy's element
\r
55 * @return {Element} The proxy's element
\r
57 getProxy : function(){
\r
61 <div id="method-Ext.dd.PanelProxy-hide"></div>/**
\r
67 this.proxy.remove();
\r
70 this.panel.el.dom.style.display = '';
\r
71 this.ghost.remove();
\r
76 <div id="method-Ext.dd.PanelProxy-show"></div>/**
\r
81 this.ghost = this.panel.createGhost(undefined, undefined, Ext.getBody());
\r
82 this.ghost.setXY(this.panel.el.getXY())
\r
83 if(this.insertProxy){
\r
84 this.proxy = this.panel.el.insertSibling({cls:'x-panel-dd-spacer'});
\r
85 this.proxy.setSize(this.panel.getSize());
\r
87 this.panel.el.dom.style.display = 'none';
\r
92 repair : function(xy, callback, scope){
\r
94 if(typeof callback == "function"){
\r
95 callback.call(scope || this);
\r
99 <div id="method-Ext.dd.PanelProxy-moveProxy"></div>/**
\r
100 * Moves the proxy to a different position in the DOM. This is typically called while dragging the Panel
\r
101 * to keep the proxy sync'd to the Panel's location.
\r
102 * @param {HTMLElement} parentNode The proxy's parent DOM node
\r
103 * @param {HTMLElement} before (optional) The sibling node before which the proxy should be inserted (defaults
\r
104 * to the parent's last child if not specified)
\r
106 moveProxy : function(parentNode, before){
\r
108 parentNode.insertBefore(this.proxy.dom, before);
\r
113 // private - DD implementation for Panels
\r
114 Ext.Panel.DD = function(panel, cfg){
\r
115 this.panel = panel;
\r
116 this.dragData = {panel: panel};
\r
117 this.proxy = new Ext.dd.PanelProxy(panel, cfg);
\r
118 Ext.Panel.DD.superclass.constructor.call(this, panel.el, cfg);
\r
119 var h = panel.header;
\r
121 this.setHandleElId(h.id);
\r
123 (h ? h : this.panel.body).setStyle('cursor', 'move');
\r
124 this.scroll = false;
\r
127 Ext.extend(Ext.Panel.DD, Ext.dd.DragSource, {
\r
128 showFrame: Ext.emptyFn,
\r
129 startDrag: Ext.emptyFn,
\r
130 b4StartDrag: function(x, y) {
\r
133 b4MouseDown: function(e) {
\r
134 var x = e.getPageX();
\r
135 var y = e.getPageY();
\r
136 this.autoOffset(x, y);
\r
138 onInitDrag : function(x, y){
\r
139 this.onStartDrag(x, y);
\r
142 createFrame : Ext.emptyFn,
\r
143 getDragEl : function(e){
\r
144 return this.proxy.ghost.dom;
\r
146 endDrag : function(e){
\r
148 this.panel.saveState();
\r
151 autoOffset : function(x, y) {
\r
152 x -= this.startPageX;
\r
153 y -= this.startPageY;
\r
154 this.setDelta(x, y);
\r