lib/ppcurses/menu_bar.rb in ppcurses-0.1.1 vs lib/ppcurses/menu_bar.rb in ppcurses-0.1.2
- old
+ new
@@ -6,10 +6,12 @@
#
# Any responders further down the responder chain will never receive ESCAPE key events.
#
class MenuBar < Responder
+ attr_accessor :selected
+
def initialize
@menu_items = []
@selected = false
end
@@ -44,9 +46,12 @@
def add_menu_item(menu_item)
@menu_items.push(menu_item)
end
+ def remove_menu_item(menu_item)
+ @menu_items.delete(menu_item)
+ end
def key_down( key )
if key == ESCAPE
@selected = !@selected