src/js/widgets/tooltipWidget.js
author hamidouk
Tue, 29 Nov 2011 11:09:08 +0100
branchpopcorn-port
changeset 345 8a088f7daa66
parent 336 8da13562cfea
child 409 aa08a47b3dbb
child 474 c1998d5d552e
permissions -rw-r--r--
rollover over the interface buttons now works as expected. Also changed the width of the buttons to the correct size. Resized the width and height of the sprites to be the same as the boxes we display them in.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
     1
/* this widget displays a small tooltip */
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
     2
IriSP.TooltipWidget = function(Popcorn, config, Serializer) {
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
     3
  IriSP.Widget.call(this, Popcorn, config, Serializer);
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
     4
};
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
     5
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
     6
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
     7
IriSP.TooltipWidget.prototype = new IriSP.Widget();
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
     8
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
     9
IriSP.TooltipWidget.prototype.draw = function() {
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    10
  var templ = Mustache.to_html(IriSP.tooltipWidget_template);
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    11
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    12
  this.selector.append(templ);
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    13
  this.hide();
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    14
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    15
};
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    16
336
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 289
diff changeset
    17
IriSP.TooltipWidget.prototype.clear = function() {
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 289
diff changeset
    18
	this.selector.find(".tiptext").text("");
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 289
diff changeset
    19
};
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 289
diff changeset
    20
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    21
IriSP.TooltipWidget.prototype.show = function(text, color, x, y) {
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    22
  if (this.selector.find(".tiptext").text() == text)
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    23
    return;
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    24
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    25
  this.selector.find(".tipcolor").css("background-color", color);
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    26
	this.selector.find(".tiptext").text(text);
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    27
  this.selector.find(".tip").css("left", x).css("top", y);
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    28
};
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    29
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    30
IriSP.TooltipWidget.prototype.hide = function() {
336
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 289
diff changeset
    31
  this.clear();
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    32
  this.selector.find(".tip").css("left", -10000).css("top", -100000);
336
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 289
diff changeset
    33
};