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
645 B
Ruby
Raw Normal View History

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