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.
473 474 475 476 477 478 479 480 481 482 483 484 485 |
# File 'lib/ncurses_ui.rb', line 473 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.
472 473 474 |
# File 'lib/ncurses_ui.rb', line 472 def count @count end |
#title ⇒ Object
Returns the value of attribute title.
472 473 474 |
# File 'lib/ncurses_ui.rb', line 472 def title @title end |
#visible ⇒ Object
Returns the value of attribute visible.
472 473 474 |
# File 'lib/ncurses_ui.rb', line 472 def visible @visible end |
Instance Method Details
#close ⇒ Object
515 516 517 |
# File 'lib/ncurses_ui.rb', line 515 def close @win.close end |
#height ⇒ Object
496 497 498 499 500 501 502 503 |
# File 'lib/ncurses_ui.rb', line 496 def height h = [@row + @height, Curses.lines].min - @row if h == 0 Curses.lines - @row else h end end |
#refresh ⇒ Object
509 510 511 512 513 |
# File 'lib/ncurses_ui.rb', line 509 def refresh return unless @visible Nutils.print @win, 0, 0, "Downloading #{@count} track#{@count > 1?"s":""} | #{title}", :default @win.refresh end |
#resize ⇒ Object
505 506 507 |
# File 'lib/ncurses_ui.rb', line 505 def resize @win.resize height, width end |
#width ⇒ Object
487 488 489 490 491 492 493 494 |
# File 'lib/ncurses_ui.rb', line 487 def width w = [@col + @width, Curses.cols].min - @col if w == 0 Curses.cols - @col else w end end |