1 // ========================================================================== 2 // Project: SproutCore - JavaScript Application Framework 3 // Copyright: ©2006-2011 Strobe Inc. and contributors. 4 // ©2008-2011 Apple Inc. All rights reserved. 5 // License: Licensed under MIT license (see license.js) 6 // ========================================================================== 7 8 /** @class 9 10 SC.TemplatePane is a helper that will create a new pane based on 11 a single root TemplateView. 12 13 function main() { 14 MyApp.mainPane = SC.TemplatePane.append({ 15 layerId: 'my-root-id', 16 templateName: 'app' 17 }) 18 } 19 20 @extends SC.Object 21 @since SproutCore 1.5 22 */ 23 SC.TemplatePane = SC.Object.extend({}); 24 25 SC.TemplatePane.mixin( /** @scope SC.TemplatePane */ { 26 27 /** 28 Creates a new pane with a single TemplateView. 29 30 @param {Object} attrs describes the pane to create 31 @returns {SC.MainPane} the created pane 32 */ 33 append: function(attrs) { 34 var pane = SC.MainPane.extend({ 35 childViews: ['contentView'], 36 37 contentView: SC.TemplateView.design(attrs), 38 39 touchStart: function(touch) { 40 touch.allowDefault(); 41 }, 42 43 touchesDragged: function(evt, touches) { 44 evt.allowDefault(); 45 }, 46 47 touchEnd: function(touch) { 48 touch.allowDefault(); 49 } 50 }); 51 52 pane = pane.create().append(); 53 54 return pane; 55 } 56 }); 57