Class: Spreadshit::Window

Inherits:
Object
  • Object
show all
Includes:
Curses
Defined in:
lib/spreadshit/window.rb

Defined Under Namespace

Classes: Address, SpreadsheetDelegate

Instance Method Summary collapse

Constructor Details

#initialize {|@spreadsheet_delegate| ... } ⇒ Window

Returns a new instance of Window.

Yields:

  • (@spreadsheet_delegate)


47
48
49
50
51
52
53
54
55
# File 'lib/spreadshit/window.rb', line 47

def initialize
  @mode = :navigation
  @x, @y = 0, 0
  @sx, @sy = 0, 0
  @col_width = 13
  @letters = ("A".."ZZZ").to_a
  @spreadsheet_delegate = SpreadsheetDelegate.new
  yield @spreadsheet_delegate
end

Instance Method Details

#startObject



57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/spreadshit/window.rb', line 57

def start
  init_screen
  start_color
  init_pair(COLOR_WHITE, COLOR_BLACK, COLOR_WHITE)
  init_pair(COLOR_BLUE, COLOR_BLACK, COLOR_BLUE)
  init_pair(COLOR_GREEN, COLOR_BLACK, COLOR_GREEN)
  init_pair(COLOR_RED, COLOR_BLACK, COLOR_MAGENTA)
  use_default_colors
  redraw

  loop { capture_input }
end