Sha256: 4dda3f6f81c8909c21eb62a6f518d496bfa224611cd2d6299e9bf1326e4ddb5a
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
# @provides MotionKit::Layout # @provides MotionKit::NSViewHelpers # @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, options={}) if (sibling = options[:behind]) target.addSubview(subview, positioned: NSWindowBelow, relativeTo: sibling) elsif (sibling = options[:in_front_of]) target.addSubview(subview, positioned: NSWindowAbove, relativeTo: sibling) elsif (z_index = options[:z_index]) NSLog('Warning! :z_index option not supported in OS X when adding a child view') else target.addSubview(subview) end end def remove_child(subview) subview.removeFromSuperview end end class NSViewHelpers < Layout targets NSView end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
motion-kit-1.1.1 | lib/motion-kit-osx/helpers/nsview_helpers.rb |