Sha256: 0cc2109fc1631e3722366b354a107a556b912cf863c2231fd6809418c6221b92

Contents?: true

Size: 1.18 KB

Versions: 5

Compression:

Stored size: 1.18 KB

Contents

module Vedeu

  # Repository for storing, retrieving and manipulating the cursor position and
  # visibility for an interface.
  #
  # @api private
  module Cursors

    include Repository
    include Positional
    extend self

    # System events which when called will update the cursor visibility
    # accordingly for the interface in focus.
    Vedeu.event(:_cursor_hide_) { Cursors.hide }
    Vedeu.event(:_cursor_show_) { Cursors.show }

    # Make the cursor of this interface invisible.
    #
    # @return [Cursor]
    def hide
      find_or_create(Focus.current).hide
    end

    # Make the cursor of this interface visible.
    #
    # @return [Cursor]
    def show
      find_or_create(Focus.current).show
    end

    private

    # @return [Class]
    def entity
      Cursor
    end

    # Returns an empty collection ready for the storing of cursors by name with
    # current attributes.
    #
    # @example
    #   { 'holmium' => {
    #                    name:     'holmium',
    #                    state:    :show,
    #                    x:        1,
    #                    y:        1 } }
    #
    # @return [Hash]
    def in_memory
      {}
    end

  end # Cursors

end # Vedeu

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.2.10 lib/vedeu/repositories/cursors.rb
vedeu-0.2.9 lib/vedeu/repositories/cursors.rb
vedeu-0.2.8 lib/vedeu/repositories/cursors.rb
vedeu-0.2.7 lib/vedeu/repositories/cursors.rb
vedeu-0.2.6 lib/vedeu/repositories/cursors.rb