module Canis::BorderTitle
Public Instance Methods
bordertitle_init()
click to toggle source
# File lib/canis/core/include/bordertitle.rb, line 10 def bordertitle_init @_bordertitle_init_called = true @row_offset = @col_offset = 0 if @suppress_borders @internal_width = 1 if @suppress_borders # the other programs have zero not 1 NOTE end
print_borders()
click to toggle source
why the dash does it reduce height by one.
# File lib/canis/core/include/bordertitle.rb, line 16 def print_borders bordertitle_init unless @_bordertitle_init_called raise ArgumentError, "Graphic not set" unless @graphic raise "#{self} needs width" unless @width raise "#{self} needs height" unless @height width = @width height = @height-1 window = @graphic startcol = @col startrow = @row @color_pair = get_color($datacolor) bordercolor = @border_color || @color_pair borderatt = @border_attrib || Ncurses::A_NORMAL window.print_border startrow, startcol, height, width, bordercolor, borderatt print_title end
print_title()
click to toggle source
# File lib/canis/core/include/bordertitle.rb, line 32 def print_title bordertitle_init unless @_bordertitle_init_called return unless @title raise "#{self} needs width" unless @width # removed || since this can change after first invocation and should be recalculated. @color_pair = get_color($datacolor) #$log.debug " print_title #{@row}, #{@col}, #{@width} " # check title.length and truncate if exceeds width _title = @title if @title.length > @width - 2 _title = @title[0..@width-2] end @graphic.printstring( @row, @col+(@width-_title.length)/2, _title, @color_pair, @title_attrib) unless @title.nil? end