You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

136 lines
5.0 KiB

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