Module: MenuEnumerable

Includes:
Enumerable
Defined in:
lib/xrc_pepper.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



77
78
79
# File 'lib/xrc_pepper.rb', line 77

def method_missing(name, *args)
  find_item_by_name(name.to_s) || super
end

Instance Method Details

#eachObject



64
65
66
67
68
69
70
# File 'lib/xrc_pepper.rb', line 64

def each
  index = 0
  while index < get_menu_item_count
    yield find_item_by_position(index)
    index += 1
  end
end

#find_item_by_name(name) ⇒ Object



72
73
74
75
# File 'lib/xrc_pepper.rb', line 72

def find_item_by_name(name)
  item = find_item(Wx::xrcid(name.to_s))
  item == Wx::NOT_FOUND ? nil : item
end