Class: RETerm::Components::Button
- Inherits:
-
RETerm::Component
- Object
- RETerm::Component
- RETerm::Components::Button
- Includes:
- RETerm::CDKComponent
- Defined in:
- lib/reterm/components/button.rb
Overview
CDK Button Component
Direct Known Subclasses
Constant Summary
Constants included from LogHelpers
Instance Attribute Summary collapse
-
#title ⇒ Object
Returns the value of attribute title.
Attributes inherited from RETerm::Component
#activatable, #activate_focus, #highlight_focus, #window
Instance Method Summary collapse
- #activate! ⇒ Object
- #click! ⇒ Object
-
#initialize(args = {}) ⇒ Button
constructor
Initialize the Button component.
- #requested_cols ⇒ Object
- #requested_rows ⇒ Object
- #skip_formatting=(b) ⇒ Object
Methods included from RETerm::CDKComponent
#activatable?, #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_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 = {}) ⇒ Button
Initialize the Button component
11 12 13 14 |
# File 'lib/reterm/components/button.rb', line 11 def initialize(args={}) super @title = args[:title] || "" end |
Instance Attribute Details
#title ⇒ Object
Returns the value of attribute title.
16 17 18 |
# File 'lib/reterm/components/button.rb', line 16 def title @title end |
Instance Method Details
#activate! ⇒ Object
35 36 37 38 |
# File 'lib/reterm/components/button.rb', line 35 def activate! dispatch :clicked deactivate! end |
#click! ⇒ Object
40 41 42 |
# File 'lib/reterm/components/button.rb', line 40 def click! activate! end |
#requested_cols ⇒ Object
31 32 33 |
# File 'lib/reterm/components/button.rb', line 31 def requested_cols @title.size + 1 end |
#requested_rows ⇒ Object
27 28 29 |
# File 'lib/reterm/components/button.rb', line 27 def requested_rows 2 end |
#skip_formatting=(b) ⇒ Object
23 24 25 |
# File 'lib/reterm/components/button.rb', line 23 def skip_formatting=(b) component.skip_formatting = b end |