1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
//>>built
define("dojox/mobile/_ComboBoxMenu", [
"dojo/_base/kernel",
"dojo/_base/declare",
"dojo/dom-class",
"dojo/dom-construct",
"dijit/form/_ComboBoxMenuMixin",
"dijit/_WidgetBase",
"dojox/mobile/_ListTouchMixin",
"./scrollable"
],
function(dojo, declare, domClass, domConstruct, ComboBoxMenuMixin, WidgetBase, ListTouchMixin, Scrollable){
/*=====
ComboBoxMenuMixin = dijit.form._ComboBoxMenuMixin;
WidgetBase = dijit._WidgetBase;
ListTouchMixin = dojox.mobile._ListTouchMixin;
=====*/
return declare("dojox.mobile._ComboBoxMenu", [WidgetBase, ListTouchMixin, ComboBoxMenuMixin], {
// summary:
// Focus-less menu for internal use in `dijit.form.ComboBox`
// Abstract methods that must be defined externally:
// onChange: item was explicitly chosen (mousedown somewhere on the menu and mouseup somewhere on the menu)
// onPage: next(1) or previous(-1) button pressed
// tags:
// private
baseClass: "mblComboBoxMenu",
bgIframe: true, // so it's not created for IE and FF
buildRendering: function(){
this.domNode = this.focusNode = domConstruct.create("div", { "class":"mblReset" });
this.containerNode = domConstruct.create("div", { style: { position:"absolute", top:0, left:0 } }, this.domNode); // needed for scrollable
this.previousButton = domConstruct.create("div", { "class":"mblReset mblComboBoxMenuItem mblComboBoxMenuPreviousButton", role:"option" }, this.containerNode);
this.nextButton = domConstruct.create("div", { "class":"mblReset mblComboBoxMenuItem mblComboBoxMenuNextButton", role:"option" }, this.containerNode);
this.inherited(arguments);
},
_createMenuItem: function(){
return domConstruct.create("div", {
"class": "mblReset mblComboBoxMenuItem" +(this.isLeftToRight() ? "" : " mblComboBoxMenuItemRtl"),
role: "option"
});
},
onSelect: function(/*DomNode*/ node){
// summary:
// Add selected CSS
domClass.add(node, "mblComboBoxMenuItemSelected");
},
onDeselect: function(/*DomNode*/ node){
// summary:
// Remove selected CSS
domClass.remove(node, "mblComboBoxMenuItemSelected");
},
onOpen: function(){
this.scrollable.init({
domNode: this.domNode,
containerNode: this.containerNode
});
this.scrollable.scrollTo({x:0, y:0});
},
onClose: function(){
this.scrollable.cleanup();
},
destroyRendering: function(){
this.bgIframe = false; // no iframe to destroy
this.inherited(arguments);
},
postCreate: function(){
this.inherited(arguments);
this.scrollable = new Scrollable(dojo, dojox);
this.scrollable.resize = function(){}; // resize changes the height rudely
this.scrollable.androidWorkaroud = false; // disable Android workaround
}
});
});
|