Class: RETerm::Components::Dial
- Inherits:
-
RETerm::Component
- Object
- RETerm::Component
- RETerm::Components::Dial
- Includes:
- RETerm::ComponentInput
- Defined in:
- lib/reterm/components/dial.rb
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.
-
#value ⇒ Object
Returns the value of attribute value.
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 = {}) ⇒ Dial
constructor
Enapsulating window should be at least 4x4 for decent effect, at least 7x7 provides best resolution.
- #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 = {}) ⇒ Dial
Enapsulating window should be at least 4x4 for decent effect, at least 7x7 provides best resolution
22 23 24 25 26 27 28 29 |
# File 'lib/reterm/components/dial.rb', line 22 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.
6 7 8 |
# File 'lib/reterm/components/dial.rb', line 6 def increment @increment end |
permalink #initial_value ⇒ Object
Returns the value of attribute initial_value.
6 7 8 |
# File 'lib/reterm/components/dial.rb', line 6 def initial_value @initial_value end |
permalink #labels ⇒ Object
Returns the value of attribute labels.
6 7 8 |
# File 'lib/reterm/components/dial.rb', line 6 def labels @labels end |
permalink #range ⇒ Object
Returns the value of attribute range.
6 7 8 |
# File 'lib/reterm/components/dial.rb', line 6 def range @range end |
permalink #value ⇒ Object
Returns the value of attribute value.
8 9 10 |
# File 'lib/reterm/components/dial.rb', line 8 def value @value end |
Instance Method Details
permalink #activatable? ⇒ Boolean
43 44 45 |
# File 'lib/reterm/components/dial.rb', line 43 def activatable? true end |
permalink #activate!(*input) ⇒ Object
[View source]
47 48 49 50 51 |
# File 'lib/reterm/components/dial.rb', line 47 def activate!(*input) refresh_win handle_input(*input) @value end |
permalink #draw! ⇒ Object
[View source]
39 40 41 |
# File 'lib/reterm/components/dial.rb', line 39 def draw! refresh_win end |
permalink #requested_cols ⇒ Object
[View source]
35 36 37 |
# File 'lib/reterm/components/dial.rb', line 35 def requested_cols 7 end |
permalink #requested_rows ⇒ Object
[View source]
31 32 33 |
# File 'lib/reterm/components/dial.rb', line 31 def requested_rows 7 end |