Class: RETerm::Component
- Inherits:
-
Object
- Object
- RETerm::Component
- 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.
Direct Known Subclasses
RETerm::Components::AsciiText, RETerm::Components::Button, RETerm::Components::Dial, RETerm::Components::Dialog, RETerm::Components::Entry, RETerm::Components::HSlider, RETerm::Components::Image, RETerm::Components::Label, RETerm::Components::Matrix, RETerm::Components::Radio, RETerm::Components::Rocker, RETerm::Components::SList, RETerm::Components::Template, RETerm::Components::VSlider, Layout
Instance Attribute Summary collapse
-
#window ⇒ Object
Returns the value of attribute window.
Instance Method Summary collapse
-
#activatable? ⇒ Boolean
Returns a boolean indicating if the user should be able to focus on and activate the component.
-
#activate! ⇒ Object
Actual activation mechanism, invoked by the navigation logic when the user has selected an activatable? component.
-
#colored? ⇒ Boolean
Return a boolean indicating if a ColorPair has been assign to component.
-
#colors=(c) ⇒ Object
Assign the specified ColorPair to the component.
-
#finalize! ⇒ Object
This method is invoked to cleanup the component on shutdown.
Instance Attribute Details
#window ⇒ Object
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
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 |