Class Limelight::DSL::MenuBar
In: lib/limelight/dsl/menu_bar.rb
Parent: Object

A class used to build menu bars using a DSL. do
   menu("File") do
     item("Open", :open_chosen_scene)
     item("Refresh", :reload)

This example created one menu named ‘File’ with two menu items: ‘Open’ and ‘Refresh’. The seconds parameter of the menu items is the symbol of a method on the context that will be invoked when the menu item is selected.


build   item   menu   new  


menu_bar  [R] 

Public Class methods


    # File lib/limelight/dsl/menu_bar.rb, line 36
36:       def, &prop)
37:         builder =
38:         builder.instance_eval(&prop)
39:         return builder.menu_bar
40:       end

This builder must be provided with a context. All menu item actions will be invoked on the context.


    # File lib/limelight/dsl/menu_bar.rb, line 46
46:       def initialize(context)
47:         @context = context
48:         @menu_bar =
49:       end

Public Instance methods

Created a new menu item with the provided name. The symbols paramter is the name of a method on the context that will be invoked when the item is selected.


    # File lib/limelight/dsl/menu_bar.rb, line 62
62:       def item(name, symbol)
63:         menu_item =
64:         @menu.add(menu_item)
65:         menu_item.addActionListener(, symbol))
66:       end

Creates a new menu with the provided name


    # File lib/limelight/dsl/menu_bar.rb, line 53
53:       def menu(name)
54:         @menu =
55:         @menu_bar.add(@menu)
56:         yield
57:       end