1 // ========================================================================== 2 // Project: SproutCore - JavaScript Application Framework 3 // Copyright: ©2006-2011 Strobe Inc. and contributors. 4 // Portions ©2008-2011 Apple Inc. All rights reserved. 5 // License: Licensed under MIT license (see license.js) 6 // ========================================================================== 7 8 9 SC.THREE_SLICE = ['left', 'middle', 'right']; 10 11 SC.NINE_SLICE = [ 12 'top-left', 'top', 'top-right', 13 'left', 'middle', 'right', 14 'bottom-left', 'bottom', 'bottom-right' 15 ]; 16 17 SC.RenderDelegate.reopen({ 18 /*@scope SC.RenderDelegate.prototype*/ 19 20 /** 21 Use this to render slices that you can match in CSS. This matches with the 22 Chance @include slices directive, so that you can automatically do 23 multi-slice images for controls. 24 25 @param {SC.Object} dataSource The data source for rendering information. 26 @param {SC.RenderContext} context the render context instance 27 @param {Slice Configuration} slices Instructions on how to slice. Can be a constant 28 like SC.THREE_SLICE or SC.NINE_SLICE, or an array of slice names. 29 */ 30 includeSlices: function(dataSource, context, slices) { 31 for (var idx = 0, len = slices.length; idx < len; idx++) { 32 context.push('<div class="' + slices[idx] + '"></div>'); 33 } 34 } 35 }); 36