Class: NInfobox
- Inherits:
-
Object
- Object
- NInfobox
- Defined in:
- lib/ncurses_ui.rb
Instance Attribute Summary collapse
-
#visible ⇒ Object
Returns the value of attribute visible.
Instance Method Summary collapse
- #close ⇒ Object
- #height ⇒ Object
-
#initialize(parent, scr, row, col, color, w, h) ⇒ NInfobox
constructor
A new instance of NInfobox.
- #refresh ⇒ Object
- #resize ⇒ Object
- #width ⇒ Object
Constructor Details
#initialize(parent, scr, row, col, color, w, h) ⇒ NInfobox
Returns a new instance of NInfobox.
416 417 418 419 420 421 422 423 424 425 426 427 |
# File 'lib/ncurses_ui.rb', line 416 def initialize parent, scr, row, col, color, w, h @parent = parent @scr = scr @row = row @col = col @color = color @width = w @height = h @win = Curses::Window.new height, width, @row, @col @visible = false refresh end |
Instance Attribute Details
#visible ⇒ Object
Returns the value of attribute visible.
415 416 417 |
# File 'lib/ncurses_ui.rb', line 415 def visible @visible end |
Instance Method Details
#close ⇒ Object
466 467 468 |
# File 'lib/ncurses_ui.rb', line 466 def close @win.close end |
#height ⇒ Object
438 439 440 441 442 443 444 445 |
# File 'lib/ncurses_ui.rb', line 438 def height h = [@row + @height, Curses.lines].min - @row if h == 0 Curses.lines - @row else h end end |
#refresh ⇒ Object
451 452 453 454 455 456 457 458 459 460 461 462 463 464 |
# File 'lib/ncurses_ui.rb', line 451 def refresh return unless @visible Nutils.print @win, 1, 2, "Cloudruby v1.1", :default Nutils.print @win, 2, 4, "UI Toolkit: #{(Curses.const_defined?"VERSION")?Curses::VERSION : "N/A"}", :default Nutils.print @win, 3, 4, "#{@parent.audio_backend.version}", :default Nutils.print @win, 4, 4, "Ruby version: #{RUBY_VERSION}", :default Nutils.print @win, 5, 4, "Author: kulpae <[email protected]>", :artist Nutils.print @win, 6, 4, "Website: uraniumlane.net", :title Nutils.print @win, 7, 4, "License: MIT", :default @win.attron(Colors.map(@color)) if @color @win.box 0, 0 @win.attroff(Colors.map(@color)) if @color @win.refresh end |
#resize ⇒ Object
447 448 449 |
# File 'lib/ncurses_ui.rb', line 447 def resize @win.resize height, width end |
#width ⇒ Object
429 430 431 432 433 434 435 436 |
# File 'lib/ncurses_ui.rb', line 429 def width w = [@col + @width, Curses.cols].min - @col if w == 0 Curses.cols - @col else w end end |