Class: SDL::Mac::Cocoa::NSMenu
Instance Method Summary
collapse
#inspect, nsclassname, #nsclassname, #release
Constructor Details
#initialize(*args) ⇒ NSMenu
Returns a new instance of NSMenu.
281
282
283
284
285
286
287
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 281
def initialize( *args )
if args.empty?
super( ObjC::NSClass("NSMenu").msg_ptr("alloc") )
else
super( args[0] )
end
end
|
Instance Method Details
#[](index) ⇒ Object
331
332
333
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 331
def [](index)
Cocoa::NSMenuItem( msg_ptr("itemAtIndex:", FFI.find_type(:long), index) )
end
|
#addItem(item) ⇒ Object
302
303
304
305
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 302
def addItem( item )
msg("addItem:", FFI.find_type(:pointer), item)
self
end
|
#addItemWithTitle(title, action = nil, keyEquivalent = "") ⇒ Object
307
308
309
310
311
312
313
314
315
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 307
def addItemWithTitle( title, action=nil, keyEquivalent="" )
ptr = FFI.find_type(:pointer)
action = ObjC.sel(action) if action.is_a? String
item = msg_ptr( "addItemWithTitle:action:keyEquivalent:",
ptr, ObjC::NSString(title),
ptr, action,
ptr, ObjC::NSString(keyEquivalent))
NSMenuItem.new(item)
end
|
#each ⇒ Object
335
336
337
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 335
def each
length.times{ |i| yield self[i] }
end
|
#initWithTitle(title) ⇒ Object
289
290
291
292
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 289
def initWithTitle( title )
msg( "initWithTitle:", FFI.find_type(:pointer), ObjC::NSString(title) )
self
end
|
#length ⇒ Object
327
328
329
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 327
def length
msg_int( "numberOfItems" )
end
|
#removeItem(item) ⇒ Object
317
318
319
320
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 317
def removeItem( item )
msg("removeItem:", FFI.find_type(:pointer), item)
self
end
|
#removeItemAtIndex(index) ⇒ Object
322
323
324
325
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 322
def removeItemAtIndex( index )
msg("removeItemAtIndex:", FFI.find_type(:long), index)
self
end
|
#title ⇒ Object
294
295
296
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 294
def title
msg_str("title")
end
|
#title=(t) ⇒ Object
298
299
300
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 298
def title=( t )
msg("setTitle:", FFI.find_type(:pointer), ObjC::NSString(t))
end
|