class RETerm::Components::Radio

CDK Radio Component

Public Class Methods

new(args={}) click to toggle source

Initialize the Radio component

@param [Hash] args radio params @option args [String] :title title of radio @option args [Array<String>] :items items to

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

Public Instance Methods

requested_cols() click to toggle source
# File lib/reterm/components/radio.rb, line 24
def requested_cols
  max_item_size + 3
end
requested_rows() click to toggle source
# File lib/reterm/components/radio.rb, line 20
def requested_rows
  @items.size
end

Private Instance Methods

_component() click to toggle source
# File lib/reterm/components/radio.rb, line 30
def _component
  CDK::RADIO.new(window.cdk_scr,                         # cdkscreen,
                 2, 1, CDK::RIGHT,                       # xplace, yplace, scroll pos
                 window.rows - 2,                        # widget height
                 window.cols  - 2,                       # widget width
                 @title, @items, @items.size,            # title and items
                 '#'.ord | Ncurses::A_REVERSE,           # choice char
                 true,                                   # default item
                 Ncurses::A_REVERSE,                     # highlight
                 true, false)                            # box, shadow
end