diff options
author | Andrew Dolgov <[email protected]> | 2012-08-14 18:59:10 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-08-14 18:59:18 +0400 |
commit | 1354d17270961fff662d40f90521223f8fd0d73b (patch) | |
tree | e9266be71587e47c800303446e968a6d3565e2cf /lib/dijit/MenuBar.js.uncompressed.js | |
parent | d04f8c826f5283765f52cf6b98b42a1ed8f2d6bc (diff) |
update dojo to 1.7.3
Diffstat (limited to 'lib/dijit/MenuBar.js.uncompressed.js')
-rw-r--r-- | lib/dijit/MenuBar.js.uncompressed.js | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/lib/dijit/MenuBar.js.uncompressed.js b/lib/dijit/MenuBar.js.uncompressed.js new file mode 100644 index 000000000..b271b214a --- /dev/null +++ b/lib/dijit/MenuBar.js.uncompressed.js @@ -0,0 +1,83 @@ +require({cache:{ +'url:dijit/templates/MenuBar.html':"<div class=\"dijitMenuBar dijitMenuPassive\" data-dojo-attach-point=\"containerNode\" role=\"menubar\" tabIndex=\"${tabIndex}\" data-dojo-attach-event=\"onkeypress: _onKeyPress\"></div>\n"}}); +define("dijit/MenuBar", [ + "dojo/_base/declare", // declare + "dojo/_base/event", // event.stop + "dojo/keys", // keys.DOWN_ARROW + "./_MenuBase", + "dojo/text!./templates/MenuBar.html" +], function(declare, event, keys, _MenuBase, template){ + +/*===== + var _MenuBase = dijit._MenuBase; +=====*/ + +// module: +// dijit/MenuBar +// summary: +// A menu bar, listing menu choices horizontally, like the "File" menu in most desktop applications + +return declare("dijit.MenuBar", _MenuBase, { + // summary: + // A menu bar, listing menu choices horizontally, like the "File" menu in most desktop applications + + templateString: template, + + baseClass: "dijitMenuBar", + + // _isMenuBar: [protected] Boolean + // This is a MenuBar widget, not a (vertical) Menu widget. + _isMenuBar: true, + + postCreate: function(){ + var l = this.isLeftToRight(); + this.connectKeyNavHandlers( + l ? [keys.LEFT_ARROW] : [keys.RIGHT_ARROW], + l ? [keys.RIGHT_ARROW] : [keys.LEFT_ARROW] + ); + + // parameter to dijit.popup.open() about where to put popup (relative to this.domNode) + this._orient = ["below"]; + }, + + focusChild: function(item){ + // overload focusChild so that whenever the focus is moved to a new item, + // check the previous focused whether it has its popup open, if so, after + // focusing the new item, open its submenu immediately + var prev_item = this.focusedChild, + showpopup = prev_item && prev_item.popup && prev_item.popup.isShowingNow; + this.inherited(arguments); + if(showpopup && item.popup && !item.disabled){ + this._openPopup(); // TODO: on down arrow, _openPopup() is called here and in onItemClick() + } + }, + + _onKeyPress: function(/*Event*/ evt){ + // summary: + // Handle keyboard based menu navigation. + // tags: + // protected + + if(evt.ctrlKey || evt.altKey){ return; } + + switch(evt.charOrCode){ + case keys.DOWN_ARROW: + this._moveToPopup(evt); + event.stop(evt); + } + }, + + onItemClick: function(/*dijit._Widget*/ item, /*Event*/ evt){ + // summary: + // Handle clicks on an item. Cancels a dropdown if already open. + // tags: + // private + if(item.popup && item.popup.isShowingNow){ + item.popup.onCancel(); + }else{ + this.inherited(arguments); + } + } +}); + +}); |