Sha256: 137e351d82a3e20d7dde15a86d11e4b67d90a44bf6baf8e8d514ff3be442d6d9

Contents?: true

Size: 727 Bytes

Versions: 4

Compression:

Stored size: 727 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, window.maxx, 0, 0)

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

        panel
      end

      def emphasized(panel, text)
        panel.write(text, Window::COLOR_2)
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
daigaku-0.3.0 lib/daigaku/views/top_bar.rb
daigaku-0.2.0 lib/daigaku/views/top_bar.rb
daigaku-0.1.1 lib/daigaku/views/top_bar.rb
daigaku-0.1.0 lib/daigaku/views/top_bar.rb