3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.3.0
11 * Copyright(c) 2006-2010 Ext JS, Inc.
13 * http://www.extjs.com/license
15 <div id="cls-Ext.Viewport"></div>/**
17 * @extends Ext.Container
18 * <p>A specialized container representing the viewable application area (the browser viewport).</p>
19 * <p>The Viewport renders itself to the document body, and automatically sizes itself to the size of
20 * the browser viewport and manages window resizing. There may only be one Viewport created
21 * in a page. Inner layouts are available by virtue of the fact that all {@link Ext.Panel Panel}s
22 * added to the Viewport, either through its {@link #items}, or through the items, or the {@link #add}
23 * method of any of its child Panels may themselves have a layout.</p>
24 * <p>The Viewport does not provide scrolling, so child Panels within the Viewport should provide
25 * for scrolling if needed using the {@link #autoScroll} config.</p>
26 * <p>An example showing a classic application border layout:</p><pre><code>
31 html: '<h1 class="x-panel-header">Page Title</h1>',
40 // the west region might typically utilize a {@link Ext.tree.TreePanel TreePanel} or a Panel with {@link Ext.layout.AccordionLayout Accordion layout}
43 title: 'Title for Panel',
45 html: 'Information goes here',
51 title: 'Title for the Grid Panel',
56 // remaining grid configuration not shown ...
57 // notice that the GridPanel is added directly as the region
58 // it is not "overnested" inside another Panel
61 xtype: 'tabpanel', // TabPanel itself has no title
64 html: 'The first tab\'s content. Others may be added dynamically'
70 * Create a new Viewport
71 * @param {Object} config The config object
74 Ext.Viewport = Ext.extend(Ext.Container, {
76 * Privatize config options which, if used, would interfere with the
77 * correct operation of the Viewport as the sole manager of the
78 * layout of the document body.
80 <div id="cfg-Ext.Viewport-applyTo"></div>/**
81 * @cfg {Mixed} applyTo @hide
83 <div id="cfg-Ext.Viewport-allowDomMove"></div>/**
84 * @cfg {Boolean} allowDomMove @hide
86 <div id="cfg-Ext.Viewport-hideParent"></div>/**
87 * @cfg {Boolean} hideParent @hide
89 <div id="cfg-Ext.Viewport-renderTo"></div>/**
90 * @cfg {Mixed} renderTo @hide
92 <div id="cfg-Ext.Viewport-hideParent"></div>/**
93 * @cfg {Boolean} hideParent @hide
95 <div id="cfg-Ext.Viewport-height"></div>/**
96 * @cfg {Number} height @hide
98 <div id="cfg-Ext.Viewport-width"></div>/**
99 * @cfg {Number} width @hide
101 <div id="cfg-Ext.Viewport-autoHeight"></div>/**
102 * @cfg {Boolean} autoHeight @hide
104 <div id="cfg-Ext.Viewport-autoWidth"></div>/**
105 * @cfg {Boolean} autoWidth @hide
107 <div id="cfg-Ext.Viewport-deferHeight"></div>/**
108 * @cfg {Boolean} deferHeight @hide
110 <div id="cfg-Ext.Viewport-monitorResize"></div>/**
111 * @cfg {Boolean} monitorResize @hide
114 initComponent : function() {
115 Ext.Viewport.superclass.initComponent.call(this);
116 document.getElementsByTagName('html')[0].className += ' x-viewport';
117 this.el = Ext.getBody();
118 this.el.setHeight = Ext.emptyFn;
119 this.el.setWidth = Ext.emptyFn;
120 this.el.setSize = Ext.emptyFn;
121 this.el.dom.scroll = 'no';
122 this.allowDomMove = false;
123 this.autoWidth = true;
124 this.autoHeight = true;
125 Ext.EventManager.onWindowResize(this.fireResize, this);
126 this.renderTo = this.el;
129 fireResize : function(w, h){
130 this.fireEvent('resize', this, w, h, w, h);
133 Ext.reg('viewport', Ext.Viewport);