RoundRectList.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. define("dojox/mobile/RoundRectList", [
  2. "dojo/_base/array",
  3. "dojo/_base/declare",
  4. "dojo/_base/window",
  5. "dijit/_Contained",
  6. "dijit/_Container",
  7. "dijit/_WidgetBase"
  8. ], function(array, declare, win, Contained, Container, WidgetBase){
  9. /*=====
  10. var Contained = dijit._Contained;
  11. var Container = dijit._Container;
  12. var WidgetBase = dijit._WidgetBase;
  13. =====*/
  14. // module:
  15. // dojox/mobile/RoundRectList
  16. // summary:
  17. // A rounded rectangle list.
  18. return declare("dojox.mobile.RoundRectList", [WidgetBase, Container, Contained], {
  19. // summary:
  20. // A rounded rectangle list.
  21. // description:
  22. // RoundRectList is a rounded rectangle list, which can be used to
  23. // display a group of items. Each item must be
  24. // dojox.mobile.ListItem.
  25. // transition: String
  26. // The default animated transition effect for child items.
  27. transition: "slide",
  28. // iconBase: String
  29. // The default icon path for child items.
  30. iconBase: "",
  31. // iconPos: String
  32. // The default icon position for child items.
  33. iconPos: "",
  34. // select: String
  35. // Selection mode of the list. The check mark is shown for the
  36. // selected list item(s). The value can be "single", "multiple", or
  37. // "". If "single", there can be only one selected item at a time.
  38. // If "multiple", there can be multiple selected items at a time.
  39. select: "",
  40. // stateful: String
  41. // If true, the last selected item remains highlighted.
  42. stateful: false,
  43. buildRendering: function(){
  44. this.domNode = this.containerNode = this.srcNodeRef || win.doc.createElement("UL");
  45. this.domNode.className = "mblRoundRectList";
  46. },
  47. resize: function(){
  48. // summary:
  49. // Calls resize() of each child widget.
  50. array.forEach(this.getChildren(), function(child){
  51. if(child.resize){ child.resize(); }
  52. });
  53. },
  54. onCheckStateChanged: function(/*Widget*/listItem, /*String*/newState){
  55. // summary:
  56. // Stub function to connect to from your application.
  57. // description:
  58. // Called when the check state has been changed.
  59. },
  60. _setStatefulAttr: function(stateful){
  61. this.stateful = stateful;
  62. array.forEach(this.getChildren(), function(child){
  63. child.setArrow && child.setArrow();
  64. });
  65. },
  66. deselectItem: function(/*ListItem*/item){
  67. // summary:
  68. // Deselects the given item.
  69. item.deselect();
  70. },
  71. deselectAll: function(){
  72. // summary:
  73. // Deselects all the items.
  74. array.forEach(this.getChildren(), function(child){
  75. child.deselect && child.deselect();
  76. });
  77. },
  78. selectItem: function(/*ListItem*/item){
  79. // summary:
  80. // Selects the given item.
  81. item.select();
  82. }
  83. });
  84. });