]>
git.wh0rd.org - tt-rss.git/blob - lib/dijit/MenuBar.js.uncompressed.js
2 '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"}});
3 define("dijit/MenuBar", [
4 "dojo/_base/declare", // declare
5 "dojo/_base/event", // event.stop
6 "dojo/keys", // keys.DOWN_ARROW
8 "dojo/text!./templates/MenuBar.html"
9 ], function(declare
, event
, keys
, _MenuBase
, template
){
12 var _MenuBase = dijit._MenuBase;
18 // A menu bar, listing menu choices horizontally, like the "File" menu in most desktop applications
20 return declare("dijit.MenuBar", _MenuBase
, {
22 // A menu bar, listing menu choices horizontally, like the "File" menu in most desktop applications
24 templateString
: template
,
26 baseClass
: "dijitMenuBar",
28 // _isMenuBar: [protected] Boolean
29 // This is a MenuBar widget, not a (vertical) Menu widget.
32 postCreate: function(){
33 var l
= this.isLeftToRight();
34 this.connectKeyNavHandlers(
35 l
? [keys
.LEFT_ARROW
] : [keys
.RIGHT_ARROW
],
36 l
? [keys
.RIGHT_ARROW
] : [keys
.LEFT_ARROW
]
39 // parameter to dijit.popup.open() about where to put popup (relative to this.domNode)
40 this._orient
= ["below"];
43 focusChild: function(item
){
44 // overload focusChild so that whenever the focus is moved to a new item,
45 // check the previous focused whether it has its popup open, if so, after
46 // focusing the new item, open its submenu immediately
47 var prev_item
= this.focusedChild
,
48 showpopup
= prev_item
&& prev_item
.popup
&& prev_item
.popup
.isShowingNow
;
49 this.inherited(arguments
);
50 if(showpopup
&& item
.popup
&& !item
.disabled
){
51 this._openPopup(); // TODO: on down arrow, _openPopup() is called here and in onItemClick()
55 _onKeyPress: function(/*Event*/ evt
){
57 // Handle keyboard based menu navigation.
61 if(evt
.ctrlKey
|| evt
.altKey
){ return; }
63 switch(evt
.charOrCode
){
65 this._moveToPopup(evt
);
70 onItemClick: function(/*dijit._Widget*/ item
, /*Event*/ evt
){
72 // Handle clicks on an item. Cancels a dropdown if already open.
75 if(item
.popup
&& item
.popup
.isShowingNow
){
76 item
.popup
.onCancel();
78 this.inherited(arguments
);