Method: Curses::Window#set_title
- Defined in:
-
lib/curses_extensions.rb,
lib/curses_color.rb
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/curses_extensions.rb', line 139 def set_title(title, align = :center) return if width <= 6 # too small to show title orig_cur = {:x => curx, :y => cury} # shrink title title = title[0...(width-6)] if (title.size + 6) > width case(align) when :left setpos(0, 2) when :right setpos(0, width - title.size - 4) else # :center setpos(0, (width - title.size) / 2 - 1) end addstr(" #{title} ") setpos(orig_cur[:y], orig_cur[:x]) end |