Class: NSWindow
- Inherits:
-
Object
- Object
- NSWindow
- Includes:
- Teacup::Layout, Teacup::View
- Defined in:
- lib/teacup-osx/core_extensions/ns_window.rb
Overview
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 Attribute Summary collapse
-
.teacup_is_animating ⇒ Object
readonly
Returns the value of attribute teacup_is_animating.
Attributes included from Teacup::View
#debug, #style_classes, #stylename, #teacup_next_responder
Instance Method Summary collapse
- #apply_style_properties(properties) ⇒ Object
- #style(properties) ⇒ Object
- #teacup_animation(options) ⇒ Object
- #top_level_view ⇒ Object
Methods included from Teacup::View
#_teacup_check_stylename, #add_style_class, #add_uniq_constraints, #animate_to_style, #animate_to_stylename, #animate_to_styles, #apply_constraints, #apply_stylename, #get_ns_constraints, #remove_style_class, #restyle!, #stylesheet, #stylesheet=, #viewWithStylename, #viewsWithStylename
Methods included from Teacup::Layout
#auto, included, #layout, #stylesheet, #stylesheet=, #subview
Class Attribute Details
.teacup_is_animating ⇒ Object (readonly)
Returns the value of attribute teacup_is_animating.
11 12 13 |
# File 'lib/teacup-osx/core_extensions/ns_window.rb', line 11 def teacup_is_animating @teacup_is_animating end |
Instance Method Details
#apply_style_properties(properties) ⇒ Object
24 25 26 |
# File 'lib/teacup-osx/core_extensions/ns_window.rb', line 24 def apply_style_properties(properties) Teacup.apply_hash((NSWindow.teacup_is_animating ? self.animator : self), properties) end |
#style(properties) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/teacup-osx/core_extensions/ns_window.rb', line 28 def style(properties) super self.setNeedsDisplay(true) self.setNeedsLayout(true) end |
#teacup_animation(options) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/teacup-osx/core_extensions/ns_window.rb', line 14 def teacup_animation() NSAnimationContext.beginGrouping NSAnimationContext.currentContext.setDuration([:duration]) if .key?(:duration) NSAnimationContext.currentContext.setTimingFunction([:timing]) if .key?(:timing) NSWindow.teacup_is_animating = true yield NSWindow.teacup_is_animating = false NSAnimationContext.endGrouping end |
#top_level_view ⇒ Object
35 36 37 |
# File 'lib/teacup-osx/core_extensions/ns_window.rb', line 35 def top_level_view contentView end |