Class: SDL::Mac::Cocoa::NSMenuItem

Inherits:
ObjC::NSObject
  • Object
show all
Defined in:
lib/ruby-sdl-ffi/sdl/mac.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ObjC::NSObject

#inspect, nsclassname, #nsclassname, #release

Constructor Details

#initialize(*args) ⇒ NSMenuItem

Returns a new instance of NSMenuItem.



356
357
358
359
360
361
362
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 356

def initialize( *args )
  if args.empty?
    super( ObjC::NSClass("NSMenuItem").msg_ptr("alloc") )
  else
    super( args[0] )
  end
end

Class Method Details

.separatorItemObject



352
353
354
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 352

def self.separatorItem
  new( msg_ptr("separatorItem") )
end

Instance Method Details

#hasSubmenu?Boolean

Returns:

  • (Boolean)


382
383
384
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 382

def hasSubmenu?
  msg_bool("hasSubmenu")
end

#initWithTitle(title, action = nil, keyEquivalent = "") ⇒ Object



364
365
366
367
368
369
370
371
372
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 364

def initWithTitle( title, action=nil, keyEquivalent="" )
  ptr = FFI.find_type(:pointer)
  action = ObjC.sel(action) if action.is_a? String
  msg( "initWithTitle:action:keyEquivalent:",
       ptr, ObjC::NSString(title),
       ptr, action,
       ptr, ObjC::NSString(keyEquivalent))
  self
end


386
387
388
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 386

def submenu
  Cocoa::NSMenu( msg_ptr("submenu") ) if hasSubmenu?
end


390
391
392
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 390

def submenu=( menu )
  msg("setSubmenu:", FFI.find_type(:pointer), menu)
end

#titleObject



374
375
376
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 374

def title
  msg_str("title")
end

#title=(t) ⇒ Object



378
379
380
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 378

def title=( t )
  msg("setTitle:", FFI.find_type(:pointer), ObjC::NSString(t))
end