allow string based values for comboboxarray
[roojs1] / Roo / mobile / Mobile.js
1 //<Script type="text/javascript">
2
3 /**
4  * experiments with mobile UI's
5  * 
6  * usage: - mobile is a top level widget..
7  * 
8  * x = new Roo.mobile.Mobile {
9     items : {
10         Roo.mobile.Page
11         *}
12      }
13  * 
14  */
15
16 Roo.mobile.Mobile = function(cfg) {
17      
18     this.addEvents({ 
19         'ready' : true
20     });
21     Roo.util.Observable.call(this,cfg);
22     Roo.onReady(function() {
23         this.init();
24         this.fireEvent('ready');
25     },this,false);
26     
27 }
28
29
30 Roo.extend(Roo.mobile.Mobile, Roo.util.Observable, {
31      init: function()
32     {
33         //var page = iui.getSelectedPage();
34         ///var locPage = getPageFromLoc();
35             
36         //if (page)
37         //        iui.showPage(page);
38         
39         //if (locPage && (locPage != page))
40         //    iui.showPage(locPage);
41         Roo.get(document.head).createChild(
42             '<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>'
43         );
44         //?? add the css?
45         //setTimeout(preloadImages, 0);
46         if (typeof window.onorientationchange == "object")
47         {
48             window.onorientationchange=this.orientChangeHandler;
49             hasOrientationEvent = true;
50             this.orientChangeHandler.defer(0, this);
51         }
52         this.checkOrientAndLocation.defer(0, this);
53         this.checkTimer = setInterval(checkOrientAndLocation, 300);
54     }
55     orientChangeHandler: function()
56     {
57         if (window.orientation == 90 || window.orientation = -90) {
58             this.setOrientation("landscape");
59             return;
60         }
61         this.setOrientation("portrait");
62         
63     },
64     
65     setOrientation: function (orient)
66     {
67         document.body.setAttribute("orient", orient);
68         setTimeout(scrollTo, 100, 0, 1);
69     },
70
71 });
72
73