class MotionKit::WindowLayout
Public Instance Methods
add_child(subview, options={})
click to toggle source
# File lib/motion-kit-osx/helpers/nswindow_helpers.rb, line 22 def add_child(subview, options={}) if (sibling = options[:behind]) target.contentView.addSubview(subview, positioned: NSWindowBelow, relativeTo: sibling) elsif (sibling = options[:in_front_of]) target.contentView.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.contentView.addSubview(subview) end end
default_root()
click to toggle source
platform specific default root view
# File lib/motion-kit-osx/helpers/nswindow_helpers.rb, line 13 def default_root # child WindowLayout classes can return *their* NSView subclass from self.nsview_class view_class = self.class.targets || NSWindow view_class.alloc.initWithContentRect([[0, 0], [0, 0]], styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask, backing: NSBackingStoreBuffered, defer: false) end
remove_child(subview)
click to toggle source
# File lib/motion-kit-osx/helpers/nswindow_helpers.rb, line 34 def remove_child(subview) subview.removeFromSuperview end
window()
click to toggle source
A more sensible name for the window that is created.
# File lib/motion-kit-osx/helpers/nswindow_helpers.rb, line 8 def window self.view end