35e65df8e0cd7c05e19138dced1e1c560e04efe3.svn-base 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Ext JS Library 2.0 Copyright(c) 2006-2007, Ext JS, LLC. licensing@extjs.com
  3. *
  4. * http://extjs.com/license
  5. */
  6. Ext.dd.PanelProxy = function(A, B) {
  7. this.panel = A;
  8. this.id = this.panel.id + "-ddproxy";
  9. Ext.apply(this, B)
  10. };
  11. Ext.dd.PanelProxy.prototype = {
  12. insertProxy : true,
  13. setStatus : Ext.emptyFn,
  14. reset : Ext.emptyFn,
  15. update : Ext.emptyFn,
  16. stop : Ext.emptyFn,
  17. sync : Ext.emptyFn,
  18. getEl : function() {
  19. return this.ghost
  20. },
  21. getGhost : function() {
  22. return this.ghost
  23. },
  24. getProxy : function() {
  25. return this.proxy
  26. },
  27. hide : function() {
  28. if (this.ghost) {
  29. if (this.proxy) {
  30. this.proxy.remove();
  31. delete this.proxy
  32. }
  33. this.panel.el.dom.style.display = "";
  34. this.ghost.remove();
  35. delete this.ghost
  36. }
  37. },
  38. show : function() {
  39. if (!this.ghost) {
  40. this.ghost = this.panel.createGhost(undefined, undefined, Ext
  41. .getBody());
  42. this.ghost.setXY(this.panel.el.getXY());
  43. if (this.insertProxy) {
  44. this.proxy = this.panel.el.insertSibling({
  45. cls : "x-panel-dd-spacer"
  46. });
  47. this.proxy.setSize(this.panel.getSize())
  48. }
  49. this.panel.el.dom.style.display = "none"
  50. }
  51. },
  52. repair : function(B, C, A) {
  53. this.hide();
  54. if (typeof C == "function") {
  55. C.call(A || this)
  56. }
  57. },
  58. moveProxy : function(A, B) {
  59. if (this.proxy) {
  60. A.insertBefore(this.proxy.dom, B)
  61. }
  62. }
  63. };
  64. Ext.Panel.DD = function(B, A) {
  65. this.panel = B;
  66. this.dragData = {
  67. panel : B
  68. };
  69. this.proxy = new Ext.dd.PanelProxy(B, A);
  70. Ext.Panel.DD.superclass.constructor.call(this, B.el, A);
  71. this.setHandleElId(B.header.id);
  72. B.header.setStyle("cursor", "move");
  73. this.scroll = false
  74. };
  75. Ext.extend(Ext.Panel.DD, Ext.dd.DragSource, {
  76. showFrame : Ext.emptyFn,
  77. startDrag : Ext.emptyFn,
  78. b4StartDrag : function(A, B) {
  79. this.proxy.show()
  80. },
  81. b4MouseDown : function(B) {
  82. var A = B.getPageX();
  83. var C = B.getPageY();
  84. this.autoOffset(A, C)
  85. },
  86. onInitDrag : function(A, B) {
  87. this.onStartDrag(A, B);
  88. return true
  89. },
  90. createFrame : Ext.emptyFn,
  91. getDragEl : function(A) {
  92. return this.proxy.ghost.dom
  93. },
  94. endDrag : function(A) {
  95. this.proxy.hide();
  96. this.panel.saveState()
  97. },
  98. autoOffset : function(A, B) {
  99. A -= this.startPageX;
  100. B -= this.startPageY;
  101. this.setDelta(A, B)
  102. }
  103. });