Class: RETerm::Components::VSlider
- Inherits:
-
RETerm::Component
- Object
- RETerm::Component
- RETerm::Components::VSlider
- Includes:
- RETerm::ComponentInput
- Defined in:
- lib/reterm/components/vslider.rb
Overview
Vertical Slider Component
Constant Summary
Constants included from RETerm::ComponentInput
RETerm::ComponentInput::DEC_CONTROLS, RETerm::ComponentInput::INC_CONTROLS, RETerm::ComponentInput::QUIT_CONTROLS
Instance Attribute Summary collapse
-
#increment ⇒ Object
Returns the value of attribute increment.
-
#initial_value ⇒ Object
Returns the value of attribute initial_value.
-
#labels ⇒ Object
Returns the value of attribute labels.
-
#range ⇒ Object
Returns the value of attribute range.
Attributes inherited from RETerm::Component
Instance Method Summary collapse
- #activatable? ⇒ Boolean
- #activate! ⇒ Object
- #draw! ⇒ Object
-
#initialize(args = {}) ⇒ VSlider
constructor
Initialize the slider component.
Methods included from RETerm::ComponentInput
Methods inherited from RETerm::Component
#colored?, #colors=, #finalize!
Constructor Details
#initialize(args = {}) ⇒ VSlider
Initialize the slider component
12 13 14 15 16 17 18 |
# File 'lib/reterm/components/vslider.rb', line 12 def initialize(args={}) @initial_value = 0 @increment = 0.01 @range = [0, 1] @labels = true @value = initial_value end |
Instance Attribute Details
#increment ⇒ Object
Returns the value of attribute increment.
7 8 9 |
# File 'lib/reterm/components/vslider.rb', line 7 def increment @increment end |
#initial_value ⇒ Object
Returns the value of attribute initial_value.
7 8 9 |
# File 'lib/reterm/components/vslider.rb', line 7 def initial_value @initial_value end |
#labels ⇒ Object
Returns the value of attribute labels.
7 8 9 |
# File 'lib/reterm/components/vslider.rb', line 7 def labels @labels end |
#range ⇒ Object
Returns the value of attribute range.
7 8 9 |
# File 'lib/reterm/components/vslider.rb', line 7 def range @range end |
Instance Method Details
#activatable? ⇒ Boolean
24 25 26 |
# File 'lib/reterm/components/vslider.rb', line 24 def activatable? true end |
#activate! ⇒ Object
28 29 30 31 32 |
# File 'lib/reterm/components/vslider.rb', line 28 def activate! refresh_win handle_input (range[1] - range[0]) * @value end |
#draw! ⇒ Object
20 21 22 |
# File 'lib/reterm/components/vslider.rb', line 20 def draw! refresh_win end |