Class: NDownloadBox
- Inherits:
-
Object
- Object
- NDownloadBox
- Defined in:
- lib/ncurses_ui.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
-
#title ⇒ Object
Returns the value of attribute title.
-
#visible ⇒ Object
Returns the value of attribute visible.
Instance Method Summary collapse
- #close ⇒ Object
- #height ⇒ Object
-
#initialize(scr, row, col, color, w, h) ⇒ NDownloadBox
constructor
A new instance of NDownloadBox.
- #refresh ⇒ Object
- #resize ⇒ Object
- #width ⇒ Object
Constructor Details
#initialize(scr, row, col, color, w, h) ⇒ NDownloadBox
Returns a new instance of NDownloadBox.
566 567 568 569 570 571 572 573 574 575 576 577 578 |
# File 'lib/ncurses_ui.rb', line 566 def initialize scr, row, col, color, w, h @scr = scr @row = row @col = col @color = color @width = w @height = h @win = Curses::Window.new height, width, @row, @col @visible = false @count = 0 @title = "" refresh end |
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count.
565 566 567 |
# File 'lib/ncurses_ui.rb', line 565 def count @count end |
#title ⇒ Object
Returns the value of attribute title.
565 566 567 |
# File 'lib/ncurses_ui.rb', line 565 def title @title end |
#visible ⇒ Object
Returns the value of attribute visible.
565 566 567 |
# File 'lib/ncurses_ui.rb', line 565 def visible @visible end |
Instance Method Details
#close ⇒ Object
608 609 610 |
# File 'lib/ncurses_ui.rb', line 608 def close @win.close end |
#height ⇒ Object
589 590 591 592 593 594 595 596 |
# File 'lib/ncurses_ui.rb', line 589 def height h = [@row + @height, Curses.lines].min - @row if h == 0 Curses.lines - @row else h end end |
#refresh ⇒ Object
602 603 604 605 606 |
# File 'lib/ncurses_ui.rb', line 602 def refresh return unless @visible Nutils.print @win, 0, 0, "Downloading #{@count} track#{@count > 1?"s":""} | #{title}", :default @win.refresh end |
#resize ⇒ Object
598 599 600 |
# File 'lib/ncurses_ui.rb', line 598 def resize @win.resize height, width end |
#width ⇒ Object
580 581 582 583 584 585 586 587 |
# File 'lib/ncurses_ui.rb', line 580 def width w = [@col + @width, Curses.cols].min - @col if w == 0 Curses.cols - @col else w end end |