//>>built define("dojox/mobile/_ScrollableMixin", [ "dojo/_base/kernel", "dojo/_base/declare", "dojo/_base/lang", "dojo/_base/window", "dojo/dom", "dojo/dom-class", "dijit/registry", // registry.byNode "./scrollable" ], function(dojo, declare, lang, win, dom, domClass, registry, Scrollable){ // module: // dojox/mobile/_ScrollableMixin // summary: // Mixin for widgets to have a touch scrolling capability. var cls = declare("dojox.mobile._ScrollableMixin", null, { // summary: // Mixin for widgets to have a touch scrolling capability. // description: // Actual implementation is in scrollable.js. // scrollable.js is not a dojo class, but just a collection // of functions. This module makes scrollable.js a dojo class. // fixedHeader: String // Id of the fixed header. fixedHeader: "", // fixedFooter: String // Id of the fixed footer. fixedFooter: "", // scrollableParams: Object // Parameters for dojox.mobile.scrollable.init(). scrollableParams: null, // allowNestedScrolls: Boolean // e.g. Allow ScrollableView in a SwapView. allowNestedScrolls: true, constructor: function(){ this.scrollableParams = {}; }, destroy: function(){ this.cleanup(); this.inherited(arguments); }, startup: function(){ if(this._started){ return; } var node; var params = this.scrollableParams; if(this.fixedHeader){ node = dom.byId(this.fixedHeader); if(node.parentNode == this.domNode){ // local footer this.isLocalHeader = true; } params.fixedHeaderHeight = node.offsetHeight; } if(this.fixedFooter){ node = dom.byId(this.fixedFooter); if(node.parentNode == this.domNode){ // local footer this.isLocalFooter = true; node.style.bottom = "0px"; } params.fixedFooterHeight = node.offsetHeight; } this.init(params); if(this.allowNestedScrolls){ for(var p = this.getParent(); p; p = p.getParent()){ if(p && p.scrollableParams){ this.isNested = true; this.dirLock = true; p.dirLock = true; break; } } } this.inherited(arguments); }, findAppBars: function(){ // summary: // Search for application-specific header or footer. var i, len, c; for(i = 0, len = win.body().childNodes.length; i < len; i++){ c = win.body().childNodes[i]; this.checkFixedBar(c, false); } if(this.domNode.parentNode){ for(i = 0, len = this.domNode.parentNode.childNodes.length; i < len; i++){ c = this.domNode.parentNode.childNodes[i]; this.checkFixedBar(c, false); } } this.fixedFooterHeight = this.fixedFooter ? this.fixedFooter.offsetHeight : 0; }, checkFixedBar: function(/*DomNode*/node, /*Boolean*/local){ // summary: // Checks if the given node is a fixed bar or not. if(node.nodeType === 1){ var fixed = node.getAttribute("fixed") || (registry.byNode(node) && registry.byNode(node).fixed); if(fixed === "top"){ domClass.add(node, "mblFixedHeaderBar"); if(local){ node.style.top = "0px"; this.fixedHeader = node; } return fixed; }else if(fixed === "bottom"){ domClass.add(node, "mblFixedBottomBar"); this.fixedFooter = node; return fixed; } } return null; } }); lang.extend(cls, new Scrollable(dojo, dojox)); return cls; });