Class: Ruvi::Ruler

Inherits:
Widget show all
Defined in:
lib/widgets.rb

Instance Attribute Summary

Attributes inherited from Widget

#buffer, #cursor, #parent

Instance Method Summary collapse

Methods inherited from Widget

#initialize

Constructor Details

This class inherits a constructor from Ruvi::Widget

Instance Method Details

#canvasObject



175
176
177
# File 'lib/widgets.rb', line 175

def canvas
    Curses.begin_draw WinDescs::instance.descs[self]
end

#heightObject



179
# File 'lib/widgets.rb', line 179

def height; nil; end

#render(y) ⇒ Object



183
184
185
186
187
188
189
190
# File 'lib/widgets.rb', line 183

def render y
    screen = canvas
    screen.setpos y, 0 # y, x
    screen.set_attr true, Curses::COLOR_WHITE, Curses::COLOR_BLACK
    valid_line = (@buffer.top + y) < @buffer.lines.length
    str = valid_line ? "#{@buffer.top + y}" : ""
    screen.addstr str.rjust(screen.maxx - 2)
end

#watch_bufferObject



180
181
182
# File 'lib/widgets.rb', line 180

def watch_buffer
    @buffer
end

#widthObject



178
# File 'lib/widgets.rb', line 178

def width;  10;  end