| 1 |
define([ |
| 2 |
"dojo/_base/declare", |
| 3 |
"dojo/keys", |
| 4 |
"./_MenuBase", |
| 5 |
"dojo/text!./templates/MenuBar.html" |
| 6 |
], function(declare, keys, _MenuBase, template){ |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
return declare("dijit.MenuBar", _MenuBase, { |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
templateString: template, |
| 16 |
|
| 17 |
baseClass: "dijitMenuBar", |
| 18 |
|
| 19 |
|
| 20 |
popupDelay: 0, |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
_isMenuBar: true, |
| 25 |
|
| 26 |
|
| 27 |
_orient: ["below"], |
| 28 |
|
| 29 |
_moveToPopup: function( evt){ |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
if(this.focusedChild && this.focusedChild.popup && !this.focusedChild.disabled){ |
| 37 |
this.onItemClick(this.focusedChild, evt); |
| 38 |
} |
| 39 |
}, |
| 40 |
|
| 41 |
focusChild: function(item){ |
| 42 |
|
| 43 |
|
| 44 |
this.inherited(arguments); |
| 45 |
if(this.activated && item.popup && !item.disabled){ |
| 46 |
this._openItemPopup(item, true); |
| 47 |
} |
| 48 |
}, |
| 49 |
|
| 50 |
_onChildDeselect: function(item){ |
| 51 |
|
| 52 |
|
| 53 |
if(this.currentPopupItem == item){ |
| 54 |
this.currentPopupItem = null; |
| 55 |
item._closePopup(); |
| 56 |
} |
| 57 |
|
| 58 |
this.inherited(arguments); |
| 59 |
}, |
| 60 |
|
| 61 |
|
| 62 |
_onLeftArrow: function(){ |
| 63 |
this.focusPrev(); |
| 64 |
}, |
| 65 |
_onRightArrow: function(){ |
| 66 |
this.focusNext(); |
| 67 |
}, |
| 68 |
_onDownArrow: function( evt){ |
| 69 |
this._moveToPopup(evt); |
| 70 |
}, |
| 71 |
_onUpArrow: function(){ |
| 72 |
}, |
| 73 |
|
| 74 |
onItemClick: function( item, evt){ |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
if(item.popup && item.popup.isShowingNow && (!/^key/.test(evt.type) || evt.keyCode !== keys.DOWN_ARROW)){ |
| 82 |
item.focusNode.focus(); |
| 83 |
this._cleanUp(true); |
| 84 |
}else{ |
| 85 |
this.inherited(arguments); |
| 86 |
} |
| 87 |
} |
| 88 |
}); |
| 89 |
}); |