Class: Rurses::PanelStack
- Inherits:
-
Object
- Object
- Rurses::PanelStack
- Defined in:
- lib/terminal-notes/rurses/panel_stack.rb
Instance Method Summary collapse
- #add(window, add_subwindows: true) ⇒ Object (also: #<<)
-
#initialize ⇒ PanelStack
constructor
A new instance of PanelStack.
- #refresh_in_memory ⇒ Object
- #remove(window, remove_subwindows: true) ⇒ Object
Constructor Details
#initialize ⇒ PanelStack
Returns a new instance of PanelStack.
3 4 5 |
# File 'lib/terminal-notes/rurses/panel_stack.rb', line 3 def initialize @window_to_panel_map = { } end |
Instance Method Details
#add(window, add_subwindows: true) ⇒ Object Also known as: <<
10 11 12 13 14 15 16 17 |
# File 'lib/terminal-notes/rurses/panel_stack.rb', line 10 def add(window, add_subwindows: true) window_to_panel_map[window] = Rurses.curses.new_panel(window.curses_ref) if add_subwindows window.subwindows.each_value do |subwindow| add(subwindow, add_subwindows: add_subwindows) end end end |
#refresh_in_memory ⇒ Object
31 32 33 |
# File 'lib/terminal-notes/rurses/panel_stack.rb', line 31 def refresh_in_memory Rurses.curses.update_panels end |
#remove(window, remove_subwindows: true) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/terminal-notes/rurses/panel_stack.rb', line 20 def remove(window, remove_subwindows: true) if remove_subwindows window.subwindows.each_value do |subwindow| remove(subwindow, remove_subwindows: remove_subwindows) end end window.clear Rurses.curses.del_panel(window_to_panel_map[window]) Rurses.curses.delwin(window.curses_ref) end |