Class: Rfd::Window

Inherits:
Curses::Window
  • Object
show all
Defined in:
lib/rfd/windows.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(maxy: nil, maxx: nil, begy: nil, begx: nil, window: nil) ⇒ Window

Returns a new instance of Window.



15
16
17
# File 'lib/rfd/windows.rb', line 15

def initialize(maxy: nil, maxx: nil, begy: nil, begx: nil, window: nil)
  super window || Curses.stdscr.subwin(maxy, maxx, begy, begx)
end

Class Method Details

.draw_bordersObject



6
7
8
9
10
11
12
13
# File 'lib/rfd/windows.rb', line 6

def self.draw_borders
  [[5, Curses.stdscr.maxx, 0, 0], [5, Curses.cols - 30, 0, 0], [Curses.stdscr.maxy - 5, Curses.stdscr.maxx, 4, 0]].each do |height, width, top, left|
    w = Curses.stdscr.subwin height, width, top, left
    w.bkgdset Curses.color_pair(Curses::COLOR_CYAN)
    w.box 0, 0
    w.close
  end
end

Instance Method Details

#writeln(row, str) ⇒ Object



19
20
21
22
23
24
# File 'lib/rfd/windows.rb', line 19

def writeln(row, str)
  setpos row, 0
  clrtoeol
  self << str
  refresh
end