Class: RETerm::Components::ScrollingArea

Inherits:
RETerm::Component show all
Includes:
RETerm::CDKComponent
Defined in:
lib/reterm/components/scrolling_area.rb

Overview

Scrolling Area CDK Component

Direct Known Subclasses

CmdOutput

Constant Summary

Constants included from LogHelpers

LogHelpers::LOG_FILE

Instance Attribute Summary collapse

Attributes inherited from RETerm::Component

#activatable, #activate_focus, #highlight_focus, #window

Instance Method Summary collapse

Methods included from RETerm::CDKComponent

#activate!, #bind_key, #cdk?, #colors=, #component, #deactivate!, #draw!, #early_exit?, #erase, #escape_hit?, #init?, #init_cdk, #normal_exit?, #strip_formatting, #title_attrib=, #value

Methods inherited from RETerm::Component

#activate!, #activate_focus?, #cdk?, #colored?, #colors=, #deactivate!, #deactivate?, #distance_from, #extra_padding, #finalize!, #highlight_focus?, #reactivate!, #resize, #sync!, #sync_getch

Methods included from KeyBindings

#bind_key, #invoke_key_bindings, #key_bindings, #key_bound?

Methods included from LogHelpers

#logger

Methods included from EventDispatcher

#dispatch, #handle

Constructor Details

#initialize(args = {}) ⇒ ScrollingArea

Initialize the ScrollingArea component

Parameters:

  • args (Hash) (defaults to: {})

    scrolling area params

Options Hash (args):

  • :title (String)

    title of area

  • :lines (Integer)

    number of lines in the area



15
16
17
18
19
# File 'lib/reterm/components/scrolling_area.rb', line 15

def initialize(args={})
  super
  @title  = args[:title] || ""
  @lines  = args[:lines] || 10
end

Instance Attribute Details

#linesObject

Returns the value of attribute lines.



7
8
9
# File 'lib/reterm/components/scrolling_area.rb', line 7

def lines
  @lines
end

#titleObject

Returns the value of attribute title.



7
8
9
# File 'lib/reterm/components/scrolling_area.rb', line 7

def title
  @title
end

Instance Method Details

#<<(item) ⇒ Object



34
35
36
# File 'lib/reterm/components/scrolling_area.rb', line 34

def <<(item)
  component.add item, CDK::BOTTOM
end

#activatable?Boolean

XXX swindow results in weird keyboard interactions, disable for now

Returns:

  • (Boolean)


22
23
24
# File 'lib/reterm/components/scrolling_area.rb', line 22

def activatable?
  false
end

#requested_colsObject



30
31
32
# File 'lib/reterm/components/scrolling_area.rb', line 30

def requested_cols
  [@title.size, 10].min
end

#requested_rowsObject



26
27
28
# File 'lib/reterm/components/scrolling_area.rb', line 26

def requested_rows
  10
end