Class: NSToolbarItem

Inherits:
Object
  • Object
show all
Defined in:
lib/bean/nstoolbaritem_additions.rb

Overview

Extensions to the NSToolbarItem class

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.performAction(sender) ⇒ Object



12
# File 'lib/bean/nstoolbaritem_additions.rb', line 12

def self.performAction(sender); @on_action.call(sender); end

Instance Method Details

#on_click(&blk) ⇒ Nil

Shortcut for adding an on click handler to the toolbar item.

The provided block will be provided the sender when executed.

Parameters:

  • blk (Proc)

    The block to execute on click

Returns:

  • (Nil)


10
11
12
13
14
15
# File 'lib/bean/nstoolbaritem_additions.rb', line 10

def on_click(&blk)
  @on_action = blk
  def self.performAction(sender); @on_action.call(sender); end
  setAction("performAction:")
  setTarget(self)
end