| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/> |
| 5 | <meta name="apple-mobile-web-app-capable" content="yes" /> |
| 6 | <title>TabBar</title> |
| 7 | <link href="../../../themes/iphone/iphone.css" rel="stylesheet"/> |
| 8 | <link href="../../../themes/common/domButtons/DomButtonRedBadge.css" rel="stylesheet"/> |
| 9 | <link href="../../../themes/common/domButtons/DomButtonBlueBadge.css" rel="stylesheet"/> |
| 10 | <style> |
| 11 | .label { |
| 12 | font-family: "Helvetica Neue", Helvetica; |
| 13 | font-size: 13px; |
| 14 | margin-top: 20px; |
| 15 | } |
| 16 | .view { |
| 17 | font-size: 30px; |
| 18 | margin-top: 30px; |
| 19 | text-align: center; |
| 20 | } |
| 21 | </style> |
| 22 | |
| 23 | <script type="text/javascript" src="../../../../../dojo/dojo.js" data-dojo-config="parseOnLoad: true"></script> |
| 24 | |
| 25 | <script language="JavaScript" type="text/javascript"> |
| 26 | //dojo.require("dojo.parser"); // Use the lightweight parser. |
| 27 | dojo.require("dojox.mobile.parser"); |
| 28 | dojo.require("dojox.mobile"); |
| 29 | dojo.require("dojox.mobile.TabBar"); |
| 30 | dojo.requireIf(!dojo.isWebKit, "dojox.mobile.compat"); |
| 31 | |
| 32 | dojo.require("doh.runner"); |
| 33 | dojo.addOnLoad(function(){ |
| 34 | |
| 35 | dojo.create("div", {className:"label", innerHTML:"Segmented Control"}, dojo.doc.body); |
| 36 | var tabBar = new dojox.mobile.TabBar({barType:"segmentedControl"}); |
| 37 | dojo.doc.body.appendChild(tabBar.domNode); |
| 38 | tabBar.startup(); |
| 39 | |
| 40 | var tabBarButton = new dojox.mobile.TabBarButton({moveTo:"view1", selected:"true", label:"New"}); |
| 41 | // var tabBarButton = new dojox.mobile.TabBarButton({moveTo:"view1", label:"New"}); |
| 42 | tabBar.addChild(tabBarButton); |
| 43 | //work around code |
| 44 | // tabBarButton.set("selected", true); |
| 45 | |
| 46 | tabBarButton = new dojox.mobile.TabBarButton({moveTo:"view2", label:"What's Hot"}); |
| 47 | tabBar.addChild(tabBarButton); |
| 48 | tabBarButton = new dojox.mobile.TabBarButton({moveTo:"view3", label:"Genius"}); |
| 49 | tabBar.addChild(tabBarButton); |
| 50 | tabBar.resize(); |
| 51 | |
| 52 | dojo.create("div", {className:"label", innerHTML:"Tab Bar"}, dojo.doc.body); |
| 53 | tabBar = new dojox.mobile.TabBar(); |
| 54 | tabBarButton = new dojox.mobile.TabBarButton({icon1:"../../images/tab-icon-16.png", icon2:"../../images/tab-icon-16h.png", moveTo:"view1", selected:"true", label:"New"}); |
| 55 | // tabBarButton = new dojox.mobile.TabBarButton({icon1:"../../images/tab-icon-16.png", icon2:"../../images/tab-icon-16h.png", moveTo:"view1", label:"New"}); |
| 56 | tabBar.addChild(tabBarButton); |
| 57 | //work around code |
| 58 | // tabBarButton.set("selected", true); |
| 59 | |
| 60 | tabBarButton = new dojox.mobile.TabBarButton({icon1:"../../images/tab-icon-15.png", icon2:"../../images/tab-icon-15h.png", moveTo:"view2", label:"What's Hot"}); |
| 61 | tabBar.addChild(tabBarButton); |
| 62 | tabBarButton = new dojox.mobile.TabBarButton({icon1:"../../images/tab-icon-10.png", icon2:"../../images/tab-icon-10h.png", moveTo:"view3", label:"Genius"}); |
| 63 | tabBar.addChild(tabBarButton); |
| 64 | tabBarButton = new dojox.mobile.TabBarButton({id:"tbbBadge1", icon1:"../../images/tab-icon-16.png", icon2:"../../images/tab-icon-16h.png", badge:"foo", label:"Foo"}); |
| 65 | tabBar.addChild(tabBarButton); |
| 66 | tabBarButton = new dojox.mobile.TabBarButton({id:"tbbBadge2", icon1:"../../images/tab-icon-15.png", icon2:"../../images/tab-icon-15h.png", badge:"bar", badgeClass:"mblDomButtonBlueBadge", label:"Bar"}); |
| 67 | tabBar.addChild(tabBarButton); |
| 68 | |
| 69 | dojo.doc.body.appendChild(tabBar.domNode); |
| 70 | tabBar.startup(); |
| 71 | |
| 72 | dojo.create("div", {className:"label", innerHTML:"Tab Bar (CSS Sprite)"}, dojo.doc.body); |
| 73 | tabBar = new dojox.mobile.TabBar({iconBase:"../../images/tab-icons.png"}); |
| 74 | dojo.doc.body.appendChild(tabBar.domNode); |
| 75 | // tabBar.startup(); |
| 76 | // tabBarButton = new dojox.mobile.TabBarButton({iconPos1:"0,0,29,29", iconPos2:"29,0,29,29", selected:"true", label:"Featured"}); |
| 77 | tabBarButton = new dojox.mobile.TabBarButton({iconPos1:"0,0,29,29", iconPos2:"29,0,29,29", label:"Featured"}); |
| 78 | tabBar.addChild(tabBarButton); |
| 79 | //work around code |
| 80 | tabBarButton.set("selected", true); |
| 81 | tabBarButton = new dojox.mobile.TabBarButton({iconPos1:"0,29,29,29", iconPos2:"29,29,29,29", label:"Categories"}); |
| 82 | tabBar.addChild(tabBarButton); |
| 83 | tabBarButton = new dojox.mobile.TabBarButton({iconPos1:"0,58,29,29", iconPos2:"29,58,29,29", label:"Top 25"}); |
| 84 | tabBar.addChild(tabBarButton); |
| 85 | tabBarButton = new dojox.mobile.TabBarButton({iconPos1:"0,87,29,29", iconPos2:"29,87,29,29", label:"Search"}); |
| 86 | tabBar.addChild(tabBarButton); |
| 87 | tabBarButton = new dojox.mobile.TabBarButton({iconPos1:"0,116,29,29", iconPos2:"29,116,29,29", label:"Updates"}); |
| 88 | tabBar.addChild(tabBarButton); |
| 89 | tabBar.startup(); |
| 90 | |
| 91 | dojo.create("div", {className:"label", innerHTML:"segmented control with fill = 'always'"}, dojo.doc.body); |
| 92 | tabBar = new dojox.mobile.TabBar({id: "spread-sc", barType:"segmentedControl", fill: "always"}); |
| 93 | dojo.doc.body.appendChild(tabBar.domNode); |
| 94 | for (var i=1; i <= 3; i++){ |
| 95 | tabBar.addChild(new dojox.mobile.TabBarButton({id:"spread-sc-button" + i, innerHTML:"Button"})); |
| 96 | } |
| 97 | tabBar.startup(); |
| 98 | |
| 99 | dojo.create("div", {className:"label", innerHTML:"tabBar with fill = 'always'"}, dojo.doc.body); |
| 100 | tabBar = new dojox.mobile.TabBar({id: "spread-tb", fill: "always"}); |
| 101 | dojo.doc.body.appendChild(tabBar.domNode); |
| 102 | for (var i=1; i <= 3; i++){ |
| 103 | tabBar.addChild(new dojox.mobile.TabBarButton({id:"spread-tb-button" + i, icon1:"../../images/tab-icon-16.png", icon2:"../../images/tab-icon-16h.png", moveTo:"view1", selected:"true", label:"New"})); |
| 104 | } |
| 105 | tabBar.startup(); |
| 106 | |
| 107 | dojo.create("div", {className:"label", innerHTML:"tabBar with fill = 'always' (CSS sprite)"}, dojo.doc.body); |
| 108 | tabBar = new dojox.mobile.TabBar({id: "spread-tb-css", fill: "always", iconBase:"../../images/tab-icons.png"}); |
| 109 | dojo.doc.body.appendChild(tabBar.domNode); |
| 110 | for (var i=1; i <= 5; i++){ |
| 111 | tabBar.addChild(new dojox.mobile.TabBarButton({id:"spread-tb-css-button" + i, iconPos1:"0,29,29,29", iconPos2:"29,29,29,29", label:"Categories"})); |
| 112 | } |
| 113 | tabBar.startup(); |
| 114 | |
| 115 | dojo.create("div", {className:"label", innerHTML:"slimTab with fill = 'always'"}, dojo.doc.body); |
| 116 | tabBar = new dojox.mobile.TabBar({id: "spread-st", barType:"slimTab", fill: "always"}); |
| 117 | dojo.doc.body.appendChild(tabBar.domNode); |
| 118 | for (var i=1; i <= 4; i++){ |
| 119 | tabBar.addChild(new dojox.mobile.TabBarButton({id:"spread-st-button" + i, innerHTML:"Button"})); |
| 120 | } |
| 121 | tabBar.startup(); |
| 122 | |
| 123 | dojo.create("div", {className:"label", innerHTML:"standardTab with fill = 'always'"}, dojo.doc.body); |
| 124 | tabBar = new dojox.mobile.TabBar({id: "spread-std", barType:"standardTab", fill: "always"}); |
| 125 | dojo.doc.body.appendChild(tabBar.domNode); |
| 126 | for (var i=1; i <= 4; i++){ |
| 127 | tabBar.addChild(new dojox.mobile.TabBarButton({id:"spread-std-button" + i, innerHTML:"Button"})); |
| 128 | } |
| 129 | tabBar.startup(); |
| 130 | |
| 131 | dojo.create("div", {className:"label", innerHTML:"flatTab with fill = 'always'"}, dojo.doc.body); |
| 132 | tabBar = new dojox.mobile.TabBar({id: "spread-flat", barType:"flatTab", fill: "always"}); |
| 133 | dojo.doc.body.appendChild(tabBar.domNode); |
| 134 | for (var i=1; i <= 4; i++){ |
| 135 | tabBar.addChild(new dojox.mobile.TabBarButton({id:"spread-flat-button" + i, innerHTML:"Button"})); |
| 136 | } |
| 137 | tabBar.startup(); |
| 138 | |
| 139 | dojo.create("div", {className:"label", innerHTML:"tallTab with fill = 'always'"}, dojo.doc.body); |
| 140 | tabBar = new dojox.mobile.TabBar({id: "spread-tall", barType:"tallTab", fill: "always"}); |
| 141 | dojo.doc.body.appendChild(tabBar.domNode); |
| 142 | for (var i=1; i <= 4; i++){ |
| 143 | tabBar.addChild(new dojox.mobile.TabBarButton({id:"spread-tall-button" + i, innerHTML:"Button"})); |
| 144 | } |
| 145 | tabBar.startup(); |
| 146 | |
| 147 | var view = new dojox.mobile.View({id:"view1", selected:"true", innerHTML:'<div class="view">View 1</div>'}); |
| 148 | dojo.doc.body.appendChild(view.domNode); |
| 149 | view.startup(); |
| 150 | |
| 151 | view = new dojox.mobile.View({id:"view2", innerHTML:'<div class="view">View 2</div>'}); |
| 152 | dojo.doc.body.appendChild(view.domNode); |
| 153 | view.startup(); |
| 154 | |
| 155 | view = new dojox.mobile.View({id:"view3", innerHTML:'<div class="view">View 3</div>'}); |
| 156 | dojo.doc.body.appendChild(view.domNode); |
| 157 | view.startup(); |
| 158 | }); |
| 159 | </script> |
| 160 | <script type="text/javascript" src="../TestUtil.js"></script> |
| 161 | <script type="text/javascript" src="TabBar.js"></script> |
| 162 | </head> |
| 163 | <body> |
| 164 | </body> |
| 165 | </html> |