Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / docs / source / PanelDD.html
diff --git a/docs/source/PanelDD.html b/docs/source/PanelDD.html
new file mode 100644 (file)
index 0000000..8fab00e
--- /dev/null
@@ -0,0 +1,157 @@
+<html>\r
+<head>\r
+  <title>The source code</title>\r
+    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
+    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
+</head>\r
+<body  onload="prettyPrint();">\r
+    <pre class="prettyprint lang-js"><div id="cls-Ext.dd.PanelProxy"></div>/**\r
+ * @class Ext.dd.PanelProxy\r
+ * A custom drag proxy implementation specific to {@link Ext.Panel}s. This class is primarily used internally\r
+ * for the Panel's drag drop implementation, and should never need to be created directly.\r
+ * @constructor\r
+ * @param panel The {@link Ext.Panel} to proxy for\r
+ * @param config Configuration options\r
+ */\r
+Ext.dd.PanelProxy = function(panel, config){\r
+    this.panel = panel;\r
+    this.id = this.panel.id +'-ddproxy';\r
+    Ext.apply(this, config);\r
+};\r
+\r
+Ext.dd.PanelProxy.prototype = {\r
+    <div id="cfg-Ext.dd.PanelProxy-insertProxy"></div>/**\r
+     * @cfg {Boolean} insertProxy True to insert a placeholder proxy element while dragging the panel,\r
+     * false to drag with no proxy (defaults to true).\r
+     */\r
+    insertProxy : true,\r
+\r
+    // private overrides\r
+    setStatus : Ext.emptyFn,\r
+    reset : Ext.emptyFn,\r
+    update : Ext.emptyFn,\r
+    stop : Ext.emptyFn,\r
+    sync: Ext.emptyFn,\r
+\r
+    <div id="method-Ext.dd.PanelProxy-getEl"></div>/**\r
+     * Gets the proxy's element\r
+     * @return {Element} The proxy's element\r
+     */\r
+    getEl : function(){\r
+        return this.ghost;\r
+    },\r
+\r
+    <div id="method-Ext.dd.PanelProxy-getGhost"></div>/**\r
+     * Gets the proxy's ghost element\r
+     * @return {Element} The proxy's ghost element\r
+     */\r
+    getGhost : function(){\r
+        return this.ghost;\r
+    },\r
+\r
+    <div id="method-Ext.dd.PanelProxy-getProxy"></div>/**\r
+     * Gets the proxy's element\r
+     * @return {Element} The proxy's element\r
+     */\r
+    getProxy : function(){\r
+        return this.proxy;\r
+    },\r
+\r
+    <div id="method-Ext.dd.PanelProxy-hide"></div>/**\r
+     * Hides the proxy\r
+     */\r
+    hide : function(){\r
+        if(this.ghost){\r
+            if(this.proxy){\r
+                this.proxy.remove();\r
+                delete this.proxy;\r
+            }\r
+            this.panel.el.dom.style.display = '';\r
+            this.ghost.remove();\r
+            delete this.ghost;\r
+        }\r
+    },\r
+\r
+    <div id="method-Ext.dd.PanelProxy-show"></div>/**\r
+     * Shows the proxy\r
+     */\r
+    show : function(){\r
+        if(!this.ghost){\r
+            this.ghost = this.panel.createGhost(undefined, undefined, Ext.getBody());\r
+            this.ghost.setXY(this.panel.el.getXY())\r
+            if(this.insertProxy){\r
+                this.proxy = this.panel.el.insertSibling({cls:'x-panel-dd-spacer'});\r
+                this.proxy.setSize(this.panel.getSize());\r
+            }\r
+            this.panel.el.dom.style.display = 'none';\r
+        }\r
+    },\r
+\r
+    // private\r
+    repair : function(xy, callback, scope){\r
+        this.hide();\r
+        if(typeof callback == "function"){\r
+            callback.call(scope || this);\r
+        }\r
+    },\r
+\r
+    <div id="method-Ext.dd.PanelProxy-moveProxy"></div>/**\r
+     * Moves the proxy to a different position in the DOM.  This is typically called while dragging the Panel\r
+     * to keep the proxy sync'd to the Panel's location.\r
+     * @param {HTMLElement} parentNode The proxy's parent DOM node\r
+     * @param {HTMLElement} before (optional) The sibling node before which the proxy should be inserted (defaults\r
+     * to the parent's last child if not specified)\r
+     */\r
+    moveProxy : function(parentNode, before){\r
+        if(this.proxy){\r
+            parentNode.insertBefore(this.proxy.dom, before);\r
+        }\r
+    }\r
+};\r
+\r
+// private - DD implementation for Panels\r
+Ext.Panel.DD = function(panel, cfg){\r
+    this.panel = panel;\r
+    this.dragData = {panel: panel};\r
+    this.proxy = new Ext.dd.PanelProxy(panel, cfg);\r
+    Ext.Panel.DD.superclass.constructor.call(this, panel.el, cfg);\r
+    var h = panel.header;\r
+    if(h){\r
+        this.setHandleElId(h.id);\r
+    }\r
+    (h ? h : this.panel.body).setStyle('cursor', 'move');\r
+    this.scroll = false;\r
+};\r
+\r
+Ext.extend(Ext.Panel.DD, Ext.dd.DragSource, {\r
+    showFrame: Ext.emptyFn,\r
+    startDrag: Ext.emptyFn,\r
+    b4StartDrag: function(x, y) {\r
+        this.proxy.show();\r
+    },\r
+    b4MouseDown: function(e) {\r
+        var x = e.getPageX();\r
+        var y = e.getPageY();\r
+        this.autoOffset(x, y);\r
+    },\r
+    onInitDrag : function(x, y){\r
+        this.onStartDrag(x, y);\r
+        return true;\r
+    },\r
+    createFrame : Ext.emptyFn,\r
+    getDragEl : function(e){\r
+        return this.proxy.ghost.dom;\r
+    },\r
+    endDrag : function(e){\r
+        this.proxy.hide();\r
+        this.panel.saveState();\r
+    },\r
+\r
+    autoOffset : function(x, y) {\r
+        x -= this.startPageX;\r
+        y -= this.startPageY;\r
+        this.setDelta(x, y);\r
+    }\r
+});</pre>    \r
+</body>\r
+</html>
\ No newline at end of file