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/main.rb

30 lines
592 B
Ruby
Raw Normal View History

2017-07-24 07:00:51 -04:00
# frozen_string_literal: true
module Widgets
class Main < Container
def initialize(x, y, width, height)
super
2017-07-24 07:22:34 -04:00
@menu = Widgets::Menu.new x, y, nil, height
@chat = Widgets::Chat.new x + @menu.width, y, width - @menu.width, height
2017-07-24 07:00:51 -04:00
self.focus = @menu
end
def children
[@menu, @chat]
end
def trigger(event)
case event
when Events::Window::Left
self.focus = @menu
when Events::Window::Right
self.focus = @chat
else
focus.trigger event
end
end
end
end