3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.3.1
11 * Copyright(c) 2006-2010 Sencha Inc.
12 * licensing@sencha.com
13 * http://www.sencha.com/license
15 <div id="cls-Ext.QuickTips"></div>/**
16 * @class Ext.QuickTips
17 * <p>Provides attractive and customizable tooltips for any element. The QuickTips
18 * singleton is used to configure and manage tooltips globally for multiple elements
19 * in a generic manner. To create individual tooltips with maximum customizability,
20 * you should consider either {@link Ext.Tip} or {@link Ext.ToolTip}.</p>
21 * <p>Quicktips can be configured via tag attributes directly in markup, or by
22 * registering quick tips programmatically via the {@link #register} method.</p>
23 * <p>The singleton's instance of {@link Ext.QuickTip} is available via
24 * {@link #getQuickTip}, and supports all the methods, and all the all the
25 * configuration properties of Ext.QuickTip. These settings will apply to all
26 * tooltips shown by the singleton.</p>
27 * <p>Below is the summary of the configuration properties which can be used.
28 * For detailed descriptions see the config options for the {@link Ext.QuickTip QuickTip} class</p>
29 * <p><b>QuickTips singleton configs (all are optional)</b></p>
30 * <div class="mdetail-params"><ul><li>dismissDelay</li>
35 * <li>trackMouse</li></ul></div>
36 * <p><b>Target element configs (optional unless otherwise noted)</b></p>
37 * <div class="mdetail-params"><ul><li>autoHide</li>
39 * <li>dismissDelay (overrides singleton value)</li>
40 * <li>target (required)</li>
41 * <li>text (required)</li>
43 * <li>width</li></ul></div>
44 * <p>Here is an example showing how some of these config options could be used:</p>
46 // Init the singleton. Any tag-based quick tips will start working.
49 // Apply a set of config properties to the singleton
50 Ext.apply(Ext.QuickTips.getQuickTip(), {
53 showDelay: 50, // Show 50ms after entering target
57 // Manually register a quick tip for a specific element
58 Ext.QuickTips.register({
61 text: 'This tooltip was added in code',
63 dismissDelay: 10000 // Hide after 10 seconds hover
66 * <p>To register a quick tip in markup, you simply add one or more of the valid QuickTip attributes prefixed with
67 * the <b>ext:</b> namespace. The HTML element itself is automatically set as the quick tip target. Here is the summary
68 * of supported attributes (optional unless otherwise noted):</p>
69 * <ul><li><b>hide</b>: Specifying "user" is equivalent to setting autoHide = false. Any other value will be the
70 * same as autoHide = true.</li>
71 * <li><b>qclass</b>: A CSS class to be applied to the quick tip (equivalent to the 'cls' target element config).</li>
72 * <li><b>qtip (required)</b>: The quick tip text (equivalent to the 'text' target element config).</li>
73 * <li><b>qtitle</b>: The quick tip title (equivalent to the 'title' target element config).</li>
74 * <li><b>qwidth</b>: The quick tip width (equivalent to the 'width' target element config).</li></ul>
75 * <p>Here is an example of configuring an HTML element to display a tooltip from markup:</p>
77 // Add a quick tip to an HTML button
78 <input type="button" value="OK" ext:qtitle="OK Button" ext:qwidth="100"
79 ext:qtip="This is a quick tip from markup!"></input>
83 Ext.QuickTips = function(){
88 <div id="method-Ext.QuickTips-init"></div>/**
89 * Initialize the global QuickTips instance and prepare any quick tips.
90 * @param {Boolean} autoRender True to render the QuickTips container immediately to preload images. (Defaults to true)
92 init : function(autoRender){
95 Ext.onReady(function(){
96 Ext.QuickTips.init(autoRender);
100 tip = new Ext.QuickTip({
101 elements:'header,body',
104 if(autoRender !== false){
105 tip.render(Ext.getBody());
110 // Protected method called by the dd classes
111 ddDisable : function(){
112 // don't disable it if we don't need to
113 if(tip && !disabled){
118 // Protected method called by the dd classes
119 ddEnable : function(){
120 // only enable it if it hasn't been disabled
121 if(tip && !disabled){
126 <div id="method-Ext.QuickTips-enable"></div>/**
127 * Enable quick tips globally.
136 <div id="method-Ext.QuickTips-disable"></div>/**
137 * Disable quick tips globally.
139 disable : function(){
146 <div id="method-Ext.QuickTips-isEnabled"></div>/**
147 * Returns true if quick tips are enabled, else false.
150 isEnabled : function(){
151 return tip !== undefined && !tip.disabled;
154 <div id="method-Ext.QuickTips-getQuickTip"></div>/**
155 * Gets the single {@link Ext.QuickTip QuickTip} instance used to show tips from all registered elements.
156 * @return {Ext.QuickTip}
158 getQuickTip : function(){
162 <div id="method-Ext.QuickTips-register"></div>/**
163 * Configures a new quick tip instance and assigns it to a target element. See
164 * {@link Ext.QuickTip#register} for details.
165 * @param {Object} config The config object
167 register : function(){
168 tip.register.apply(tip, arguments);
171 <div id="method-Ext.QuickTips-unregister"></div>/**
172 * Removes any registered quick tip from the target element and destroys it.
173 * @param {String/HTMLElement/Element} el The element from which the quick tip is to be removed.
175 unregister : function(){
176 tip.unregister.apply(tip, arguments);
179 <div id="method-Ext.QuickTips-tips"></div>/**
180 * Alias of {@link #register}.
181 * @param {Object} config The config object
184 tip.register.apply(tip, arguments);