lib/ppcurses/menu/Menu.rb in ppcurses-0.0.25 vs lib/ppcurses/menu/Menu.rb in ppcurses-0.1.0

- old
+ new

@@ -1,33 +1,30 @@ -# Curses reference: -# http://www.ruby-doc.org/stdlib-1.9.3/libdoc/curses/rdoc/Curses.html - -require_relative 'BaseMenu.rb' -require 'curses' - module PPCurses #noinspection RubyResolve class Menu < BaseMenu + attr_accessor :selection + def show @win.box(self.side_wall_char, self.top_bot_wall_char) y = 2 x = 2 (0...@menu_items.length).each { |i| @win.setpos(y, x) - @win.attron(A_REVERSE) if @selection == i + @win.attron(Curses::A_REVERSE) if @selection == i @win.addstr(@menu_items[i].display_string) - @win.attroff(A_REVERSE) if @selection == i + @win.attroff(Curses::A_REVERSE) if @selection == i y += 1 } @win.refresh @sub_menu.show if @sub_menu end def set_global_action(action) + PPCurses.implements_protocol(action, %w(execute)) @global_action = action end def menu_selection