Method: CDK::ITEMLIST#drawField

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

#drawField(highlight) ⇒ Object

This function draws the contents of the field.



263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/cdk/components/itemlist.rb', line 263

def drawField(highlight)
  # Declare local vars.
  current_item = @current_item

  # Determine how much we have to draw.
  len = [@item_len[current_item], @field_width].min

  # Erase the field window.
  @field_win.werase

  # Draw in the current item in the field.
  (0...len).each do |x|
    c = @item[current_item][x]

    if highlight
      c = c.ord | Ncurses::A_REVERSE
    end

    @field_win.mvwaddch(0, x + @item_pos[current_item], c)
  end

  # Redraw the field window.
  wrefresh(@field_win)
end