/src/js/dev/dojox/mobile/SpinWheel.js

http://queued.googlecode.com/ · JavaScript · 48 lines · 32 code · 7 blank · 9 comment · 3 complexity · 426fd016ea6181782d1025cf67673dc1 MD5 · raw file

  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. // module:
  9. // dojox/mobile/SpinWheel
  10. return declare("dojox.mobile.SpinWheel", PickerBase, {
  11. // summary:
  12. // A value picker widget that has spin wheels.
  13. // description:
  14. // SpinWheel is a value picker component. It is a sectioned wheel
  15. // that can be used to pick up some values from the wheel slots by
  16. // spinning them.
  17. /* internal properties */
  18. baseClass: "mblSpinWheel",
  19. buildRendering: function(){
  20. this.inherited(arguments);
  21. domConstruct.create("div", {className: "mblSpinWheelBar"}, this.domNode);
  22. },
  23. startup: function(){
  24. if(this._started){ return; }
  25. this.centerPos = Math.round(this.domNode.offsetHeight / 2);
  26. this.inherited(arguments);
  27. },
  28. resize: function() {
  29. this.centerPos = Math.round(this.domNode.offsetHeight / 2);
  30. array.forEach(this.getChildren(), function(child){
  31. child.resize && child.resize();
  32. });
  33. },
  34. addChild: function(/*Widget*/ widget, /*int?*/ insertIndex){
  35. this.inherited(arguments);
  36. if(this._started){
  37. widget.setInitialValue();
  38. }
  39. }
  40. });
  41. });