Class: VER::Status::NanoHelp

Inherits:
Tk::Tile::Frame
  • Object
show all
Includes:
LabelToggle
Defined in:
lib/ver/status/nano_help.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from LabelToggle

#toggle

Constructor Details

#initialize(status, options = {}) ⇒ NanoHelp

Returns a new instance of NanoHelp.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ver/status/nano_help.rb', line 8

def initialize(status, options = {})
  @status = status
  @weight = options.delete(:weight) || 0
  @row = options.delete(:row)
  @column = options.delete(:column)
  @sticky = options.delete(:sticky)
  @font = status.buffer.options.font

  super

  @long_labels = []
  @short_labels = []

  add 0, 0, '^G', ' Get Help'
  add 0, 1, '^O', ' WriteOut'
  add 0, 2, '^R', ' Read File'
  add 0, 3, '^Y', ' Prev Page'
  add 0, 4, '^K', ' Cut Text'
  add 0, 5, '^C', ' Cur Pos'
  add 1, 0, '^X', ' Exit'
  add 1, 1, '^J', ' Justify'
  add 1, 2, '^W', ' Where Is'
  add 1, 3, '^V', ' Next Page'
  add 1, 4, '^U', ' UnCut Text'
  add 1, 5, '^T', ' To Spell'

  0.upto 11 do |col|
    weight = col % 2 == 0 ? 0 : 1
    grid_columnconfigure(col, weight: weight)
  end
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



6
7
8
# File 'lib/ver/status/nano_help.rb', line 6

def column
  @column
end

#rowObject (readonly)

Returns the value of attribute row.



6
7
8
# File 'lib/ver/status/nano_help.rb', line 6

def row
  @row
end

#statusObject (readonly)

Returns the value of attribute status.



6
7
8
# File 'lib/ver/status/nano_help.rb', line 6

def status
  @status
end

#stickyObject (readonly)

Returns the value of attribute sticky.



6
7
8
# File 'lib/ver/status/nano_help.rb', line 6

def sticky
  @sticky
end

#weightObject (readonly)

Returns the value of attribute weight.



6
7
8
# File 'lib/ver/status/nano_help.rb', line 6

def weight
  @weight
end

Instance Method Details

#add(row, col, short, long) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/ver/status/nano_help.rb', line 40

def add(row, col, short, long)
  short_label = Tk::Tile::Label.new(
    self, font: @font, background: 'white', foreground: 'black', text: short)
  long_label  = Tk::Tile::Label.new(
    self, font: @font, background: 'black', foreground: 'white', text: long)
  short_col = col * 2
  long_col = short_col + 1

  short_label.grid_configure(row: row, column: short_col, sticky: :w)
  long_label.grid_configure(row: row, column: long_col, sticky: :we)

  @long_labels << long_label
  @short_labels << short_label
end

#style=(config) ⇒ Object



55
56
57
# File 'lib/ver/status/nano_help.rb', line 55

def style=(config)
  # @long_labels.each{|label| label.configure(config) }
end