Class: RubyCurses::DirectoryListCellRenderer

Inherits:
ListCellRenderer
  • Object
show all
Defined in:
lib/rbcurse/experimental/widgets/directorylist.rb

Instance Method Summary collapse

Instance Method Details

#repaint(graphic, r = @row, c = @col, row_index = -1,, value = @text, focussed = false, selected = false) ⇒ Object

paint a list box cell

2010-09-02 15:38 changed focussed to take true, false and :SOFT_FOCUS
SOFT_FOCUS means the form focus is no longer on this field, but this row
was focussed when use was last on this field. This row will take focus
when field is focussed again

@param [Buffer] window or buffer object used for printing
@param [Fixnum] row
@param [Fixnum] column
@param [Fixnum] actual index into data, some lists may have actual data elsewhere and
                display data separate. e.g. rfe_renderer (directory listing)
@param [String] text to print in cell
@param [Boolean, :SOFT_FOCUS] cell focussed, not focussed, cell focussed but field is not focussed
@param [Boolean] cell selected or not


445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
# File 'lib/rbcurse/experimental/widgets/directorylist.rb', line 445

def repaint graphic, r=@row,c=@col, row_index=-1,value=@text, focussed=false, selected=false

  prepare_default_colors focussed, selected
  if row_index == 0
    #nvalue = " %s %8s  %19s %s   %s " % value.split(",")
    graphic.printstring r, c, "%-s" % value, @color_pair,@attr
  else
    $log.debug " CELL XXX GTETING  #{row_index} ,#{value}"


    # ensure we do not exceed
    if !@display_length.nil?
      if value.length > @display_length
        value = value[0..@display_length-1]
      end
    end
    len = @display_length || value.length
    graphic.printstring r, c, "%-*s" % [len, value], @color_pair,@attr
  end
end