src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Tooltip.js
changeset 557 bca7a7e058a3
equal deleted inserted replaced
-1:000000000000 557:bca7a7e058a3
       
     1 /**
       
     2  * Tooltip.js
       
     3  *
       
     4  * Copyright, Moxiecode Systems AB
       
     5  * Released under LGPL License.
       
     6  *
       
     7  * License: http://www.tinymce.com/license
       
     8  * Contributing: http://www.tinymce.com/contributing
       
     9  */
       
    10 
       
    11 /**
       
    12  * Creates a tooltip instance.
       
    13  *
       
    14  * @-x-less ToolTip.less
       
    15  * @class tinymce.ui.ToolTip
       
    16  * @extends tinymce.ui.Control
       
    17  * @mixes tinymce.ui.Movable
       
    18  */
       
    19 define("tinymce/ui/Tooltip", [
       
    20 	"tinymce/ui/Control",
       
    21 	"tinymce/ui/Movable"
       
    22 ], function(Control, Movable) {
       
    23 	return Control.extend({
       
    24 		Mixins: [Movable],
       
    25 
       
    26 		Defaults: {
       
    27 			classes: 'widget tooltip tooltip-n'
       
    28 		},
       
    29 
       
    30 		/**
       
    31 		 * Sets/gets the current label text.
       
    32 		 *
       
    33 		 * @method text
       
    34 		 * @param {String} [text] New label text.
       
    35 		 * @return {String|tinymce.ui.Tooltip} Current text or current label instance.
       
    36 		 */
       
    37 		text: function(value) {
       
    38 			var self = this;
       
    39 
       
    40 			if (typeof value != "undefined") {
       
    41 				self._value = value;
       
    42 
       
    43 				if (self._rendered) {
       
    44 					self.getEl().lastChild.innerHTML = self.encode(value);
       
    45 				}
       
    46 
       
    47 				return self;
       
    48 			}
       
    49 
       
    50 			return self._value;
       
    51 		},
       
    52 
       
    53 		/**
       
    54 		 * Renders the control as a HTML string.
       
    55 		 *
       
    56 		 * @method renderHtml
       
    57 		 * @return {String} HTML representing the control.
       
    58 		 */
       
    59 		renderHtml: function() {
       
    60 			var self = this, prefix = self.classPrefix;
       
    61 
       
    62 			return (
       
    63 				'<div id="' + self._id + '" class="' + self.classes() + '" role="presentation">' +
       
    64 					'<div class="' + prefix + 'tooltip-arrow"></div>' +
       
    65 					'<div class="' + prefix + 'tooltip-inner">' + self.encode(self._text) + '</div>' +
       
    66 				'</div>'
       
    67 			);
       
    68 		},
       
    69 
       
    70 		/**
       
    71 		 * Repaints the control after a layout operation.
       
    72 		 *
       
    73 		 * @method repaint
       
    74 		 */
       
    75 		repaint: function() {
       
    76 			var self = this, style, rect;
       
    77 
       
    78 			style = self.getEl().style;
       
    79 			rect = self._layoutRect;
       
    80 
       
    81 			style.left = rect.x + 'px';
       
    82 			style.top = rect.y + 'px';
       
    83 			style.zIndex = 0xFFFF + 0xFFFF;
       
    84 		}
       
    85 	});
       
    86 });