Sha256: e1b4127fc6a202cabf33018bd1dcdf53fbac3688f0894f7f3b8619bd6559fe49

Contents?: true

Size: 896 Bytes

Versions: 2

Compression:

Stored size: 896 Bytes

Contents

// ========================================================================
// SproutCore
// copyright 2006-2007 Sprout Systems, Inc.
// ========================================================================

// A menu is not a view exactly, but you can use it to bundle together 
// buttons and then validate them as a whole.
SC.Toolbar = SC.View.extend({
  
  // override with an array of outlet functions.
  buttons: [],
  
  // to to false an all the buttons will be disabled also.
  isEnabled: true,
  
  init: function() {
    arguments.callee.base.call(this) ;
    var toolbar = this ;
    this.buttons = this.buttons.map(function(button) {
      return button(toolbar) ; // get outlet.
    }) ;
  },
  
  isEnabledObserver: function() {
    var e = this.get('isEnabled') ;
    this.get('buttons').each(function(button) { button.set('isEnabled',e); }) ;
  }.observes('isEnabled')
  
}) ;

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sproutcore-0.9.0 frameworks/sproutcore/views/toolbar.js
sproutcore-0.9.1 frameworks/sproutcore/views/toolbar.js