Sha256: 3ed8d9761dd7e29976e489bebe3da39d577c41ca361c1a6d20a9023fb9e54ded
Contents?: true
Size: 854 Bytes
Versions: 1
Compression:
Stored size: 854 Bytes
Contents
# -*- encoding : utf-8 -*- module PPCurses PP_MIXED_STATE = -1 PP_OFF_STATE = 0 PP_ON_STATE = 1 SELECTED_CHAR = '✓' class MenuItem attr_accessor :title attr_accessor :action attr_accessor :state attr_accessor :selectable def initialize( title ) @title = title @state = PP_OFF_STATE @selectable = false end def display_string if @state == PP_OFF_STATE return ' ' + @title end SELECTED_CHAR + ' ' + @title end def toggle_on_off_state if @state == PP_OFF_STATE @state = PP_ON_STATE return end if @state == PP_ON_STATE @state = PP_OFF_STATE end end def handle_key(key) if key == ' ' and @selectable toggle_on_off_state return true end false end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ppcurses-0.0.22 | lib/ppcurses/menu/menu_item.rb |