Class: NInfobox

Inherits:
Object
  • Object
show all
Defined in:
lib/ncurses_ui.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#visibleObject

Returns the value of attribute visible.



508
509
510
# File 'lib/ncurses_ui.rb', line 508

def visible
  @visible
end

Instance Method Details

#closeObject



559
560
561
# File 'lib/ncurses_ui.rb', line 559

def close
  @win.close
end

#heightObject



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

#refreshObject



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

#resizeObject



540
541
542
# File 'lib/ncurses_ui.rb', line 540

def resize
  @win.resize height, width
end

#widthObject



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