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 sc_require('render_delegates/picker'); 9 10 // This is the same as a pickerRenderDelegate, but is named 'menu' instead. 11 SC.BaseTheme.menuRenderDelegate = SC.BaseTheme.pickerRenderDelegate.create({ 12 className: 'menu', 13 14 render: function(orig, dataSource, context) { 15 this.addSizeClassName(dataSource, context); 16 orig(dataSource, context); 17 }.enhance(), 18 19 update: function(orig, dataSource, jquery) { 20 this.updateSizeClassName(dataSource, jquery); 21 orig(dataSource, jquery); 22 }.enhance(), 23 24 // height for items in this menu size 25 itemHeight: 20, 26 27 // height of separator items 28 itemSeparatorHeight: 9, 29 30 // amount to add to the calculated menu height 31 menuHeightPadding: 6, 32 33 // amount to add to any calculated menu width to determine the actual width 34 menuWidthPadding: 50, 35 36 minimumMenuWidth: 50, 37 38 submenuOffsetX: 2, 39 verticalOffset: 23, 40 41 'sc-tiny-size': { 42 itemHeight: 10, 43 itemSeparatorHeight: 2, 44 menuHeightPadding: 2, 45 submenuOffsetX: 0 46 }, 47 48 'sc-small-size': { 49 itemHeight: 16, 50 itemSeparatorHeight: 7, 51 menuHeightPadding: 4, 52 submenuOffsetX: 2 53 }, 54 55 'sc-large-size': { 56 itemHeight: 60, 57 itemSeparatorHeight: 20, 58 menuHeightPadding: 0, 59 submenuOffsetX: 4 60 }, 61 62 // pretty sure these sizes are wrong, but I copied them from their original 63 // values so... please fix. 64 'sc-huge-size': { 65 itemHeight: 20, 66 itemSeparatorHeight: 9, 67 menuHeightPadding: 0, 68 submenuOffsetX: 0 69 } 70 }); 71