From ca3ad6305ec0655ad8475a12ac2228b61cdd9ba0 Mon Sep 17 00:00:00 2001 From: Lionel LASKE Date: Sat, 25 Aug 2012 20:23:36 +0000 Subject: Init commit --- (limited to 'html/lib/onyx/source/TooltipDecorator.js') diff --git a/html/lib/onyx/source/TooltipDecorator.js b/html/lib/onyx/source/TooltipDecorator.js new file mode 100644 index 0000000..a97167d --- /dev/null +++ b/html/lib/onyx/source/TooltipDecorator.js @@ -0,0 +1,44 @@ +/** + A control that activates an onyx.Tooltip. It + surrounds a control such as a button and displays the tooltip when the + control generates an _onEnter_ event: + + {kind: "onyx.TooltipDecorator", components: [ + {kind: "onyx.Button", content: "Tooltip"}, + {kind: "onyx.Tooltip", content: "I'm a tooltip for a button."} + ]} + + Here's an example with an onyx.Input control and a + decorator around the input: + + {kind: "onyx.TooltipDecorator", components: [ + {kind: "onyx.InputDecorator", components: [ + {kind: "onyx.Input", placeholder: "Just an input..."} + ]}, + {kind: "onyx.Tooltip", content: "I'm a tooltip for an input."} + ]} +*/ +enyo.kind({ + name: "onyx.TooltipDecorator", + defaultKind: "onyx.Button", + classes: "onyx-popup-decorator", + handlers: { + onenter: "enter", + onleave: "leave" + }, + enter: function() { + this.requestShowTooltip(); + }, + leave: function() { + this.requestHideTooltip(); + }, + tap: function() { + this.requestHideTooltip(); + }, + requestShowTooltip: function() { + this.waterfallDown("onRequestShowTooltip"); + }, + requestHideTooltip: function() { + this.waterfallDown("onRequestHideTooltip"); + } +}); \ No newline at end of file -- cgit v0.9.1