From 816de0918c28461cc2d1e3457348fd5b6e11950f Mon Sep 17 00:00:00 2001 From: Lionel LASKE Date: Tue, 18 Sep 2012 19:16:20 +0000 Subject: Initial version --- (limited to 'html/lib/onyx/source/Icon.js') diff --git a/html/lib/onyx/source/Icon.js b/html/lib/onyx/source/Icon.js new file mode 100644 index 0000000..ea10a99 --- /dev/null +++ b/html/lib/onyx/source/Icon.js @@ -0,0 +1,31 @@ +/** + A control that displays an icon. The icon image is specified by setting the + *src* property to a URL. + + In onyx, icons have a size of 32x32 pixels. Since the icon image is applied + as a CSS background, the height and width of an icon must be set if an image + of a different size is used. + + {kind: "onyx.Icon", src: "images/search.png"} + + When an icon should act like a button, use an onyx.IconButton. + +*/ +enyo.kind({ + name: "onyx.Icon", + published: { + // url path specifying the icon image + src: "" + }, + classes: "onyx-icon", + //* @protected + create: function() { + this.inherited(arguments); + if (this.src) { + this.srcChanged(); + } + }, + srcChanged: function() { + this.applyStyle("background-image", "url(" + enyo.path.rewrite(this.src) + ")"); + } +}); \ No newline at end of file -- cgit v0.9.1