Sha256: 95d85a5761e1a3f2db80bd05974b3acdee935dd0d6468e7ccb7816f8fc4f964e

Contents?: true

Size: 1.08 KB

Versions: 21

Compression:

Stored size: 1.08 KB

Contents

# @requires MotionKit::NSMenuLayout
module MotionKit
  class NSMenuLayout

    ##|
    ##|  These methods are meant to be called on the parent menu item, but
    ##|  there's no way to reference an NSMenu's parent *item* (only its parent
    ##|  *menu*).  So the @menu_item is stored in an ivar before the menu block
    ##|  is created, and these methods access that menu item.
    ##|

    # sets the title of the current NSMenu AND it's parent NSMenuItem
    def title(value)
      target.title = value
      @menu_item.title = value
    end

    def attributedTitle(value)
      target.title = value.to_s
      @menu_item.attributedTitle = value
    end

    def attributed_title(value)
      target.title = value.to_s
      @menu_item.attributedTitle = value
    end

    def state(value)
      @menu_item.state = value
    end

    def tag(value)
      @menu_item.tag = value
    end

    def keyEquivalentModifierMask(value)
      @menu_item.keyEquivalentModifierMask = value
    end

    def key_equivalent_modifier_mask(value)
      @menu_item.keyEquivalentModifierMask = value
    end

  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
motion-kit-0.11.2 lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb
motion-kit-0.11.1 lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb
motion-kit-0.11.0 lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb
motion-kit-0.10.11 lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb
motion-kit-0.10.10 lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb
motion-kit-0.10.9 lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb
motion-kit-0.10.8 lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb
motion-kit-0.10.7 lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb
motion-kit-0.10.6 lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb
motion-kit-0.10.5 lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb
motion-kit-0.10.4 lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb
motion-kit-0.10.3 lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb
motion-kit-0.10.2 lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb
motion-kit-0.10.1 lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb
motion-kit-0.10.0 lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb
motion-kit-0.9.6 lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb
motion-kit-0.9.4 lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb
motion-kit-0.9.3 lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb
motion-kit-0.9.2 lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb
motion-kit-0.9.1 lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb