Sha256: a52aa3bd46ad4a0b9b2bf785bd5c5e3eb1f996489d642e6b7feddd36cf874764

Contents?: true

Size: 705 Bytes

Versions: 14

Compression:

Stored size: 705 Bytes

Contents

# @requires MotionKit::NSViewLayout
module MotionKit
  class NSViewLayout

    def constraints(view=nil, &block)
      view ||= target
      if view.is_a?(Symbol)
        view = self.get(view)
      end
      view.setTranslatesAutoresizingMaskIntoConstraints(false)

      deferred do
        constraints_target = ConstraintsTarget.new(view)
        context(constraints_target, &block)
        constraints_target.apply_all_constraints(self, view)
      end
    end

  end

  class Layout

    def constraints(view=nil, &block)
      if @context
        apply(:constraints, view, &block)
      else
        context(self.view) do
          constraints(view, &block)
        end
      end
    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
motion-kit-0.10.7 lib/motion-kit-osx/layouts/nsview_layout_constraints.rb
motion-kit-0.10.6 lib/motion-kit-osx/layouts/nsview_layout_constraints.rb
motion-kit-0.10.5 lib/motion-kit-osx/layouts/nsview_layout_constraints.rb
motion-kit-0.10.4 lib/motion-kit-osx/layouts/nsview_layout_constraints.rb
motion-kit-0.10.3 lib/motion-kit-osx/layouts/nsview_layout_constraints.rb
motion-kit-0.10.2 lib/motion-kit-osx/layouts/nsview_layout_constraints.rb
motion-kit-0.10.1 lib/motion-kit-osx/layouts/nsview_layout_constraints.rb
motion-kit-0.10.0 lib/motion-kit-osx/layouts/nsview_layout_constraints.rb
motion-kit-0.9.6 lib/motion-kit-osx/layouts/nsview_layout_constraints.rb
motion-kit-0.9.4 lib/motion-kit-osx/layouts/nsview_layout_constraints.rb
motion-kit-0.9.3 lib/motion-kit-osx/layouts/nsview_layout_constraints.rb
motion-kit-0.9.2 lib/motion-kit-osx/layouts/nsview_layout_constraints.rb
motion-kit-0.9.1 lib/motion-kit-osx/layouts/nsview_layout_constraints.rb
motion-kit-0.9.0 lib/motion-kit-osx/layouts/nsview_layout_constraints.rb