Class: Flumtter::Window::DynamicView
- Defined in:
- lib/flumtter/app/core/windows/dynamic_view.rb
Instance Method Summary collapse
- #dynamic_view(&blk) ⇒ Object
-
#initialize(*args) ⇒ DynamicView
constructor
A new instance of DynamicView.
- #show(recall = false) ⇒ Object
Methods inherited from Dialog
Methods included from Dispel::Util
#add_multiline_str, #addstr, #getstr
Constructor Details
#initialize(*args) ⇒ DynamicView
Returns a new instance of DynamicView.
6 7 8 9 |
# File 'lib/flumtter/app/core/windows/dynamic_view.rb', line 6 def initialize(*args) super @hight += 1 end |
Instance Method Details
#dynamic_view(&blk) ⇒ Object
11 12 13 |
# File 'lib/flumtter/app/core/windows/dynamic_view.rb', line 11 def dynamic_view(&blk) @view = blk end |
#show(recall = false) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/flumtter/app/core/windows/dynamic_view.rb', line 15 def show(recall=false) Dispel::Screen.open do |screen| view = @view.nil? ? "" : @view.call Dispel::Window.open(@hight + (view.nil? ? 0 : view.size_of_lines), @width, 0, 0) do |win| win.box(?|,?-,?*) win.setpos(win.cury+2, win.curx+1) win.addstr @title.title win.setpos(win.cury+1, 1) win.addstr "¯"*(@title.title.size+2) add_multiline_str(win, @body) win.setpos(win.cury+1, 1) add_multiline_str(win, view) win.setpos(win.cury+2, 1) win.addstr "help: ?".rjust(win.maxx - 2) win.setpos(win.cury+1, 1) call getstr(win) end end rescue Dispel::Recall show(recall) rescue Dispel::NoCommandError => e Window::Popup::Error.new(e.class.to_s).show show(recall) if recall end |