webui-aria2/js/libs/dijit/form/_ComboBoxMenu.js
2012-05-01 19:52:07 +08:00

62 lines
2.0 KiB
JavaScript

//>>built
define("dijit/form/_ComboBoxMenu",["dojo/_base/declare","dojo/dom-class","dojo/dom-construct","dojo/dom-style","dojo/keys","../_WidgetBase","../_TemplatedMixin","./_ComboBoxMenuMixin","./_ListMouseMixin"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9){
return _1("dijit.form._ComboBoxMenu",[_6,_7,_9,_8],{templateString:"<div class='dijitReset dijitMenu' data-dojo-attach-point='containerNode' style='overflow: auto; overflow-x: hidden;'>"+"<div class='dijitMenuItem dijitMenuPreviousButton' data-dojo-attach-point='previousButton' role='option'></div>"+"<div class='dijitMenuItem dijitMenuNextButton' data-dojo-attach-point='nextButton' role='option'></div>"+"</div>",baseClass:"dijitComboBoxMenu",postCreate:function(){
this.inherited(arguments);
if(!this.isLeftToRight()){
_2.add(this.previousButton,"dijitMenuItemRtl");
_2.add(this.nextButton,"dijitMenuItemRtl");
}
},_createMenuItem:function(){
return _3.create("div",{"class":"dijitReset dijitMenuItem"+(this.isLeftToRight()?"":" dijitMenuItemRtl"),role:"option"});
},onHover:function(_a){
_2.add(_a,"dijitMenuItemHover");
},onUnhover:function(_b){
_2.remove(_b,"dijitMenuItemHover");
},onSelect:function(_c){
_2.add(_c,"dijitMenuItemSelected");
},onDeselect:function(_d){
_2.remove(_d,"dijitMenuItemSelected");
},_page:function(up){
var _e=0;
var _f=this.domNode.scrollTop;
var _10=_4.get(this.domNode,"height");
if(!this.getHighlightedOption()){
this.selectNextNode();
}
while(_e<_10){
var _11=this.getHighlightedOption();
if(up){
if(!_11.previousSibling||_11.previousSibling.style.display=="none"){
break;
}
this.selectPreviousNode();
}else{
if(!_11.nextSibling||_11.nextSibling.style.display=="none"){
break;
}
this.selectNextNode();
}
var _12=this.domNode.scrollTop;
_e+=(_12-_f)*(up?-1:1);
_f=_12;
}
},handleKey:function(evt){
switch(evt.charOrCode){
case _5.DOWN_ARROW:
this.selectNextNode();
return false;
case _5.PAGE_DOWN:
this._page(false);
return false;
case _5.UP_ARROW:
this.selectPreviousNode();
return false;
case _5.PAGE_UP:
this._page(true);
return false;
default:
return true;
}
}});
});