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.3.1
11 * Copyright(c) 2006-2010 Sencha Inc.
12 * licensing@sencha.com
13 * http://www.sencha.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 = Ext.extend(Object, {
25 constructor : function(panel, config){
27 this.id = this.panel.id +'-ddproxy';
28 Ext.apply(this, config);
31 <div id="cfg-Ext.dd.PanelProxy-insertProxy"></div>/**
32 * @cfg {Boolean} insertProxy True to insert a placeholder proxy element while dragging the panel,
33 * false to drag with no proxy (defaults to true).
38 setStatus : Ext.emptyFn,
44 <div id="method-Ext.dd.PanelProxy-getEl"></div>/**
45 * Gets the proxy's element
46 * @return {Element} The proxy's element
52 <div id="method-Ext.dd.PanelProxy-getGhost"></div>/**
53 * Gets the proxy's ghost element
54 * @return {Element} The proxy's ghost element
56 getGhost : function(){
60 <div id="method-Ext.dd.PanelProxy-getProxy"></div>/**
61 * Gets the proxy's element
62 * @return {Element} The proxy's element
64 getProxy : function(){
68 <div id="method-Ext.dd.PanelProxy-hide"></div>/**
77 this.panel.el.dom.style.display = '';
83 <div id="method-Ext.dd.PanelProxy-show"></div>/**
88 this.ghost = this.panel.createGhost(this.panel.initialConfig.cls, undefined, Ext.getBody());
89 this.ghost.setXY(this.panel.el.getXY());
91 this.proxy = this.panel.el.insertSibling({cls:'x-panel-dd-spacer'});
92 this.proxy.setSize(this.panel.getSize());
94 this.panel.el.dom.style.display = 'none';
99 repair : function(xy, callback, scope){
101 if(typeof callback == "function"){
102 callback.call(scope || this);
106 <div id="method-Ext.dd.PanelProxy-moveProxy"></div>/**
107 * Moves the proxy to a different position in the DOM. This is typically called while dragging the Panel
108 * to keep the proxy sync'd to the Panel's location.
109 * @param {HTMLElement} parentNode The proxy's parent DOM node
110 * @param {HTMLElement} before (optional) The sibling node before which the proxy should be inserted (defaults
111 * to the parent's last child if not specified)
113 moveProxy : function(parentNode, before){
115 parentNode.insertBefore(this.proxy.dom, before);
120 // private - DD implementation for Panels
121 Ext.Panel.DD = Ext.extend(Ext.dd.DragSource, {
123 constructor : function(panel, cfg){
125 this.dragData = {panel: panel};
126 this.proxy = new Ext.dd.PanelProxy(panel, cfg);
127 Ext.Panel.DD.superclass.constructor.call(this, panel.el, cfg);
128 var h = panel.header,
131 this.setHandleElId(h.id);
134 el.setStyle('cursor', 'move');
138 showFrame: Ext.emptyFn,
139 startDrag: Ext.emptyFn,
140 b4StartDrag: function(x, y) {
143 b4MouseDown: function(e) {
144 var x = e.getPageX(),
146 this.autoOffset(x, y);
148 onInitDrag : function(x, y){
149 this.onStartDrag(x, y);
152 createFrame : Ext.emptyFn,
153 getDragEl : function(e){
154 return this.proxy.ghost.dom;
156 endDrag : function(e){
158 this.panel.saveState();
161 autoOffset : function(x, y) {
162 x -= this.startPageX;
163 y -= this.startPageY;