Archived
1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
cli-old/lib/widgets/menu.rb

30 lines
515 B
Ruby
Raw Normal View History

2017-07-21 11:00:11 -04:00
# frozen_string_literal: true
module Widgets
class Menu
ITEMS = [
'Foo menu item',
'Bar Car menu item',
'Hello, World!',
]
attr_reader :x, :y, :width, :height
def initialize(x, y, width, height)
@x = x
@y = y
@width = width
@height = height
end
def render
ITEMS.each_with_index do |item, index|
Curses.attron Curses.color_pair 5
2017-07-21 11:01:25 -04:00
Curses.setpos 2 + y + index * 4, 2
2017-07-21 11:00:11 -04:00
Curses.addstr item
end
end
end
end