1 | define([ |
---|
2 | "dojo/_base/declare", |
---|
3 | "dojo/_base/array", |
---|
4 | "dojo/dom-construct", |
---|
5 | "./_PickerBase", |
---|
6 | "./SpinWheelSlot" // to load SpinWheelSlot for you (no direct references) |
---|
7 | ], function(declare, array, domConstruct, PickerBase){ |
---|
8 | |
---|
9 | // module: |
---|
10 | // dojox/mobile/SpinWheel |
---|
11 | |
---|
12 | return declare("dojox.mobile.SpinWheel", PickerBase, { |
---|
13 | // summary: |
---|
14 | // A value picker widget that has spin wheels. |
---|
15 | // description: |
---|
16 | // SpinWheel is a value picker component. It is a sectioned wheel |
---|
17 | // that can be used to pick up some values from the wheel slots by |
---|
18 | // spinning them. |
---|
19 | |
---|
20 | /* internal properties */ |
---|
21 | baseClass: "mblSpinWheel", |
---|
22 | |
---|
23 | buildRendering: function(){ |
---|
24 | this.inherited(arguments); |
---|
25 | domConstruct.create("div", {className: "mblSpinWheelBar"}, this.domNode); |
---|
26 | }, |
---|
27 | |
---|
28 | startup: function(){ |
---|
29 | if(this._started){ return; } |
---|
30 | this.centerPos = Math.round(this.domNode.offsetHeight / 2); |
---|
31 | this.inherited(arguments); |
---|
32 | }, |
---|
33 | |
---|
34 | resize: function() { |
---|
35 | this.centerPos = Math.round(this.domNode.offsetHeight / 2); |
---|
36 | array.forEach(this.getChildren(), function(child){ |
---|
37 | child.resize && child.resize(); |
---|
38 | }); |
---|
39 | }, |
---|
40 | |
---|
41 | addChild: function(/*Widget*/ widget, /*int?*/ insertIndex){ |
---|
42 | this.inherited(arguments); |
---|
43 | if(this._started){ |
---|
44 | widget.setInitialValue(); |
---|
45 | } |
---|
46 | } |
---|
47 | }); |
---|
48 | }); |
---|