3
* Copyright(c) 2006-2008, Ext JS, LLC.
6
* http://extjs.com/license
9
/* // Internal developer documentation -- will not show up in API docs
10
* @class Ext.dd.PanelProxy
11
* A custom drag proxy implementation specific to {@link Ext.Panel}s. This class is primarily used internally
12
* for the Panel's drag drop implementation, and should never need to be created directly.
14
* @param panel The {@link Ext.Panel} to proxy for
15
* @param config Configuration options
17
Ext.dd.PanelProxy = function(panel, config){
19
this.id = this.panel.id +'-ddproxy';
20
Ext.apply(this, config);
23
Ext.dd.PanelProxy.prototype = {
25
* @cfg {Boolean} insertProxy True to insert a placeholder proxy element while dragging the panel,
26
* false to drag with no proxy (defaults to true).
31
setStatus : Ext.emptyFn,
38
* Gets the proxy's element
39
* @return {Element} The proxy's element
46
* Gets the proxy's ghost element
47
* @return {Element} The proxy's ghost element
49
getGhost : function(){
54
* Gets the proxy's element
55
* @return {Element} The proxy's element
57
getProxy : function(){
70
this.panel.el.dom.style.display = '';
81
this.ghost = this.panel.createGhost(undefined, undefined, Ext.getBody());
82
this.ghost.setXY(this.panel.el.getXY())
84
this.proxy = this.panel.el.insertSibling({cls:'x-panel-dd-spacer'});
85
this.proxy.setSize(this.panel.getSize());
87
this.panel.el.dom.style.display = 'none';
92
repair : function(xy, callback, scope){
94
if(typeof callback == "function"){
95
callback.call(scope || this);
100
* Moves the proxy to a different position in the DOM. This is typically called while dragging the Panel
101
* to keep the proxy sync'd to the Panel's location.
102
* @param {HTMLElement} parentNode The proxy's parent DOM node
103
* @param {HTMLElement} before (optional) The sibling node before which the proxy should be inserted (defaults
104
* to the parent's last child if not specified)
106
moveProxy : function(parentNode, before){
108
parentNode.insertBefore(this.proxy.dom, before);
113
// private - DD implementation for Panels
114
Ext.Panel.DD = function(panel, cfg){
116
this.dragData = {panel: panel};
117
this.proxy = new Ext.dd.PanelProxy(panel, cfg);
118
Ext.Panel.DD.superclass.constructor.call(this, panel.el, cfg);
119
var h = panel.header;
121
this.setHandleElId(h.id);
123
(h ? h : this.panel.body).setStyle('cursor', 'move');
127
Ext.extend(Ext.Panel.DD, Ext.dd.DragSource, {
128
showFrame: Ext.emptyFn,
129
startDrag: Ext.emptyFn,
130
b4StartDrag: function(x, y) {
133
b4MouseDown: function(e) {
134
var x = e.getPageX();
135
var y = e.getPageY();
136
this.autoOffset(x, y);
138
onInitDrag : function(x, y){
139
this.onStartDrag(x, y);
142
createFrame : Ext.emptyFn,
143
getDragEl : function(e){
144
return this.proxy.ghost.dom;
146
endDrag : function(e){
148
this.panel.saveState();
151
autoOffset : function(x, y) {
152
x -= this.startPageX;
153
y -= this.startPageY;
b'\\ No newline at end of file'