Class: Zgomot::UI::TitleWindow

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, color, top, text_color = nil) ⇒ TitleWindow

Returns a new instance of TitleWindow.



413
414
415
416
417
# File 'lib/zgomot/ui/windows.rb', line 413

def initialize(text, color, top, text_color = nil)
  @text_color = text_color || color
  @text, @color, @top = text, color, top
  display
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



412
413
414
# File 'lib/zgomot/ui/windows.rb', line 412

def color
  @color
end

#textObject (readonly)

Returns the value of attribute text.



412
413
414
# File 'lib/zgomot/ui/windows.rb', line 412

def text
  @text
end

#text_colorObject (readonly)

Returns the value of attribute text_color.



412
413
414
# File 'lib/zgomot/ui/windows.rb', line 412

def text_color
  @text_color
end

#topObject (readonly)

Returns the value of attribute top.



412
413
414
# File 'lib/zgomot/ui/windows.rb', line 412

def top
  @top
end

Instance Method Details

#displayObject



418
419
420
421
422
423
424
425
426
427
428
# File 'lib/zgomot/ui/windows.rb', line 418

def display
  set_color(color) {
    write(top, 0, '-' * WIDTH)
    write(top + 1, 0, '|')
    write(top + 1, WIDTH-1, '|')
    write(top + 2, 0, '-' * WIDTH)
  }
  set_color(text_color) {
    write(top + 1, 1, text.center(WIDTH-2))
  }
end