diff options
author | Lionel LASKE <llaske@c2s.fr> | 2012-09-18 19:16:20 (GMT) |
---|---|---|
committer | Lionel LASKE <llaske@c2s.fr> | 2012-09-18 19:16:20 (GMT) |
commit | 816de0918c28461cc2d1e3457348fd5b6e11950f (patch) | |
tree | 667959b6e32d998a5bf4ae927ea59d88b71bfd44 /html/lib/onyx/source/IconButton.js |
Initial version
Diffstat (limited to 'html/lib/onyx/source/IconButton.js')
-rw-r--r-- | html/lib/onyx/source/IconButton.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/html/lib/onyx/source/IconButton.js b/html/lib/onyx/source/IconButton.js new file mode 100644 index 0000000..7d852c5 --- /dev/null +++ b/html/lib/onyx/source/IconButton.js @@ -0,0 +1,38 @@ +/** + An icon that acts like a button. The icon image is specified by setting the + *src* property to a URL. + + {kind: "onyx.IconButton", src: "images/search.png", ontap: "buttonTap"} + + If you want to combine an icon with text inside a button, use an + <a href="#onyx.Icon">onyx.Icon</a> inside an + <a href="#onyx.Button">onyx.Button</a>, e.g.: + + {kind: "onyx.Button", ontap: "buttonTap", components: [ + {kind: "onyx.Icon", src: "images/search.png"}, + {content: "Button"} + ]} + + The image associated with the *src* property of the IconButton is assumed + to be 32x64-pixel strip with the top half showing the button's normal state + and the bottom half showing its state when hovered-over or active. +*/ +enyo.kind({ + name: "onyx.IconButton", + kind: "onyx.Icon", + published: { + active: false + }, + classes: "onyx-icon-button", + //* @protected + rendered: function() { + this.inherited(arguments); + this.activeChanged(); + }, + tap: function() { + this.setActive(true); + }, + activeChanged: function() { + this.bubble("onActivate"); + } +}); |