Method: CDK::SWINDOW#drawList

Defined in:
lib/cdk/components/swindow.rb

#drawList(box) ⇒ Object

This draws in the contents of the scrolling window



466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
# File 'lib/cdk/components/swindow.rb', line 466

def drawList(box)
  # Determine the last line to draw.
  if @list_size < @view_size
    last_line = @list_size
  else
    last_line = @view_size
  end

  # Erase the scrolling window.
  @field_win.werase

  # Start drawing in each line.
  (0...last_line).each do |x|
    screen_pos = @list_pos[x + @current_top] - @left_char

    # Write in the correct line.
    if screen_pos >= 0
      Draw.writeChtype(@field_win, screen_pos, x,
          @list[x + @current_top], CDK::HORIZONTAL, 0,
          @list_len[x + @current_top])
    else
      Draw.writeChtype(@field_win, 0, x, @list[x + @current_top],
          CDK::HORIZONTAL, @left_char - @list_pos[x + @current_top],
          @list_len[x + @current_top])
    end
  end

  wrefresh(@field_win)
end