Module: RETerm::CDKComponent

Overview

Mixin used by CDK based component defining cdk-specific helpers

Instance Method Summary collapse

Instance Method Details

#_componentObject

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

Returns:

  • (Boolean)


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

#componentObject

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

#valueObject

Return stored value of cdk component



41
42
43
# File 'lib/reterm/mixins/cdk_component.rb', line 41

def value
  component.getValue
end