class NSView

Teacup's NSView extensions defines some utility functions for NSView that enable a lot of the magic for Teacup::Layout.

Users of teacup should be able to ignore the contents of this file for the most part.

Attributes

teacup_is_animating[R]

Public Instance Methods

apply_style_properties(properties) click to toggle source
# File lib/teacup-osx/core_extensions/ns_view.rb, line 24
def apply_style_properties(properties)
  Teacup.apply_hash((NSView.teacup_is_animating ? self.animator : self), properties)
end
style(properties) click to toggle source
Calls superclass method Teacup::View#style
# File lib/teacup-osx/core_extensions/ns_view.rb, line 28
def style(properties)
  super

  self.setNeedsDisplay(true)
  self.setNeedsLayout(true)
end
teacup_animation(options) { || ... } click to toggle source
# File lib/teacup-osx/core_extensions/ns_view.rb, line 14
def teacup_animation(options)
  NSAnimationContext.beginGrouping
  NSAnimationContext.currentContext.setDuration(options[:duration]) if options.key?(:duration)
  NSAnimationContext.currentContext.setTimingFunction(options[:timing]) if options.key?(:timing)
  NSView.teacup_is_animating = true
  yield
  NSView.teacup_is_animating = false
  NSAnimationContext.endGrouping
end
top_level_view() click to toggle source
# File lib/teacup-osx/core_extensions/ns_view.rb, line 35
def top_level_view
  self
end