// ========================================================================== // Project: SproutCore - JavaScript Application Framework // Copyright: ©2006-2011 Strobe Inc. and contributors. // Portions ©2008-2011 Apple Inc. All rights reserved. // License: Licensed under MIT license (see license.js) // ========================================================================== sc_require("theme"); /** Renders and updates the HTML representation of a button. */ SC.LegacyTheme.buttonRenderDelegate = SC.RenderDelegate.create({ name: 'button', /** Called when we need to create the HTML that represents the button. @param {SC.Object} dataSource the object containing the information on how to render the button @param {SC.RenderContext} context the render context instance */ render: function(dataSource, context) { this.addSizeClassName(dataSource, context); var theme = dataSource.get('theme'), minWidth = dataSource.get('titleMinWidth'), toolTip = dataSource.get('toolTip'), isSelected = dataSource.get('isSelected'), isActive = dataSource.get('isActive'); var labelContent; context.setClass('icon', !!dataSource.get('icon') || 0); context.setClass('def', dataSource.get('isDefault') || 0); context.setClass('cancel', dataSource.get('isCancel') || 0); if (toolTip) { context.attr('title', toolTip); context.attr('alt', toolTip); } // addressing accessibility context.attr('aria-pressed', isActive); // Specify a minimum width for the inner part of the button. minWidth = (minWidth ? "style='min-width: " + minWidth + "px'" : ''); context = context.push("
"); if (dataSource.get('supportFocusRing')) { context.push('