Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/html/lib/onyx/source/Icon.js
diff options
context:
space:
mode:
Diffstat (limited to 'html/lib/onyx/source/Icon.js')
-rw-r--r--html/lib/onyx/source/Icon.js31
1 files changed, 31 insertions, 0 deletions
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 <a href="#onyx.IconButton">onyx.IconButton</a>.
+
+*/
+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