Class: Canis::DefaultRenderer

Inherits:
AbstractTextPadRenderer show all
Defined in:
lib/canis/core/widgets/textpad.rb

Overview

An extension of Abstracttextpadrenderer which takes care of AbstractChunkLine objects

calling their +print+ method.

Instance Attribute Summary

Attributes inherited from AbstractTextPadRenderer

#attr, #color_pair, #content_cols, #cp, #list, #source

Instance Method Summary collapse

Methods inherited from AbstractTextPadRenderer

#initialize, #pre_render, #render_all

Constructor Details

This class inherits a constructor from Canis::AbstractTextPadRenderer

Instance Method Details

#render(pad, lineno, text) ⇒ Object

default method for rendering a line If it is a chunkline, then we take care of it. Only if it is a String do we pass to renderer. Should a renderer be allowed to handle chunks. Or be yielded chunks?



1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
# File 'lib/canis/core/widgets/textpad.rb', line 1590

def render pad, lineno, text
  if text.is_a? AbstractChunkLine
    text.print pad, lineno, 0, @content_cols, color_pair, attr
    return
  end
  ## messabox does have a method to paint the whole window in bg color its in rwidget.rb
  att = NORMAL
  FFI::NCurses.wattron(pad, @cp | att)
  FFI::NCurses.mvwaddstr(pad, lineno, 0, @clearstring) if @clearstring
  FFI::NCurses.mvwaddstr(pad, lineno, 0, @list[lineno])

  #FFI::NCurses.mvwaddstr(pad, lineno, 0, text)
  FFI::NCurses.wattroff(pad, @cp | att)
end