Sha256: 24766898973a98baa74b488533f0fd1e2908fd2a5cdf1cce4a07e41c13cc97cf

Contents?: true

Size: 635 Bytes

Versions: 3

Compression:

Stored size: 635 Bytes

Contents

# @provides MotionKit::Layout
# @provides MotionKit::NSViewLayout
# @requires MotionKit::TreeLayout
module MotionKit
  class Layout < TreeLayout

    # platform specific default root view
    def default_root
      # child Layout classes will return *their* NSView subclass from self.targets
      view_class = self.class.targets || MotionKit.default_view_class
      view_class.alloc.initWithFrame([[0, 0], [0, 0]])
    end

    def add_child(subview)
      target.addSubview(subview)
    end

    def remove_child(subview)
      subview.removeFromSuperview
    end

  end

  class NSViewLayout < Layout
    targets NSView
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
motion-kit-0.11.2 lib/motion-kit-osx/layouts/nsview_layout.rb
motion-kit-0.11.1 lib/motion-kit-osx/layouts/nsview_layout.rb
motion-kit-0.11.0 lib/motion-kit-osx/layouts/nsview_layout.rb