1 // ========================================================================== 2 // Project: The M-Project - Mobile HTML5 Application Framework 3 // Copyright: (c) 2010 M-Way Solutions GmbH. All rights reserved. 4 // Creator: Sebastian 5 // Date: 02.11.2010 6 // License: Dual licensed under the MIT or GPL Version 2 licenses. 7 // http://github.com/mwaylabs/The-M-Project/blob/master/MIT-LICENSE 8 // http://github.com/mwaylabs/The-M-Project/blob/master/GPL-LICENSE 9 // ========================================================================== 10 11 /** 12 * @class 13 * 14 * The defines the prototype of a scrollable content view. It should be used as a wrapper 15 * for any content that isn't part of a header or footer toolbar / tabbar. 16 * 17 * @extends M.View 18 */ 19 M.ScrollView = M.View.extend( 20 /** @scope M.ScrollView.prototype */ { 21 22 /** 23 * The type of this object. 24 * 25 * @type String 26 */ 27 type: 'M.ScrollView', 28 29 /** 30 * Renders in three steps: 31 * 1. Rendering Opening div tag with corresponding data-role 32 * 2. Triggering render process of child views 33 * 3. Rendering closing tag 34 * 35 * @private 36 * @returns {String} The scroll view's html representation. 37 */ 38 render: function() { 39 this.html += '<div id="' + this.id + '" data-role="content">'; 40 41 this.renderChildViews(); 42 43 this.html += '</div>'; 44 45 return this.html; 46 }, 47 48 /** 49 * Triggers the rendering engine, jQuery mobile, to style the scroll view and call the 50 * theme() of its child views. 51 * 52 * @private 53 */ 54 theme: function() { 55 $('#' + this.id).page(); 56 this.themeChildViews(); 57 } 58 59 });