Sha256: 5f1aa9fcf01c9bcdd50055cb7ca8d112d0d25d6f0d3542d40de0b0b5715fb10d

Contents?: true

Size: 634 Bytes

Versions: 4

Compression:

Stored size: 634 Bytes

Contents

module Daigaku
  module Views
    class TopBar
      include Curses

      HEIGHT = 4

      attr_reader :height, :width, :panel

      def initialize(window, text = '')
        @height = HEIGHT
        @width  = window.maxx
        @panel  = create_panel(window, @width, @height, text)
      end

      def show
        @panel.refresh
      end

      private

      def create_panel(window, width, height, text)
        panel = window.subwin(height, width, 0, 0)

        panel.setpos(1, 1)
        panel.print_markdown(text)
        panel.setpos(2, 1)
        panel.clear_line(text: '_')

        panel
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
daigaku-1.0.0 lib/daigaku/views/top_bar.rb
daigaku-0.6.0 lib/daigaku/views/top_bar.rb
daigaku-0.5.0 lib/daigaku/views/top_bar.rb
daigaku-0.4.0 lib/daigaku/views/top_bar.rb