diff options
author | Lionel LASKE <llaske@c2s.fr> | 2012-08-25 20:23:36 (GMT) |
---|---|---|
committer | Lionel LASKE <llaske@c2s.fr> | 2012-08-25 20:23:36 (GMT) |
commit | ca3ad6305ec0655ad8475a12ac2228b61cdd9ba0 (patch) | |
tree | 7ef2b853640f99807fba7fd3f2a28bda81727297 /html/lib/onyx/source/MenuItem.js |
Init commit
Diffstat (limited to 'html/lib/onyx/source/MenuItem.js')
-rw-r--r-- | html/lib/onyx/source/MenuItem.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/html/lib/onyx/source/MenuItem.js b/html/lib/onyx/source/MenuItem.js new file mode 100644 index 0000000..1272292 --- /dev/null +++ b/html/lib/onyx/source/MenuItem.js @@ -0,0 +1,41 @@ +/** + _MenuItem_ is a button styled to look like a menu item, intended for use in + an <a href="#onyx.Menu">onyx.Menu</a>. When the MenuItem is tapped, it + tells the menu to hide itself and sends an _onSelect_ event with its + content and a reference to itself. This event and its properties may be + received by a client application to determine which menu item was selected. + + enyo.kind({ + handlers: { + onSelect: "itemSelected" + }, + components: [ + {kind: "onyx.MenuDecorator", components: [ + {content: "Open Menu (floating)"}, + {kind: "onyx.Menu", floating: true, components: [ + {content: "1"}, + {content: "2"}, + {classes: "onyx-menu-divider"}, + {content: "3"}, + ]} + ]} + ], + itemSelected: function(inSender, inEvent) { + enyo.log("Menu Item Selected: " + inEvent.originator.content); + } + }) + */ +enyo.kind({ + name: "onyx.MenuItem", + kind: "enyo.Button", + tag: "div", + classes: "onyx-menu-item", + events: { + onSelect: "" + }, + tap: function(inSender) { + this.inherited(arguments); + this.bubble("onRequestHideMenu"); + this.doSelect({selected:this, content:this.content}); + } +});
\ No newline at end of file |