Class: Cliptic::Interface::Menu_Box

Inherits:
Windows::Window show all
Includes:
Cliptic::Interface
Defined in:
lib/cliptic/interface.rb

Direct Known Subclasses

Menu, Resizer

Constant Summary

Constants included from Chars

Chars::Block, Chars::HL, Chars::LL, Chars::LS, Chars::LU, Chars::MS, Chars::Nums, Chars::RL, Chars::RS, Chars::RU, Chars::TD, Chars::TL, Chars::TR, Chars::TU, Chars::Tick, Chars::VL, Chars::XX

Instance Attribute Summary collapse

Attributes inherited from Windows::Window

#centered_x, #centered_y, #col, #x, #y

Instance Method Summary collapse

Methods inherited from Windows::Window

#add_str, #bold, #clear, #color, #move, #refresh, #reset_attrs, #setpos, #standend, #standout, #time_str, #wrap_str

Methods included from Chars

small_num

Constructor Details

#initialize(y:, title: false) ⇒ Menu_Box

Returns a new instance of Menu_Box.



51
52
53
54
55
56
57
58
# File 'lib/cliptic/interface.rb', line 51

def initialize(y:, title:false)
  @logo = Logo.new(line:line+1)
  @title = title
  super(y:y, x:.x+4, line:line, col:nil)
  @top_b = Top_Bar.new
  @bot_b = Bottom_Bar.new
  @draw_bars = true
end

Instance Attribute Details

#bot_bObject (readonly)

Returns the value of attribute bot_b.



50
51
52
# File 'lib/cliptic/interface.rb', line 50

def bot_b
  @bot_b
end

#draw_barsObject (readonly)

Returns the value of attribute draw_bars.



50
51
52
# File 'lib/cliptic/interface.rb', line 50

def draw_bars
  @draw_bars
end

#logoObject (readonly)

Returns the value of attribute logo.



50
51
52
# File 'lib/cliptic/interface.rb', line 50

def 
  @logo
end

#titleObject (readonly)

Returns the value of attribute title.



50
51
52
# File 'lib/cliptic/interface.rb', line 50

def title
  @title
end

#top_bObject (readonly)

Returns the value of attribute top_b.



50
51
52
# File 'lib/cliptic/interface.rb', line 50

def top_b
  @top_b
end

Instance Method Details

#add_title(y: 4, str: title, cp: , bold: true) ⇒ Object



69
70
71
# File 'lib/cliptic/interface.rb', line 69

def add_title(y:4, str:title, cp:$colors[:title], bold:true)
  add_str(y:y, str:str, cp:cp, bold:bold)
end

#drawObject



59
60
61
62
63
64
65
# File 'lib/cliptic/interface.rb', line 59

def draw
  super
  [top_b, bot_b].each(&:draw) if draw_bars
  .draw
  add_title if title
  self
end

#lineObject



66
67
68
# File 'lib/cliptic/interface.rb', line 66

def line
  (Curses.lines-15)/2
end

#reset_posObject



72
73
74
75
76
# File 'lib/cliptic/interface.rb', line 72

def reset_pos
  move(line:line)
  .move(line:line+1)
  [top_b, bot_b].each(&:reset_pos)
end