| 1 |
define([ |
| 2 |
"dojo/_base/kernel", |
| 3 |
"dojo/_base/declare", |
| 4 |
"dojo/dom-class", |
| 5 |
"dojo/dom-construct", |
| 6 |
"dijit/form/_ComboBoxMenuMixin", |
| 7 |
"dijit/_WidgetBase", |
| 8 |
"./_ListTouchMixin", |
| 9 |
"./scrollable", |
| 10 |
"dojo/has", |
| 11 |
"dojo/has!dojo-bidi?dojox/mobile/bidi/_ComboBoxMenu" |
| 12 |
], |
| 13 |
function(dojo, declare, domClass, domConstruct, ComboBoxMenuMixin, WidgetBase, ListTouchMixin, Scrollable, has, BidiComboBoxMenu){ |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
var _ComboBoxMenu = declare(has("dojo-bidi") ? "dojox.mobile._NonBidiComboBoxMenu" : "dojox.mobile._ComboBoxMenu", [WidgetBase, ListTouchMixin, ComboBoxMenuMixin], { |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
baseClass: "mblComboBoxMenu", |
| 30 |
|
| 31 |
buildRendering: function(){ |
| 32 |
this.domNode = this.focusNode = domConstruct.create("div", { "class":"mblReset" }); |
| 33 |
this.containerNode = domConstruct.create("div", { style: { position:"absolute", top:0, left:0 } }, this.domNode); |
| 34 |
this.previousButton = domConstruct.create("div", { "class":"mblReset mblComboBoxMenuItem mblComboBoxMenuPreviousButton", role:"option" }, this.containerNode); |
| 35 |
this.nextButton = domConstruct.create("div", { "class":"mblReset mblComboBoxMenuItem mblComboBoxMenuNextButton", role:"option" }, this.containerNode); |
| 36 |
this.inherited(arguments); |
| 37 |
}, |
| 38 |
|
| 39 |
_createMenuItem: function(){ |
| 40 |
|
| 41 |
return domConstruct.create("div", { |
| 42 |
"class": "mblReset mblComboBoxMenuItem" +(this.isLeftToRight() ? "" : " mblComboBoxMenuItemRtl"), |
| 43 |
role: "option" |
| 44 |
}); |
| 45 |
}, |
| 46 |
|
| 47 |
onSelect: function( node){ |
| 48 |
|
| 49 |
|
| 50 |
domClass.add(node, "mblComboBoxMenuItemSelected"); |
| 51 |
}, |
| 52 |
|
| 53 |
onDeselect: function( node){ |
| 54 |
|
| 55 |
|
| 56 |
domClass.remove(node, "mblComboBoxMenuItemSelected"); |
| 57 |
}, |
| 58 |
|
| 59 |
onOpen: function(){ |
| 60 |
|
| 61 |
|
| 62 |
this.scrollable.init({ |
| 63 |
domNode: this.domNode, |
| 64 |
containerNode: this.containerNode |
| 65 |
}); |
| 66 |
this.scrollable.scrollTo({x:0, y:0}); |
| 67 |
}, |
| 68 |
|
| 69 |
onClose: function(){ |
| 70 |
|
| 71 |
|
| 72 |
this.scrollable.cleanup(); |
| 73 |
}, |
| 74 |
|
| 75 |
postCreate: function(){ |
| 76 |
this.inherited(arguments); |
| 77 |
this.scrollable = new Scrollable(); |
| 78 |
this.scrollable.resize = function(){}; |
| 79 |
|
| 80 |
var self = this; |
| 81 |
this.scrollable.isLeftToRight = function(){ |
| 82 |
return self.isLeftToRight(); |
| 83 |
}; |
| 84 |
} |
| 85 |
}); |
| 86 |
return has("dojo-bidi") ? declare("dojox.mobile._ComboBoxMenu", [_ComboBoxMenu, BidiComboBoxMenu]) : _ComboBoxMenu; |
| 87 |
}); |