1 <!DOCTYPE html><html><head><title>Sencha Documentation Project</title><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../prettify.css" type="text/css"><link rel="stylesheet" href="../prettify_sa.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script></head><body onload="prettyPrint()"><pre class="prettyprint"><pre><span id='Ext-container.Viewport-method-constructor'><span id='Ext-container.Viewport'>/**
2 </span></span> * @class Ext.container.Viewport
3 * @extends Ext.container.Container
5 A specialized container representing the viewable application area (the browser viewport).
7 The Viewport renders itself to the document body, and automatically sizes itself to the size of
8 the browser viewport and manages window resizing. There may only be one Viewport created
11 Like any {@link Ext.container.Container Container}, a Viewport will only perform sizing and positioning
12 on its child Components if you configure it with a {@link #layout}.
14 A Common layout used with Viewports is {@link Ext.layout.container.Border border layout}, but if the
15 required layout is simpler, a different layout should be chosen.
17 For example, to simply make a single child item occupy all available space, use {@link Ext.layout.container.Fit fit layout}.
19 To display one "active" item at full size from a choice of several child items, use {@link Ext.layout.container.Card card layout}.
21 Inner layouts are available by virtue of the fact that all {@link Ext.panel.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.
25 The Viewport does not provide scrolling, so child Panels within the Viewport should provide
26 for scrolling if needed using the {@link #autoScroll} config.
27 {@img Ext.container.Viewport/Ext.container.Viewport.png Ext.container.Viewport component}
28 An example showing a classic application border layout:
30 Ext.create('Ext.container.Viewport', {
32 renderTo: Ext.getBody(),
35 html: '<h1 class="x-panel-header">Page Title</h1>',
44 // could use a TreePanel or AccordionLayout for navigational items
49 html: 'Information goes here',
61 xtype: 'tabpanel', // TabPanel itself has no title
62 activeTab: 0, // First tab active by default
65 html: 'The first tab\'s content. Others may be added dynamically'
71 * Create a new Viewport
72 * @param {Object} config The config object
76 Ext.define('Ext.container.Viewport', {
77 extend: 'Ext.container.Container',
78 alias: 'widget.viewport',
79 requires: ['Ext.EventManager'],
80 alternateClassName: 'Ext.Viewport',
83 * Privatize config options which, if used, would interfere with the
84 * correct operation of the Viewport as the sole manager of the
85 * layout of the document body.
87 <span id='Ext-container.Viewport-cfg-applyTo'> /**
88 </span> * @cfg {Mixed} applyTo @hide
90 <span id='Ext-container.Viewport-cfg-allowDomMove'> /**
91 </span> * @cfg {Boolean} allowDomMove @hide
93 <span id='Ext-container.Viewport-cfg-hideParent'> /**
94 </span> * @cfg {Boolean} hideParent @hide
96 <span id='Ext-container.Viewport-cfg-renderTo'> /**
97 </span> * @cfg {Mixed} renderTo @hide
99 <span id='Ext-container.Viewport-cfg-hideParent'> /**
100 </span> * @cfg {Boolean} hideParent @hide
102 <span id='Ext-container.Viewport-cfg-height'> /**
103 </span> * @cfg {Number} height @hide
105 <span id='Ext-container.Viewport-cfg-width'> /**
106 </span> * @cfg {Number} width @hide
108 <span id='Ext-container.Viewport-cfg-autoHeight'> /**
109 </span> * @cfg {Boolean} autoHeight @hide
111 <span id='Ext-container.Viewport-cfg-autoWidth'> /**
112 </span> * @cfg {Boolean} autoWidth @hide
114 <span id='Ext-container.Viewport-cfg-deferHeight'> /**
115 </span> * @cfg {Boolean} deferHeight @hide
117 <span id='Ext-container.Viewport-cfg-monitorResize'> /**
118 </span> * @cfg {Boolean} monitorResize @hide
123 ariaRole: 'application',
124 initComponent : function() {
126 html = Ext.fly(document.body.parentNode),
128 me.callParent(arguments);
129 html.addCls(Ext.baseCSSPrefix + 'viewport');
131 html.setStyle('overflow', 'auto');
133 me.el = el = Ext.getBody();
134 el.setHeight = Ext.emptyFn;
135 el.setWidth = Ext.emptyFn;
136 el.setSize = Ext.emptyFn;
137 el.dom.scroll = 'no';
138 me.allowDomMove = false;
139 //this.autoWidth = true;
140 //this.autoHeight = true;
141 Ext.EventManager.onWindowResize(me.fireResize, me);
145 fireResize : function(w, h){
146 // setSize is the single entry point to layouts
148 //this.fireEvent('resize', this, w, h, w, h);
151 </pre></pre></body></html>