Class: SDL::Mac::Cocoa::NSMenu
Instance Method Summary
collapse
#inspect, nsclassname, #nsclassname, #release
Constructor Details
#initialize(*args) ⇒ NSMenu
Returns a new instance of NSMenu.
287
288
289
290
291
292
293
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 287
def initialize( *args )
if args.empty?
super( ObjC::NSClass("NSMenu").msg_ptr("alloc") )
else
super( args[0] )
end
end
|
Instance Method Details
#[](index) ⇒ Object
337
338
339
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 337
def [](index)
Cocoa::NSMenuItem( msg_ptr("itemAtIndex:", FFI.find_type(:long), index) )
end
|
#addItem(item) ⇒ Object
308
309
310
311
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 308
def addItem( item )
msg("addItem:", FFI.find_type(:pointer), item)
self
end
|
#addItemWithTitle(title, action = nil, keyEquivalent = "") ⇒ Object
313
314
315
316
317
318
319
320
321
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 313
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
341
342
343
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 341
def each
length.times{ |i| yield self[i] }
end
|
#initWithTitle(title) ⇒ Object
295
296
297
298
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 295
def initWithTitle( title )
msg( "initWithTitle:", FFI.find_type(:pointer), ObjC::NSString(title) )
self
end
|
#length ⇒ Object
333
334
335
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 333
def length
msg_int( "numberOfItems" )
end
|
#removeItem(item) ⇒ Object
323
324
325
326
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 323
def removeItem( item )
msg("removeItem:", FFI.find_type(:pointer), item)
self
end
|
#removeItemAtIndex(index) ⇒ Object
328
329
330
331
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 328
def removeItemAtIndex( index )
msg("removeItemAtIndex:", FFI.find_type(:long), index)
self
end
|
#title ⇒ Object
300
301
302
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 300
def title
msg_str("title")
end
|
#title=(t) ⇒ Object
304
305
306
|
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 304
def title=( t )
msg("setTitle:", FFI.find_type(:pointer), ObjC::NSString(t))
end
|