3 * Copyright(c) 2006-2009 Ext JS, LLC
5 * http://www.extjs.com/license
8 * @class Ext.Viewport
\r
9 * @extends Ext.Container
\r
10 * <p>A specialized container representing the viewable application area (the browser viewport).</p>
\r
11 * <p>The Viewport renders itself to the document body, and automatically sizes itself to the size of
\r
12 * the browser viewport and manages window resizing. There may only be one Viewport created
\r
13 * in a page. Inner layouts are available by virtue of the fact that all {@link Ext.Panel Panel}s
\r
14 * added to the Viewport, either through its {@link #items}, or through the items, or the {@link #add}
\r
15 * method of any of its child Panels may themselves have a layout.</p>
\r
16 * <p>The Viewport does not provide scrolling, so child Panels within the Viewport should provide
\r
17 * for scrolling if needed using the {@link #autoScroll} config.</p>
\r
18 * <p>An example showing a classic application border layout:</p><pre><code>
\r
23 html: '<h1 class="x-panel-header">Page Title</h1>',
\r
30 title: 'Navigation',
\r
32 // the west region might typically utilize a {@link Ext.tree.TreePanel TreePanel} or a Panel with {@link Ext.layout.AccordionLayout Accordion layout}
\r
35 title: 'Title for Panel',
\r
37 html: 'Information goes here',
\r
43 title: 'Title for the Grid Panel',
\r
48 // remaining grid configuration not shown ...
\r
49 // notice that the GridPanel is added directly as the region
\r
50 // it is not "overnested" inside another Panel
\r
53 xtype: 'tabpanel', // TabPanel itself has no title
\r
55 title: 'Default Tab',
\r
56 html: 'The first tab\'s content. Others may be added dynamically'
\r
62 * Create a new Viewport
\r
63 * @param {Object} config The config object
\r
66 Ext.Viewport = Ext.extend(Ext.Container, {
\r
68 * Privatize config options which, if used, would interfere with the
\r
69 * correct operation of the Viewport as the sole manager of the
\r
70 * layout of the document body.
\r
73 * @cfg {Mixed} applyTo @hide
\r
76 * @cfg {Boolean} allowDomMove @hide
\r
79 * @cfg {Boolean} hideParent @hide
\r
82 * @cfg {Mixed} renderTo @hide
\r
85 * @cfg {Boolean} hideParent @hide
\r
88 * @cfg {Number} height @hide
\r
91 * @cfg {Number} width @hide
\r
94 * @cfg {Boolean} autoHeight @hide
\r
97 * @cfg {Boolean} autoWidth @hide
\r
100 * @cfg {Boolean} deferHeight @hide
\r
103 * @cfg {Boolean} monitorResize @hide
\r
106 initComponent : function() {
\r
107 Ext.Viewport.superclass.initComponent.call(this);
\r
108 document.getElementsByTagName('html')[0].className += ' x-viewport';
\r
109 this.el = Ext.getBody();
\r
110 this.el.setHeight = Ext.emptyFn;
\r
111 this.el.setWidth = Ext.emptyFn;
\r
112 this.el.setSize = Ext.emptyFn;
\r
113 this.el.dom.scroll = 'no';
\r
114 this.allowDomMove = false;
\r
115 this.autoWidth = true;
\r
116 this.autoHeight = true;
\r
117 Ext.EventManager.onWindowResize(this.fireResize, this);
\r
118 this.renderTo = this.el;
\r
121 fireResize : function(w, h){
\r
122 this.onResize(w, h, w, h);
\r
125 Ext.reg('viewport', Ext.Viewport);
\r