Sha256: 06821faf8b482e9ee5f6e6197d000f3e88c54783171637720c7a554d8ed81d77

Contents?: true

Size: 731 Bytes

Versions: 6

Compression:

Stored size: 731 Bytes

Contents

require 'patchmaster/app/pm_window'

module PM
class ListWindow < PmWindow

  attr_reader :list

  # +curr_item_method_sym+ is a method symbol that is sent to
  # PM::PatchMaster to obtain the current item so we can highlight it.
  def set_contents(title, list, curr_item_method_sym)
    @title, @list, @curr_item_method_sym = title, list, curr_item_method_sym
    draw
  end

  def draw
    super
    return unless @list

    curr_item = PM::PatchMaster.instance.send(@curr_item_method_sym)
    @list.each_with_index do |thing, i|
      @win.setpos(i+1, 1)
      @win.attron(A_REVERSE) if thing == curr_item
      @win.addstr(make_fit(" #{thing.name} "))
      @win.attroff(A_REVERSE) if thing == curr_item
    end
  end

end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
patchmaster-0.0.6 lib/patchmaster/app/list_window.rb
patchmaster-0.0.5 lib/patchmaster/app/list_window.rb
patchmaster-0.0.4 lib/patchmaster/app/list_window.rb
patchmaster-0.0.3 lib/patchmaster/app/list_window.rb
patchmaster-0.0.2 lib/patchmaster/app/list_window.rb
patchmaster-0.0.1 lib/patchmaster/app/list_window.rb