Sha256: c18d48c7fcb8b72a8f9bf078e1ac5ce7a10632b1e47a73999c5b197d0f448593

Contents?: true

Size: 1 KB

Versions: 28

Compression:

Stored size: 1 KB

Contents

# Teacup's NSWindow extensions defines some utility functions for NSWindow 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.
class NSWindow
  include Teacup::Layout
  include Teacup::View

  class << NSWindow
    attr :teacup_is_animating
  end

  def teacup_animation(options)
    NSAnimationContext.beginGrouping
    NSAnimationContext.currentContext.setDuration(options[:duration]) if options.key?(:duration)
    NSAnimationContext.currentContext.setTimingFunction(options[:timing]) if options.key?(:timing)
    NSWindow.teacup_is_animating = true
    yield
    NSWindow.teacup_is_animating = false
    NSAnimationContext.endGrouping
  end

  def apply_style_properties(properties)
    Teacup.apply_hash((NSWindow.teacup_is_animating ? self.animator : self), properties)
  end

  def style(properties)
    super

    self.setNeedsDisplay(true)
    self.setNeedsLayout(true)
  end

  def top_level_view
    contentView
  end

end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
teacup-3.0.1 lib/teacup-osx/core_extensions/ns_window.rb
teacup-3.0.0 lib/teacup-osx/core_extensions/ns_window.rb
teacup-2.3.0 lib/teacup-osx/core_extensions/ns_window.rb
teacup-2.2.2 lib/teacup-osx/core_extensions/ns_window.rb
teacup-2.2.0 lib/teacup-osx/core_extensions/ns_window.rb
teacup-2.1.16 lib/teacup-osx/core_extensions/ns_window.rb
teacup-2.1.15 lib/teacup-osx/core_extensions/ns_window.rb
teacup-2.1.14 lib/teacup-osx/core_extensions/ns_window.rb
teacup-2.1.13 lib/teacup-osx/core_extensions/ns_window.rb
teacup-2.1.12 lib/teacup-osx/core_extensions/ns_window.rb
teacup-2.1.11 lib/teacup-osx/core_extensions/ns_window.rb
teacup-2.1.10 lib/teacup-osx/core_extensions/ns_window.rb
teacup-2.1.9 lib/teacup-osx/core_extensions/ns_window.rb
teacup-2.1.8 lib/teacup-osx/core_extensions/ns_window.rb
teacup-2.1.7 lib/teacup-osx/core_extensions/ns_window.rb
teacup-2.1.6 lib/teacup-osx/core_extensions/ns_window.rb
teacup-2.1.5 lib/teacup-osx/core_extensions/ns_window.rb
teacup-2.1.4 lib/teacup-osx/core_extensions/ns_window.rb
teacup-2.1.3 lib/teacup-osx/core_extensions/ns_window.rb
teacup-2.1.2 lib/teacup-osx/core_extensions/ns_window.rb