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.

71 lines
2.8 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-layout-FitLayout'>/**
  19. </span> * @class Ext.layout.FitLayout
  20. * @extends Ext.layout.ContainerLayout
  21. * &lt;p&gt;This is a base class for layouts that contain &lt;b&gt;a single item&lt;/b&gt; that automatically expands to fill the layout's
  22. * container. This class is intended to be extended or created via the &lt;tt&gt;layout:'fit'&lt;/tt&gt; {@link Ext.Container#layout}
  23. * config, and should generally not need to be created directly via the new keyword.&lt;/p&gt;
  24. * &lt;p&gt;FitLayout does not have any direct config options (other than inherited ones). To fit a panel to a container
  25. * using FitLayout, simply set layout:'fit' on the container and add a single panel to it. If the container has
  26. * multiple panels, only the first one will be displayed. Example usage:&lt;/p&gt;
  27. * &lt;pre&gt;&lt;code&gt;
  28. var p = new Ext.Panel({
  29. title: 'Fit Layout',
  30. layout:'fit',
  31. items: {
  32. title: 'Inner Panel',
  33. html: '&amp;lt;p&amp;gt;This is the inner panel content&amp;lt;/p&amp;gt;',
  34. border: false
  35. }
  36. });
  37. &lt;/code&gt;&lt;/pre&gt;
  38. */
  39. Ext.layout.FitLayout = Ext.extend(Ext.layout.ContainerLayout, {
  40. <span id='Ext-layout-FitLayout-property-monitorResize'> // private
  41. </span> monitorResize:true,
  42. <span id='Ext-layout-FitLayout-property-type'> type: 'fit',
  43. </span>
  44. <span id='Ext-layout-FitLayout-method-getLayoutTargetSize'> getLayoutTargetSize : function() {
  45. </span> var target = this.container.getLayoutTarget();
  46. if (!target) {
  47. return {};
  48. }
  49. // Style Sized (scrollbars not included)
  50. return target.getStyleSize();
  51. },
  52. <span id='Ext-layout-FitLayout-method-onLayout'> // private
  53. </span> onLayout : function(ct, target){
  54. Ext.layout.FitLayout.superclass.onLayout.call(this, ct, target);
  55. if(!ct.collapsed){
  56. this.setItemSize(this.activeItem || ct.items.itemAt(0), this.getLayoutTargetSize());
  57. }
  58. },
  59. <span id='Ext-layout-FitLayout-method-setItemSize'> // private
  60. </span> setItemSize : function(item, size){
  61. if(item &amp;&amp; size.height &gt; 0){ // display none?
  62. item.setSize(size);
  63. }
  64. }
  65. });
  66. Ext.Container.LAYOUTS['fit'] = Ext.layout.FitLayout;</pre>
  67. </body>
  68. </html>