Class: Zgomot::UI::TableCellWindow

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/zgomot/ui/windows.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#set_color, #write

Constructor Details

#initialize(value, color, width, top, left, value_color) ⇒ TableCellWindow

Returns a new instance of TableCellWindow.



391
392
393
394
# File 'lib/zgomot/ui/windows.rb', line 391

def initialize(value, color, width, top, left, value_color)
  @color, @value, @left, @top, @width = color, value, left, top, width
  display(value, value_color)
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



390
391
392
# File 'lib/zgomot/ui/windows.rb', line 390

def color
  @color
end

#leftObject (readonly)

Returns the value of attribute left.



390
391
392
# File 'lib/zgomot/ui/windows.rb', line 390

def left
  @left
end

#topObject (readonly)

Returns the value of attribute top.



390
391
392
# File 'lib/zgomot/ui/windows.rb', line 390

def top
  @top
end

#valueObject (readonly)

Returns the value of attribute value.



390
391
392
# File 'lib/zgomot/ui/windows.rb', line 390

def value
  @value
end

#widthObject (readonly)

Returns the value of attribute width.



390
391
392
# File 'lib/zgomot/ui/windows.rb', line 390

def width
  @width
end

Instance Method Details

#display(value, value_color) ⇒ Object



395
396
397
398
399
400
401
402
403
404
405
406
407
# File 'lib/zgomot/ui/windows.rb', line 395

def display(value, value_color)
  offset = 0
  set_color(color) {
    if left == 0
      write(top, left, '|')
      offset = 1
    end
    write(top, left+width-1-offset, '|')
  }
  set_color(value_color) {
    write(top, left+offset, "%-#{width-offset-2}s" % value)
  }
end