Sha256: 87599c5b4a323abd54d560bf1a24ac24d13ada3421d4eb5401bf9982cc0aa47c
Contents?: true
Size: 1.55 KB
Versions: 8
Compression:
Stored size: 1.55 KB
Contents
/** @class @extends SC.ButtonView @author Santosh Shanbhogue @copyright 2008-2009, Sprout Systems, Inc. and contributors. @version 1.0 */ sc_require('views/button'); SC.PopupButtonView = SC.ButtonView.extend({ /** This property shows whether the menu is currently displayed or not */ keyEquivalent: null, classNames: ['sc-popup-button'], /**private */ acceptsFirstResponder: YES, /** Overriding the default SC.ButtonView#performKeyEquivalent method to pass it onto the menu @param {string} keystring method name corresponding to the keys pressed (i.e alt_shift_z) @param {DOMMouseEvent} evt mousedown event */ isSelected: NO, performKeyEquivalent: function( charCode, evt ) { if (!this.get('isEnabled')) return NO ; var menu = this.get('menu') ; return (!!menu && menu.performKeyEquivalent(charCode, evt)) ; }, /** Menu attached to the popupButton @default SC.MenuView */ menu : null, /** Binds the button's selection state to the menu's visibility. @private */ isSelectedBinding: '*menu.isVisibleInWindow', /**private*/ render: function(context,firstTime) { sc_super() ; var menu = this.get('menu') ; if(firstTime && menu) { menu.createLayer() ; } }, /** Button action handler @param {DOMMouseEvent} evt mouseup event that triggered the action */ action: function( evt ) { var menu = this.get('menu') ; // no menu to toggle... bail... if (!menu) return NO ; menu.popup(this) ; return YES; } });
Version data entries
8 entries across 8 versions & 1 rubygems