Class: Zgomot::UI::TextWithValueWindow

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(text, value, color, top, left, value_color = nil) ⇒ TextWithValueWindow

Returns a new instance of TextWithValueWindow.



351
352
353
354
355
# File 'lib/zgomot/ui/windows.rb', line 351

def initialize(text, value, color, top, left, value_color=nil)
  @color, @text, @top, @left, @value = color, text, top, left, value
  @value_color = value_color || color
  display(value)
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



350
351
352
# File 'lib/zgomot/ui/windows.rb', line 350

def color
  @color
end

#leftObject (readonly)

Returns the value of attribute left.



350
351
352
# File 'lib/zgomot/ui/windows.rb', line 350

def left
  @left
end

#textObject (readonly)

Returns the value of attribute text.



350
351
352
# File 'lib/zgomot/ui/windows.rb', line 350

def text
  @text
end

#topObject (readonly)

Returns the value of attribute top.



350
351
352
# File 'lib/zgomot/ui/windows.rb', line 350

def top
  @top
end

#valueObject (readonly)

Returns the value of attribute value.



350
351
352
# File 'lib/zgomot/ui/windows.rb', line 350

def value
  @value
end

#value_colorObject (readonly)

Returns the value of attribute value_color.



350
351
352
# File 'lib/zgomot/ui/windows.rb', line 350

def value_color
  @value_color
end

Instance Method Details

#display(new_value = nil) ⇒ Object



356
357
358
359
360
361
362
363
364
365
# File 'lib/zgomot/ui/windows.rb', line 356

def display(new_value=nil)
  @value = new_value || value
  text_len = text.length + 2
  set_color(color) {
    write(top, left, "#{text}: ")
  }
  set_color(value_color) {
    write(top, left+text_len, value)
  }
end