Class: MotionKit::WindowLayout

Inherits:
TreeLayout show all
Defined in:
lib/motion-kit-osx/helpers/nswindow_helpers.rb

Direct Known Subclasses

NSWindowHelpers

Instance Attribute Summary

Attributes inherited from BaseLayout

#parent

Instance Method Summary collapse

Methods inherited from TreeLayout

#add, #all, #all_views, #build, #built?, #child_layouts, #create, #create_default_root_context, #first, #forget, #get, #get_view, #initial, #initial?, #initialize, #last, #last_view, #name_element, #nearest, #next, #nth, #nth_view, #prev, #reapply, #reapply!, #reapply?, #remove, #root, view, #view

Methods inherited from BaseLayout

#add_deferred_block, #apply, #apply_with_context, #apply_with_target, #context, #deferred, #deferred_blocks, delegate_method_fix, #has_context?, #initialize, #ipad?, #iphone35?, #iphone4?, #iphone?, #is_parent_layout?, #method_missing, #objc_version, #orientation?, #parent_layout, #retina?, #ruby_version, #run_deferred, #set_parent_layout, #target, #v

Methods included from BaseLayoutClassMethods

#layout_for, #memoize, #target_klasses, #targets

Constructor Details

This class inherits a constructor from MotionKit::TreeLayout

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MotionKit::BaseLayout

Instance Method Details

#add_child(subview) ⇒ Object



22
23
24
# File 'lib/motion-kit-osx/helpers/nswindow_helpers.rb', line 22

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

#default_rootObject

platform specific default root view



13
14
15
16
17
18
19
20
# 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) ⇒ Object



26
27
28
# File 'lib/motion-kit-osx/helpers/nswindow_helpers.rb', line 26

def remove_child(subview)
  subview.removeFromSuperview
end

#windowObject

A more sensible name for the window that is created.



8
9
10
# File 'lib/motion-kit-osx/helpers/nswindow_helpers.rb', line 8

def window
  self.view
end