Class: Tuile::Component::LogWindow
- Inherits:
-
Window
- Object
- Tuile::Component
- Window
- Tuile::Component::LogWindow
- Defined in:
- lib/tuile/component/log_window.rb
Overview
Shows a log. Construct your logger pointed at a IO to route log lines into this window:
log_window = Tuile::Component::LogWindow.new
logger = Logger.new(Tuile::Component::LogWindow::IO.new(log_window))
Any logger that writes formatted lines to an IO works the same way —for example ‘TTY::Logger` configured with the `:console` handler and `output: LogWindow::IO.new(window)`.
Defined Under Namespace
Classes: IO
Instance Attribute Summary
Attributes inherited from Window
Attributes included from HasContent
Attributes inherited from Tuile::Component
Instance Method Summary collapse
-
#initialize(caption = "Log") ⇒ LogWindow
constructor
A new instance of LogWindow.
Methods inherited from Window
#children, #content_size, #focusable?, #handle_key, #handle_mouse, #key_shortcut=, #rect=, #repaint, #scrollbar=, #visible?
Methods included from HasContent
#children, #handle_key, #handle_mouse, #on_focus, #rect=
Methods inherited from Tuile::Component
#active=, #active?, #attached?, #children, #content_size, #cursor_position, #depth, #find_shortcut_component, #focus, #focusable?, #handle_key, #handle_mouse, #keyboard_hint, #on_child_removed, #on_focus, #on_tree, #repaint, #root, #screen
Constructor Details
#initialize(caption = "Log") ⇒ LogWindow
Returns a new instance of LogWindow.
16 17 18 19 20 21 22 23 24 |
# File 'lib/tuile/component/log_window.rb', line 16 def initialize(caption = "Log") super list = Component::List.new list.auto_scroll = true # Allow scrolling when a long stacktrace is logged. list.cursor = Component::List::Cursor.new self.content = list self. = true end |