2 * @class Ext.tip.QuickTipManager
3 * <p>Provides attractive and customizable tooltips for any element. The QuickTips
4 * singleton is used to configure and manage tooltips globally for multiple elements
5 * in a generic manner. To create individual tooltips with maximum customizability,
6 * you should consider either {@link Ext.tip.Tip} or {@link Ext.tip.ToolTip}.</p>
7 * <p>Quicktips can be configured via tag attributes directly in markup, or by
8 * registering quick tips programmatically via the {@link #register} method.</p>
9 * <p>The singleton's instance of {@link Ext.tip.QuickTip} is available via
10 * {@link #getQuickTip}, and supports all the methods, and all the all the
11 * configuration properties of Ext.tip.QuickTip. These settings will apply to all
12 * tooltips shown by the singleton.</p>
13 * <p>Below is the summary of the configuration properties which can be used.
14 * For detailed descriptions see the config options for the {@link Ext.tip.QuickTip QuickTip} class</p>
15 * <p><b>QuickTips singleton configs (all are optional)</b></p>
16 * <div class="mdetail-params"><ul><li>dismissDelay</li>
21 * <li>trackMouse</li></ul></div>
22 * <p><b>Target element configs (optional unless otherwise noted)</b></p>
23 * <div class="mdetail-params"><ul><li>autoHide</li>
25 * <li>dismissDelay (overrides singleton value)</li>
26 * <li>target (required)</li>
27 * <li>text (required)</li>
29 * <li>width</li></ul></div>
30 * <p>Here is an example showing how some of these config options could be used:</p>
32 * {@img Ext.tip.QuickTipManager/Ext.tip.QuickTipManager.png Ext.tip.QuickTipManager component}
35 * // Init the singleton. Any tag-based quick tips will start working.
36 * Ext.tip.QuickTipManager.init();
38 * // Apply a set of config properties to the singleton
39 * Ext.apply(Ext.tip.QuickTipManager.getQuickTip(), {
42 * showDelay: 50 // Show 50ms after entering target
45 * // Create a small panel to add a quick tip to
46 * Ext.create('Ext.container.Container', {
47 * id: 'quickTipContainer',
51 * backgroundColor:'#000000'
53 * renderTo: Ext.getBody()
57 * // Manually register a quick tip for a specific element
58 * Ext.tip.QuickTipManager.register({
59 * target: 'quickTipContainer',
60 * title: 'My Tooltip',
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 data-qtip="This is a quick tip from markup!"></input>
83 Ext.define('Ext.tip.QuickTipManager', function() {
88 requires: ['Ext.tip.QuickTip'],
90 alternateClassName: 'Ext.QuickTips',
92 * Initialize the global QuickTips instance and prepare any quick tips.
93 * @param {Boolean} autoRender True to render the QuickTips container immediately to preload images. (Defaults to true)
95 init : function(autoRender){
98 Ext.onReady(function(){
99 Ext.tip.QuickTipManager.init(autoRender);
103 tip = Ext.create('Ext.tip.QuickTip', {
105 renderTo: autoRender !== false ? document.body : undefined
111 * Destroy the QuickTips instance.
113 destroy: function() {
121 // Protected method called by the dd classes
122 ddDisable : function(){
123 // don't disable it if we don't need to
124 if(tip && !disabled){
129 // Protected method called by the dd classes
130 ddEnable : function(){
131 // only enable it if it hasn't been disabled
132 if(tip && !disabled){
138 * Enable quick tips globally.
148 * Disable quick tips globally.
150 disable : function(){
158 * Returns true if quick tips are enabled, else false.
161 isEnabled : function(){
162 return tip !== undefined && !tip.disabled;
166 * Gets the single {@link Ext.tip.QuickTip QuickTip} instance used to show tips from all registered elements.
167 * @return {Ext.tip.QuickTip}
169 getQuickTip : function(){
174 * Configures a new quick tip instance and assigns it to a target element. See
175 * {@link Ext.tip.QuickTip#register} for details.
176 * @param {Object} config The config object
178 register : function(){
179 tip.register.apply(tip, arguments);
183 * Removes any registered quick tip from the target element and destroys it.
184 * @param {String/HTMLElement/Element} el The element from which the quick tip is to be removed.
186 unregister : function(){
187 tip.unregister.apply(tip, arguments);
191 * Alias of {@link #register}.
192 * @param {Object} config The config object
195 tip.register.apply(tip, arguments);