Class: PM::InfoWindow

Inherits:
PmWindow
  • Object
show all
Includes:
Curses
Defined in:
lib/patchmaster/curses/info_window.rb

Constant Summary collapse

CONTENTS =
File.join(File.dirname(__FILE__), 'info_window_contents.txt')

Instance Attribute Summary collapse

Attributes inherited from PmWindow

#title, #title_prefix, #win

Instance Method Summary collapse

Methods inherited from PmWindow

#make_fit, #move_and_resize, #set_max_contents_len, #visible_height

Constructor Details

#initialize(rows, cols, row, col) ⇒ InfoWindow

Returns a new instance of InfoWindow.



12
13
14
15
16
# File 'lib/patchmaster/curses/info_window.rb', line 12

def initialize(rows, cols, row, col)
  super(rows, cols, row, col, nil)
  @info_text = IO.read(CONTENTS)
  @text = nil
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



10
11
12
# File 'lib/patchmaster/curses/info_window.rb', line 10

def text
  @text
end

Instance Method Details

#drawObject



28
29
30
31
32
33
34
35
36
37
# File 'lib/patchmaster/curses/info_window.rb', line 28

def draw
  super
  i = 1
  @text.each_line do |line|
    break if i >= @win.maxy - 2
    @win.setpos(i+1, 1)
    @win.addstr(make_fit(" #{line.chomp}"))
    i += 1
  end
end