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.

97 lines
3.3 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-AbsoluteLayout'>/**
  19. </span> * @class Ext.layout.AbsoluteLayout
  20. * @extends Ext.layout.AnchorLayout
  21. * &lt;p&gt;This is a layout that inherits the anchoring of &lt;b&gt;{@link Ext.layout.AnchorLayout}&lt;/b&gt; and adds the
  22. * ability for x/y positioning using the standard x and y component config options.&lt;/p&gt;
  23. * &lt;p&gt;This class is intended to be extended or created via the &lt;tt&gt;&lt;b&gt;{@link Ext.Container#layout layout}&lt;/b&gt;&lt;/tt&gt;
  24. * configuration property. See &lt;tt&gt;&lt;b&gt;{@link Ext.Container#layout}&lt;/b&gt;&lt;/tt&gt; for additional details.&lt;/p&gt;
  25. * &lt;p&gt;Example usage:&lt;/p&gt;
  26. * &lt;pre&gt;&lt;code&gt;
  27. var form = new Ext.form.FormPanel({
  28. title: 'Absolute Layout',
  29. layout:'absolute',
  30. layoutConfig: {
  31. // layout-specific configs go here
  32. extraCls: 'x-abs-layout-item',
  33. },
  34. baseCls: 'x-plain',
  35. url:'save-form.php',
  36. defaultType: 'textfield',
  37. items: [{
  38. x: 0,
  39. y: 5,
  40. xtype:'label',
  41. text: 'Send To:'
  42. },{
  43. x: 60,
  44. y: 0,
  45. name: 'to',
  46. anchor:'100%' // anchor width by percentage
  47. },{
  48. x: 0,
  49. y: 35,
  50. xtype:'label',
  51. text: 'Subject:'
  52. },{
  53. x: 60,
  54. y: 30,
  55. name: 'subject',
  56. anchor: '100%' // anchor width by percentage
  57. },{
  58. x:0,
  59. y: 60,
  60. xtype: 'textarea',
  61. name: 'msg',
  62. anchor: '100% 100%' // anchor width and height
  63. }]
  64. });
  65. &lt;/code&gt;&lt;/pre&gt;
  66. */
  67. Ext.layout.AbsoluteLayout = Ext.extend(Ext.layout.AnchorLayout, {
  68. <span id='Ext-layout-AbsoluteLayout-cfg-extraCls'> extraCls: 'x-abs-layout-item',
  69. </span>
  70. <span id='Ext-layout-AbsoluteLayout-property-type'> type: 'absolute',
  71. </span>
  72. <span id='Ext-layout-AbsoluteLayout-method-onLayout'> onLayout : function(ct, target){
  73. </span> target.position();
  74. this.paddingLeft = target.getPadding('l');
  75. this.paddingTop = target.getPadding('t');
  76. Ext.layout.AbsoluteLayout.superclass.onLayout.call(this, ct, target);
  77. },
  78. <span id='Ext-layout-AbsoluteLayout-method-adjustWidthAnchor'> // private
  79. </span> adjustWidthAnchor : function(value, comp){
  80. return value ? value - comp.getPosition(true)[0] + this.paddingLeft : value;
  81. },
  82. <span id='Ext-layout-AbsoluteLayout-method-adjustHeightAnchor'> // private
  83. </span> adjustHeightAnchor : function(value, comp){
  84. return value ? value - comp.getPosition(true)[1] + this.paddingTop : value;
  85. }
  86. <span id='Ext-layout-AbsoluteLayout-property-activeItem'> /**
  87. </span> * @property activeItem
  88. * @hide
  89. */
  90. });
  91. Ext.Container.LAYOUTS['absolute'] = Ext.layout.AbsoluteLayout;
  92. </pre>
  93. </body>
  94. </html>