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::CommonKeys
RETerm::CommonKeys::DEC_CONTROLS, RETerm::CommonKeys::ENTER_CONTROLS, RETerm::CommonKeys::INC_CONTROLS, RETerm::CommonKeys::QUIT_CONTROLS
Constants included from LogHelpers
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 included from RETerm::CommonControls
Attributes inherited from RETerm::Component
#activatable, #activate_focus, #highlight_focus, #window
Instance Method Summary collapse
- #activatable? ⇒ Boolean
- #activate!(*input) ⇒ Object
- #draw! ⇒ Object
-
#initialize(args = {}) ⇒ VSlider
constructor
Initialize the slider component.
- #requested_cols ⇒ Object
- #requested_rows ⇒ Object
Methods included from RETerm::ComponentInput
#bind_key, #handle_input, #key_bound?, #on_enter, #on_key
Methods included from RETerm::CommonControls
Methods inherited from RETerm::Component
#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
Methods included from EventDispatcher
Constructor Details
permalink #initialize(args = {}) ⇒ VSlider
Initialize the slider component
12 13 14 15 16 17 18 19 |
# File 'lib/reterm/components/vslider.rb', line 12 def initialize(args={}) super @initial_value = 0 @increment = 0.01 @range = [0, 1] @labels = true @value = initial_value end |
Instance Attribute Details
permalink #increment ⇒ Object
Returns the value of attribute increment.
7 8 9 |
# File 'lib/reterm/components/vslider.rb', line 7 def increment @increment end |
permalink #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 |
permalink #labels ⇒ Object
Returns the value of attribute labels.
7 8 9 |
# File 'lib/reterm/components/vslider.rb', line 7 def labels @labels end |
permalink #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
permalink #activatable? ⇒ Boolean
33 34 35 |
# File 'lib/reterm/components/vslider.rb', line 33 def activatable? true end |
permalink #activate!(*input) ⇒ Object
[View source]
37 38 39 40 41 |
# File 'lib/reterm/components/vslider.rb', line 37 def activate!(*input) refresh_win handle_input(*input) (range[1] - range[0]) * @value end |
permalink #draw! ⇒ Object
[View source]
29 30 31 |
# File 'lib/reterm/components/vslider.rb', line 29 def draw! refresh_win end |
permalink #requested_cols ⇒ Object
[View source]
25 26 27 |
# File 'lib/reterm/components/vslider.rb', line 25 def requested_cols 3 end |
permalink #requested_rows ⇒ Object
[View source]
21 22 23 |
# File 'lib/reterm/components/vslider.rb', line 21 def requested_rows 10 end |