Class: Tuile::Component::InfoWindow
- Defined in:
- lib/tuile/component/info_window.rb,
sig/tuile.rbs
Overview
A Window preconfigured with a List of static lines. Useful for showing read-only information.
Usable tiled (just add to a Layout) or as a popup via InfoWindow.open, which wraps it in a Popup.
Instance Attribute Summary
Attributes inherited from Window
#caption, #footer, #footer_text
Attributes included from HasContent
Class Method Summary collapse
-
.open(caption, lines, size: Fraction::HALF) ⇒ Popup
Opens the info window as a popup.
Instance Method Summary collapse
-
#initialize(caption = "", lines = []) ⇒ InfoWindow
constructor
@param
caption.
Methods inherited from Window
#bottom_border, #children, #focusable?, #frame_caption, #handle_mouse, #key_shortcut=, #layout, #layout_footer, #on_focus, #rect=, #repaint, #repaint_border, #scrollbar=
Methods included from HasContent
#children, #handle_mouse, #on_focus, #rect=
Constructor Details
#initialize(caption = "", lines = []) ⇒ InfoWindow
@param caption
@param lines — initial content; each entry may contain Rainbow formatting.
14 15 16 17 18 19 |
# File 'lib/tuile/component/info_window.rb', line 14 def initialize(caption = "", lines = []) super(caption) list = Component::List.new list.lines = lines self.content = list end |
Class Method Details
.open(caption, lines, size: Fraction::HALF) ⇒ Popup
Opens the info window as a popup.
@param caption
@param lines — the content, may contain formatting.
@param size — the popup's size, applied top-down; the list wraps and scrolls within it. Defaults to Fraction::HALF.
@return — the opened popup.
27 28 29 |
# File 'lib/tuile/component/info_window.rb', line 27 def self.open(caption, lines, size: Fraction::HALF) Popup.open(content: InfoWindow.new(caption, lines), size: size) end |