Class: RETerm::Component

Inherits:
Object
  • Object
show all
Defined in:
lib/reterm/component.rb

Overview

A Component is a generic widget container associated with a window. Subclasses each implement a specific UI artifact.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#windowObject

Returns the value of attribute window.



5
6
7
# File 'lib/reterm/component.rb', line 5

def window
  @window
end

Instance Method Details

#activatable?Boolean

Returns a boolean indicating if the user should be able to focus on and activate the component. By default this is false, but interactive components should override and return true.



28
29
30
# File 'lib/reterm/component.rb', line 28

def activatable?
  false
end

#activate!Object

Actual activation mechanism, invoked by the navigation logic when the user has selected an activatable? component. Should be overriden by interactive subcomponents to process user inpute specific to that component

Raises:

  • (RuntimeError)


36
37
38
# File 'lib/reterm/component.rb', line 36

def activate!
  raise RuntimeError, "should not be activated"
end

#colored?Boolean

Return a boolean indicating if a RETerm::ColorPair has been assign to component



15
16
17
# File 'lib/reterm/component.rb', line 15

def colored?
  !!@colors
end

#colors=(c) ⇒ Object

Assign the specified RETerm::ColorPair to the component



20
21
22
# File 'lib/reterm/component.rb', line 20

def colors=(c)
  @colors = c
end

#finalize!Object

This method is invoked to cleanup the component on shutdown. It should be be overriden by subclasses that needs to clean resources before being deallocated



10
11
# File 'lib/reterm/component.rb', line 10

def finalize!
end