Debian Codegraph @

dojox/mobile/_ComboBoxMenu.js

raw symbols SCIP
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 // module:
15 // dojox/mobile/_ComboBoxMenu
16
17 var _ComboBoxMenu = declare(has("dojo-bidi") ? "dojox.mobile._NonBidiComboBoxMenu" : "dojox.mobile._ComboBoxMenu", [WidgetBase, ListTouchMixin, ComboBoxMenuMixin], {
18 // summary:
19 // Focus-less menu for internal use in dojox/mobile/ComboBox.
20 // Abstract methods that must be defined externally:
21 //
22 // - onChange: item was explicitly chosen (mousedown somewhere on the menu and mouseup somewhere on the menu);
23 // - onPage: next(1) or previous(-1) button pressed.
24 // tags:
25 // private
26
27 // baseClass: String
28 // The name of the CSS class of this widget.
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); // needed for scrollable
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 // override of the method from dijit/form/_ComboBoxMenu.
41 return domConstruct.create("div", {
42 "class": "mblReset mblComboBoxMenuItem" +(this.isLeftToRight() ? "" : " mblComboBoxMenuItemRtl"),
43 role: "option"
44 });
45 },
46
47 onSelect: function(/*DomNode*/ node){
48 // summary:
49 // Add selected CSS.
50 domClass.add(node, "mblComboBoxMenuItemSelected");
51 },
52
53 onDeselect: function(/*DomNode*/ node){
54 // summary:
55 // Remove selected CSS.
56 domClass.remove(node, "mblComboBoxMenuItemSelected");
57 },
58
59 onOpen: function(){
60 // summary:
61 // Called when the menu opens.
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 // summary:
71 // Called when the menu closes.
72 this.scrollable.cleanup();
73 },
74
75 postCreate: function(){
76 this.inherited(arguments);
77 this.scrollable = new Scrollable();
78 this.scrollable.resize = function(){}; // resize changes the height rudely
79 // #18000
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 });