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/peers.rb
2017-07-21 17:03:06 +00:00

30 lines
691 B
Ruby

# frozen_string_literal: true
module Widgets
class Peers
def initialize(x, y, width, height)
@search = Widgets::Search.new x, y, width, 1
@list = Widgets::List.new x, y + 1, width, height - 1
end
def render
@search.render
@list.render
end
def trigger(event)
case event
when Events::Panel::Up, Events::Panel::Down
@list.trigger event
when Events::Text::Putc,
Events::Text::Left,
Events::Text::Right,
Events::Text::Home,
Events::Text::End,
Events::Text::Backspace,
Events::Text::Delete
@search.trigger event
end
end
end
end