class RETerm::Components::Button

CDK Button Component

Attributes

title[R]

Public Class Methods

new(args={}) click to toggle source

Initialize the Button component

@param [Hash] args button params @option args [String] :title title of button

Calls superclass method RETerm::Component::new
# File lib/reterm/components/button.rb, line 11
def initialize(args={})
  super
  @title = args[:title] || ""
end

Public Instance Methods

activate!() click to toggle source
# File lib/reterm/components/button.rb, line 35
def activate!
  dispatch :clicked
  deactivate!
end
click!() click to toggle source
# File lib/reterm/components/button.rb, line 40
def click!
  activate!
end
requested_cols() click to toggle source
# File lib/reterm/components/button.rb, line 31
def requested_cols
  @title.size + 1
end
requested_rows() click to toggle source
# File lib/reterm/components/button.rb, line 27
def requested_rows
  2
end
skip_formatting=(b) click to toggle source
# File lib/reterm/components/button.rb, line 23
def skip_formatting=(b)
  component.skip_formatting = b
end
title=(t) click to toggle source
# File lib/reterm/components/button.rb, line 18
def title=(t)
  @title = t
  component.setMessage(t)
end

Private Instance Methods

_component() click to toggle source
# File lib/reterm/components/button.rb, line 52
def _component
  CDK::BUTTON.new(window.cdk_scr,           # cdk screen
                  CDK::CENTER, CDK::CENTER, # x, y
                  @title,                   # title
                  callback,                 # click callback
                  false, false)             # box, shadow
end
callback() click to toggle source
# File lib/reterm/components/button.rb, line 46
def callback
  proc { |b|
    dispatch :clicked
  }
end