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

32 lines
588 B
Ruby
Raw Normal View History

2017-07-21 10:43:08 -04:00
# frozen_string_literal: true
module Widgets
2017-07-22 04:30:26 -04:00
class Peers < VPanel
2017-07-21 10:43:08 -04:00
def initialize(x, y, width, height)
2017-07-22 04:30:26 -04:00
super
2017-07-21 13:36:20 -04:00
@list = List.new x, y + 1, width, height - 1
2017-07-21 14:22:36 -04:00
@search = Search.new x, y, width, 1
2017-07-21 10:43:08 -04:00
end
2017-07-22 04:30:26 -04:00
def children
[@list, @search]
2017-07-21 10:43:08 -04:00
end
2017-07-21 13:03:06 -04:00
def trigger(event)
case event
2017-07-21 13:07:43 -04:00
when Events::Panel::Base
2017-07-21 13:03:06 -04:00
@list.trigger event
2017-07-21 13:07:43 -04:00
when Events::Text::Base
2017-07-21 13:03:06 -04:00
@search.trigger event
end
2017-07-21 10:43:08 -04:00
end
2017-07-21 13:36:20 -04:00
def focused=(value)
@focused = !!value
@list.focused = focused
@search.focused = focused
end
2017-07-21 10:43:08 -04:00
end
end