Class: Swing::MenuBar
- Inherits:
-
Object
- Object
- Swing::MenuBar
- Includes:
- AttrSetter
- Defined in:
- lib/swing/old/menu_bar.rb
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ MenuBar
constructor
A new instance of MenuBar.
Methods included from AttrSetter
dim_proc, included, #set_attributes
Constructor Details
#initialize(opts = {}) ⇒ MenuBar
Returns a new instance of MenuBar.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/swing/old/menu_bar.rb', line 10 def initialize opts = {} set_attributes(opts) { super() } if opts[:structure] [opts[:structure]].flatten.each do |element| case element when Hash # Hash defines menu structure element.each do |, | = Menu.new .to_s, :parent => self .each do |item_name, item_action| MenuItem.new item_name.to_s, :parent => , &item_action end end else self.add element end end end end |