source: trunk/web/addons/job_monarch/lib/extjs-30/src/widgets/Viewport.js @ 625

Last change on this file since 625 was 625, checked in by ramonb, 15 years ago

lib/extjs-30:

  • new ExtJS 3.0
File size: 3.9 KB
Line 
1/*!
2 * Ext JS Library 3.0.0
3 * Copyright(c) 2006-2009 Ext JS, LLC
4 * licensing@extjs.com
5 * http://www.extjs.com/license
6 */
7/**
8 * @class Ext.Viewport
9 * @extends Ext.Container
10 * <p>A specialized container representing the viewable application area (the browser viewport).</p>
11 * <p>The Viewport renders itself to the document body, and automatically sizes itself to the size of
12 * the browser viewport and manages window resizing. There may only be one Viewport created
13 * in a page. Inner layouts are available by virtue of the fact that all {@link Ext.Panel Panel}s
14 * added to the Viewport, either through its {@link #items}, or through the items, or the {@link #add}
15 * method of any of its child Panels may themselves have a layout.</p>
16 * <p>The Viewport does not provide scrolling, so child Panels within the Viewport should provide
17 * for scrolling if needed using the {@link #autoScroll} config.</p>
18 * <p>An example showing a classic application border layout:</p><pre><code>
19new Ext.Viewport({
20    layout: 'border',
21    items: [{
22        region: 'north',
23        html: '&lt;h1 class="x-panel-header">Page Title&lt;/h1>',
24        autoHeight: true,
25        border: false,
26        margins: '0 0 5 0'
27    }, {
28        region: 'west',
29        collapsible: true,
30        title: 'Navigation',
31        width: 200
32        // the west region might typically utilize a {@link Ext.tree.TreePanel TreePanel} or a Panel with {@link Ext.layout.AccordionLayout Accordion layout}
33    }, {
34        region: 'south',
35        title: 'Title for Panel',
36        collapsible: true,
37        html: 'Information goes here',
38        split: true,
39        height: 100,
40        minHeight: 100
41    }, {
42        region: 'east',
43        title: 'Title for the Grid Panel',
44        collapsible: true,
45        split: true,
46        width: 200,
47        xtype: 'grid',
48        // remaining grid configuration not shown ...
49        // notice that the GridPanel is added directly as the region
50        // it is not "overnested" inside another Panel
51    }, {
52        region: 'center',
53        xtype: 'tabpanel', // TabPanel itself has no title
54        items: {
55            title: 'Default Tab',
56            html: 'The first tab\'s content. Others may be added dynamically'
57        }
58    }]
59});
60</code></pre>
61 * @constructor
62 * Create a new Viewport
63 * @param {Object} config The config object
64 * @xtype viewport
65 */
66Ext.Viewport = Ext.extend(Ext.Container, {
67        /*
68         * Privatize config options which, if used, would interfere with the
69         * correct operation of the Viewport as the sole manager of the
70         * layout of the document body.
71         */
72    /**
73     * @cfg {Mixed} applyTo @hide
74         */
75    /**
76     * @cfg {Boolean} allowDomMove @hide
77         */
78    /**
79     * @cfg {Boolean} hideParent @hide
80         */
81    /**
82     * @cfg {Mixed} renderTo @hide
83         */
84    /**
85     * @cfg {Boolean} hideParent @hide
86         */
87    /**
88     * @cfg {Number} height @hide
89         */
90    /**
91     * @cfg {Number} width @hide
92         */
93    /**
94     * @cfg {Boolean} autoHeight @hide
95         */
96    /**
97     * @cfg {Boolean} autoWidth @hide
98         */
99    /**
100     * @cfg {Boolean} deferHeight @hide
101         */
102    /**
103     * @cfg {Boolean} monitorResize @hide
104         */
105    initComponent : function() {
106        Ext.Viewport.superclass.initComponent.call(this);
107        document.getElementsByTagName('html')[0].className += ' x-viewport';
108        this.el = Ext.getBody();
109        this.el.setHeight = Ext.emptyFn;
110        this.el.setWidth = Ext.emptyFn;
111        this.el.setSize = Ext.emptyFn;
112        this.el.dom.scroll = 'no';
113        this.allowDomMove = false;
114        this.autoWidth = true;
115        this.autoHeight = true;
116        Ext.EventManager.onWindowResize(this.fireResize, this);
117        this.renderTo = this.el;
118    },
119
120    fireResize : function(w, h){
121        this.fireEvent('resize', this, w, h, w, h);
122    }
123});
124Ext.reg('viewport', Ext.Viewport);
Note: See TracBrowser for help on using the repository browser.