Module: RETerm::CDKComponent
- Included in:
- RETerm::Components::Button, RETerm::Components::Dialog, RETerm::Components::Entry, RETerm::Components::HSlider, RETerm::Components::Matrix, RETerm::Components::Radio, RETerm::Components::SList
- Defined in:
- lib/reterm/mixins/cdk_component.rb
Overview
Mixin used by CDK based component defining cdk-specific helpers
Instance Method Summary collapse
-
#_component ⇒ Object
Should be implemented in subclass to initialize component.
-
#activatable? ⇒ Boolean
CDK components may be activated.
-
#activate! ⇒ Object
Invoke CDK activation routine.
-
#colors=(c) ⇒ Object
Assign ColorPair to component.
-
#component ⇒ Object
Return completely initialized CDK component.
-
#draw! ⇒ Object
Invoke CDK draw routine.
-
#value ⇒ Object
Return stored value of cdk component.
Instance Method Details
#_component ⇒ Object
Should be implemented in subclass to initialize component
5 6 7 |
# File 'lib/reterm/mixins/cdk_component.rb', line 5 def _component raise "NotImplemented" end |
#activatable? ⇒ Boolean
CDK components may be activated
31 32 33 |
# File 'lib/reterm/mixins/cdk_component.rb', line 31 def activatable? true end |
#activate! ⇒ Object
Invoke CDK activation routine
36 37 38 |
# File 'lib/reterm/mixins/cdk_component.rb', line 36 def activate! component.activate([]) end |
#colors=(c) ⇒ Object
Assign RETerm::ColorPair to component
20 21 22 23 |
# File 'lib/reterm/mixins/cdk_component.rb', line 20 def colors=(c) super component.setBackgroundColor("</#{@colors.id}>") end |
#component ⇒ Object
Return completely initialized CDK component
10 11 12 13 14 15 16 17 |
# File 'lib/reterm/mixins/cdk_component.rb', line 10 def component enable_cdk! @component ||= begin c = _component c.setBackgroundColor("</#{@colors.id}>") if colored? c end end |
#draw! ⇒ Object
Invoke CDK draw routine
26 27 28 |
# File 'lib/reterm/mixins/cdk_component.rb', line 26 def draw! component.draw([]) end |
#value ⇒ Object
Return stored value of cdk component
41 42 43 |
# File 'lib/reterm/mixins/cdk_component.rb', line 41 def value component.getValue end |