Module: SDL::Mac

Defined in:
lib/ruby-sdl-ffi/sdl/mac.rb

Defined Under Namespace

Modules: Cocoa, HIServices, ObjC

Class Method Summary collapse

Class Method Details

.make_menus(app_name) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 53

def make_menus( app_name )
  ptr = FFI.find_type(:pointer)
  
  nsapp = Cocoa.NSApp
  menubar = Cocoa::NSMenu.new.initWithTitle("AMainMenu")
  nsapp.msg( "setMainMenu:", ptr, menubar )
  
  remove_bold_menu( nsapp, menubar )
  make_app_menu( menubar, app_name )
  make_window_menu( nsapp, menubar )

  nil
end

.set_app_name(app_name) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/ruby-sdl-ffi/sdl/mac.rb', line 68

def set_app_name( app_name )
  ptr = FFI.find_type(:pointer)
  
  if @appmenuitem
    @appmenuitem.title = app_name
    @hideitem.title = "Hide #{app_name}" if @hideitem
    @quititem.title = "Quit #{app_name}" if @quititem
  else
    make_menus( app_name )
  end
  
  nil
end