3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
16 * Component layout for Tip/ToolTip/etc. components
17 * @class Ext.layout.component.Tip
18 * @extends Ext.layout.component.Dock
22 Ext.define('Ext.layout.component.Tip', {
24 /* Begin Definitions */
26 alias: ['layout.tip'],
28 extend: 'Ext.layout.component.Dock',
34 onLayout: function(width, height) {
44 // Position offscreen so the natural width is not affected by the viewport's right edge
45 el.setXY([-9999,-9999]);
47 // Calculate initial layout
48 this.callParent(arguments);
50 // Handle min/maxWidth for auto-width tips
51 if (!Ext.isNumber(width)) {
52 minWidth = owner.minWidth;
53 maxWidth = owner.maxWidth;
54 // IE6/7 in strict mode have a problem doing an autoWidth
55 if (Ext.isStrict && (Ext.isIE6 || Ext.isIE7)) {
56 constrainedWidth = me.doAutoWidth();
58 naturalWidth = el.getWidth();
60 if (naturalWidth < minWidth) {
61 constrainedWidth = minWidth;
63 else if (naturalWidth > maxWidth) {
64 constrainedWidth = maxWidth;
66 if (constrainedWidth) {
67 this.callParent([constrainedWidth, height]);
75 doAutoWidth: function(){
79 width = body.getTextWidth();
82 width = Math.max(width, owner.header.getWidth());
84 if (!Ext.isDefined(me.frameWidth)) {
85 me.frameWidth = owner.el.getWidth() - body.getWidth();
87 width += me.frameWidth + body.getPadding('lr');