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.
509 510 511 512 513 514 515 516 517 518 519 520 |
# File 'lib/ncurses_ui.rb', line 509 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.
508 509 510 |
# File 'lib/ncurses_ui.rb', line 508 def visible @visible end |
Instance Method Details
#close ⇒ Object
559 560 561 |
# File 'lib/ncurses_ui.rb', line 559 def close @win.close end |
#height ⇒ Object
531 532 533 534 535 536 537 538 |
# File 'lib/ncurses_ui.rb', line 531 def height h = [@row + @height, Curses.lines].min - @row if h == 0 Curses.lines - @row else h end end |
#refresh ⇒ Object
544 545 546 547 548 549 550 551 552 553 554 555 556 557 |
# File 'lib/ncurses_ui.rb', line 544 def refresh return unless @visible Nutils.print @win, 1, 2, "Cloudruby v1.2", :default Nutils.print @win, 2, 4, "UI Toolkit: #{(Curses.const_defined?"VERSION")?"#{Curses::VERSION}, #colors: #{Curses::colors}" : "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.pairMap(@color)) if @color @win.box 0, 0 @win.attroff(Colors.pairMap(@color)) if @color @win.refresh end |
#resize ⇒ Object
540 541 542 |
# File 'lib/ncurses_ui.rb', line 540 def resize @win.resize height, width end |
#width ⇒ Object
522 523 524 525 526 527 528 529 |
# File 'lib/ncurses_ui.rb', line 522 def width w = [@col + @width, Curses.cols].min - @col if w == 0 Curses.cols - @col else w end end |