Class: RETerm::Components::AlphaList
- Inherits:
-
RETerm::Component
- Object
- RETerm::Component
- RETerm::Components::AlphaList
- Includes:
- RETerm::CDKComponent, ItemHelpers
- Defined in:
- lib/reterm/components/alphalist.rb
Overview
Alpha List CDK Component
Constant Summary
Constants included from LogHelpers
Instance Attribute Summary
Attributes inherited from RETerm::Component
#activatable, #activate_focus, #highlight_focus, #window
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ AlphaList
constructor
Initialize the AlphaList component.
- #requested_cols ⇒ Object
- #requested_rows ⇒ Object
Methods included from ItemHelpers
Methods included from RETerm::CDKComponent
#activatable?, #activate!, #bind_key, #cdk?, #colors=, #component, #deactivate!, #draw!, #early_exit?, #erase, #escape_hit?, #init?, #init_cdk, #normal_exit?, #strip_formatting, #title_attrib=, #value
Methods inherited from RETerm::Component
#activatable?, #activate!, #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
#initialize(args = {}) ⇒ AlphaList
Initialize the AlphaList component
15 16 17 18 19 20 |
# File 'lib/reterm/components/alphalist.rb', line 15 def initialize(args={}) super @title = args[:title] || "" @label = args[:label] || "" @items = args[:items] || [] end |
Instance Method Details
#requested_cols ⇒ Object
26 27 28 |
# File 'lib/reterm/components/alphalist.rb', line 26 def requested_cols [@title.size, @label.size, max_item_size, 20].max + 2 end |
#requested_rows ⇒ Object
22 23 24 |
# File 'lib/reterm/components/alphalist.rb', line 22 def requested_rows [@items.size + 5, 10].min end |