3 * Copyright(c) 2006-2010 Ext JS, Inc.
5 * http://www.extjs.com/license
7 Ext.ux.PanelResizer = Ext.extend(Ext.util.Observable, {
11 constructor: function(config){
12 Ext.apply(this, config);
14 Ext.ux.PanelResizer.superclass.constructor.call(this, config);
20 if(this.panel.elements.indexOf('footer')==-1){
21 p.elements += ',footer';
23 p.on('render', this.onRender, this);
26 onRender : function(p){
27 this.handle = p.footer.createChild({cls:'x-panel-resize'});
29 this.tracker = new Ext.dd.DragTracker({
30 onStart: this.onDragStart.createDelegate(this),
31 onDrag: this.onDrag.createDelegate(this),
32 onEnd: this.onDragEnd.createDelegate(this),
36 this.tracker.initEl(this.handle);
37 p.on('beforedestroy', this.tracker.destroy, this.tracker);
41 onDragStart: function(e){
43 this.startHeight = this.panel.el.getHeight();
44 this.fireEvent('dragstart', this, e);
49 this.panel.setHeight((this.startHeight-this.tracker.getOffset()[1]).constrain(this.minHeight, this.maxHeight));
50 this.fireEvent('drag', this, e);
54 onDragEnd: function(e){
55 this.dragging = false;
56 this.fireEvent('dragend', this, e);
59 Ext.preg('panelresizer', Ext.ux.PanelResizer);