Sha256: 99bdba407a8bd61bed440fec9acbdcd17442fb3266a5583d0c840f6fb7e0a773

Contents?: true

Size: 1.59 KB

Versions: 17

Compression:

Stored size: 1.59 KB

Contents

module Vedeu

  module Geometries

    # Allows the storing of interface/view geometry independent of the
    # interface instance.
    #
    class Repository < Vedeu::Repositories::Repository

      singleton_class.send(:alias_method, :geometries, :repository)

      null Vedeu::Geometries::Geometry, height: Vedeu.height, width: Vedeu.width
      real Vedeu::Geometries::Geometry

    end # Repository

  end # Geometries

  # Manipulate the repository of geometries.
  #
  # @example
  #   Vedeu.geometries
  #
  # @!method geometries
  # @return [Vedeu::Geometries::Repository]
  def_delegators Vedeu::Geometries::Repository,
                 :geometries

  # :nocov:

  # See {file:docs/events/view.md#\_maximise_}
  Vedeu.bind(:_maximise_) do |name|
    Vedeu.geometries.by_name(name).maximise
  end

  # See {file:docs/events/view.md#\_movement_refresh_}
  Vedeu.bind(:_movement_refresh_) do |name|
    Vedeu.trigger(:_clear_)
    Vedeu.trigger(:_refresh_)
    Vedeu.trigger(:_clear_view_, name)
    Vedeu.trigger(:_refresh_view_, name)
  end

  # See {file:docs/events/view.md#\_unmaximise_}
  Vedeu.bind(:_unmaximise_) do |name|
    Vedeu.geometries.by_name(name).unmaximise
  end

  [:down, :left, :right, :up].each do |direction|
    Vedeu.bind(:"_view_#{direction}_") do |name, offset|
      Vedeu::Geometries::Move.move(direction: direction,
                                   name:      name,
                                   offset:    offset)
    end
  end

  [:down, :left, :right, :up].each do |direction|
    Vedeu.bind_alias(:"_geometry_#{direction}_", :"_view_#{direction}_")
  end

  # :nocov:

end # Vedeu

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
vedeu-0.8.0 lib/vedeu/geometries/repository.rb
vedeu-0.7.4 lib/vedeu/geometries/repository.rb
vedeu-0.7.3 lib/vedeu/geometries/repository.rb
vedeu-0.7.2 lib/vedeu/geometries/repository.rb
vedeu-0.7.1 lib/vedeu/geometries/repository.rb
vedeu-0.7.0 lib/vedeu/geometries/repository.rb
vedeu-0.6.71 lib/vedeu/geometries/repository.rb
vedeu-0.6.70 lib/vedeu/geometries/repository.rb
vedeu-0.6.69 lib/vedeu/geometries/repository.rb
vedeu-0.6.68 lib/vedeu/geometries/repository.rb
vedeu-0.6.67 lib/vedeu/geometries/repository.rb
vedeu-0.6.66 lib/vedeu/geometries/repository.rb
vedeu-0.6.65 lib/vedeu/geometries/repository.rb
vedeu-0.6.64 lib/vedeu/geometries/repository.rb
vedeu-0.6.63 lib/vedeu/geometries/repository.rb
vedeu-0.6.62 lib/vedeu/geometries/repository.rb
vedeu-0.6.61 lib/vedeu/geometries/repository.rb