Sha256: 6cad008f37d5b485c3727c742e6dad0aa6d1e409536f57b3ab99f6776b7ae2f1

Contents?: true

Size: 946 Bytes

Versions: 14

Compression:

Stored size: 946 Bytes

Contents

# @provides MotionKit::WindowLayout
# @provides MotionKit::NSWindowHelpers
# @requires MotionKit::TreeLayout
module MotionKit
  class WindowLayout < TreeLayout

    # A more sensible name for the window that is created.
    def window
      self.view
    end

    # platform specific default root view
    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

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

    def remove_child(subview)
      subview.removeFromSuperview
    end

  end

  class NSWindowHelpers < WindowLayout
    targets NSWindow
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
motion-kit-1.1.0 lib/motion-kit-osx/helpers/nswindow_helpers.rb
motion-kit-1.0.3 lib/motion-kit-osx/helpers/nswindow_helpers.rb
motion-kit-1.0.2 lib/motion-kit-osx/helpers/nswindow_helpers.rb
motion-kit-1.0.1 lib/motion-kit-osx/helpers/nswindow_helpers.rb
motion-kit-1.0.0 lib/motion-kit-osx/helpers/nswindow_helpers.rb
motion-kit-0.18.0 lib/motion-kit-osx/helpers/nswindow_helpers.rb
motion-kit-0.17.0 lib/motion-kit-osx/helpers/nswindow_helpers.rb
motion-kit-0.16.0 lib/motion-kit-osx/helpers/nswindow_helpers.rb
motion-kit-0.15.0 lib/motion-kit-osx/helpers/nswindow_helpers.rb
motion-kit-0.14.2 lib/motion-kit-osx/helpers/nswindow_helpers.rb
motion-kit-0.14.1 lib/motion-kit-osx/helpers/nswindow_helpers.rb
motion-kit-0.14.0 lib/motion-kit-osx/helpers/nswindow_helpers.rb
motion-kit-0.13.0 lib/motion-kit-osx/helpers/nswindow_helpers.rb
motion-kit-0.12.0 lib/motion-kit-osx/layouts/nswindow_helpers.rb