# frozen_string_literal: true
module Widgets
class Messenger < Container
def initialize(x, y, width, height)
super
peers_width = width / 4
chat_width = width - peers_width
peers_left = 0
chat_left = peers_width
@peers = Widgets::Peers.new x + peers_left, y, peers_width, height
@chat = Widgets::Chat.new x + chat_left, y, chat_width, height
self.focus = @peers
end
def children
[@peers, @chat]
def trigger(event)
case event
when Events::Window::Left
left
when Events::Window::Right
right
else
focus.trigger event
def left
def right
self.focus = @chat