Sha256: c2024294fc49df5cbb5accd2e4f47cec8673e97a3e83d1853e03195f00ac2050

Contents?: true

Size: 727 Bytes

Versions: 1

Compression:

Stored size: 727 Bytes

Contents

module Belajar
  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

1 entries across 1 versions & 1 rubygems

Version Path
belajar-0.1.1 lib/belajar/views/top_bar.rb