class RETerm::Components::AlphaList

Alpha List CDK Component

Public Class Methods

new(args={}) click to toggle source

Initialize the AlphaList component

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

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

Public Instance Methods

requested_cols() click to toggle source
# File lib/reterm/components/alphalist.rb, line 26
def requested_cols
  [@title.size, @label.size, max_item_size, 20].max + 2
end
requested_rows() click to toggle source
# File lib/reterm/components/alphalist.rb, line 22
def requested_rows
  [@items.size + 5, 10].min
end

Private Instance Methods

_component() click to toggle source
# File lib/reterm/components/alphalist.rb, line 32
def _component
  CDK::ALPHALIST.new(window.cdk_scr,
                     2, 1,               # x, y
                     window.rows - 2,    # height
                     window.cols - 2,    # width
                     @title, @label,
                     @items, @items.size,
                     '_',                # filler char
                     Ncurses::A_REVERSE, # highlight
                     true, false)        # box, shadow
end