src/js/widgets/tooltipWidget.js
author hamidouk
Wed, 02 Nov 2011 14:35:14 +0100
branchpopcorn-port
changeset 172 3ffa0e0c8803
child 177 69b14f35e900
permissions -rw-r--r--
added a "tooltip" widget. Made some changes to the css corresponding to this widget too.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
172
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
     1
/* this widget displays a small tooltip */
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
     2
IriSP.TooltipWidget = function(Popcorn, config, Serializer) {
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
     3
  IriSP.Widget.call(this, Popcorn, config, Serializer);  
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
     4
};
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
     5
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
     6
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
     7
IriSP.TooltipWidget.prototype = new IriSP.Widget();
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
     8
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
     9
IriSP.TooltipWidget.prototype.draw = function() {
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    10
  var templ = Mustache.to_html(IriSP.tooltipWidget_template);
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    11
  this.selector.append(templ);
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    12
  this.hide();
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    13
  
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    14
};
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    15
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    16
IriSP.TooltipWidget.prototype.show = function(text, color, x, y) {
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    17
  this.selector.children(".tipcolor").css("background-color", color);
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    18
	this.selector.find(".tiptext").text(text);
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    19
  this.selector.children(".tip").css("left", x).css("top", y);
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    20
};
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    21
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    22
IriSP.TooltipWidget.prototype.hide = function() {
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    23
  this.selector.children(".tip").css("left", -10000).css("top", -100000);
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    24
};