teacup 2.1.2 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- teacup (2.1.2)
4
+ teacup (2.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -107,7 +107,7 @@ Teacup.handler NSView, :frame do |target, frame|
107
107
  [Teacup::calculate(target, :width, frame[0]), Teacup::calculate(target, :height, frame[1])],
108
108
  [Teacup::calculate(target, :width, frame[2]), Teacup::calculate(target, :height, frame[3])]
109
109
  ]
110
- elsif (Array === frame && frame.length == 2) || NSRect === frame
110
+ elsif (Array === frame && frame.length == 2) || CGRect === frame
111
111
  frame = [
112
112
  [Teacup::calculate(target, :width, frame[0][0]), Teacup::calculate(target, :height, frame[0][1])],
113
113
  [Teacup::calculate(target, :width, frame[1][0]), Teacup::calculate(target, :height, frame[1][1])]
@@ -255,7 +255,8 @@ module Teacup
255
255
  def auto(layout_view=top_level_view, layout_subviews={}, &layout_block)
256
256
  raise "gem install 'motion-layout'" unless defined? Motion::Layout
257
257
 
258
- Teacup.get_styled_subviews(top_level_view).each do |view|
258
+ styled_subviews = top_level_view.subviews.select { |v| v.stylename }
259
+ styled_subviews.each do |view|
259
260
  if ! layout_subviews[view.stylename.to_s]
260
261
  layout_subviews[view.stylename.to_s] = view
261
262
  end
@@ -1,12 +1,6 @@
1
1
  module Teacup
2
2
  module_function
3
3
 
4
- # Returns all the subviews of `target` that have a stylename. `target` is not
5
- # included in the list. Used by the motion-layout integration in layout.rb.
6
- def get_styled_subviews(target)
7
- target.subviews.select { |v| v.stylename }
8
- end
9
-
10
4
  def to_instance(class_or_instance)
11
5
  if class_or_instance.is_a? Class
12
6
  return class_or_instance.new
@@ -1,5 +1,5 @@
1
1
  module Teacup
2
2
 
3
- VERSION = '2.1.2'
3
+ VERSION = '2.1.3'
4
4
 
5
5
  end
@@ -4,6 +4,7 @@ require File.expand_path('../lib/teacup/version.rb', __FILE__)
4
4
  Gem::Specification.new do |gem|
5
5
  gem.name = 'teacup'
6
6
  gem.version = Teacup::VERSION
7
+ gem.licenses = ['BSD']
7
8
 
8
9
  gem.authors = ['the rubymotion community']
9
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teacup
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-28 00:00:00.000000000 Z
12
+ date: 2013-07-29 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'Teacup is a community-driven DSL for making CSS-like styling, and
15
15
  layouts for
@@ -64,7 +64,6 @@ files:
64
64
  - lib/teacup-osx/core_extensions/ns_window.rb
65
65
  - lib/teacup-osx/core_extensions/ns_window_controller.rb
66
66
  - lib/teacup-osx/core_extensions/teacup_handlers.rb
67
- - lib/teacup-osx/core_extensions/z_core_extensions.rb
68
67
  - lib/teacup-osx/dummy.rb
69
68
  - lib/teacup-osx/handler.rb
70
69
  - lib/teacup-osx/style.rb
@@ -151,7 +150,8 @@ files:
151
150
  - spec/ios/view_spec.rb
152
151
  - teacup.gemspec
153
152
  homepage: https://github.com/rubymotion/teacup
154
- licenses: []
153
+ licenses:
154
+ - BSD
155
155
  post_install_message:
156
156
  rdoc_options: []
157
157
  require_paths:
@@ -1,131 +0,0 @@
1
- ##|
2
- ##| NSView.frame
3
- ##|
4
- Teacup.handler NSView, :left, :x do |target, x|
5
- f = target.frame
6
- f.origin.x = Teacup::calculate(target, :width, x)
7
- target.frame = f
8
- end
9
-
10
- Teacup.handler NSView, :right do |target, r|
11
- f = target.frame
12
- f.origin.x = Teacup::calculate(target, :width, r) - f.size.width
13
- target.frame = f
14
- end
15
-
16
- Teacup.handler NSView, :center_x, :middle_x do |target, x|
17
- c = target.center
18
- c.x = Teacup::calculate(target, :width, x)
19
- target.center = c
20
- end
21
-
22
- Teacup.handler NSView, :top, :y do |target, y|
23
- f = target.frame
24
- f.origin.y = Teacup::calculate(target, :height, y)
25
- target.frame = f
26
- end
27
-
28
- Teacup.handler NSView, :bottom do |target, b|
29
- f = target.frame
30
- f.origin.y = Teacup::calculate(target, :height, b) - f.size.height
31
- target.frame = f
32
- end
33
-
34
- Teacup.handler NSView, :center_y, :middle_y do |target, y|
35
- c = target.center
36
- c.y = Teacup::calculate(target, :height, y)
37
- target.center = c
38
- end
39
-
40
- Teacup.handler NSView, :width do |target, w|
41
- f = target.frame
42
- f.size.width = Teacup::calculate(target, :width, w)
43
- target.frame = f
44
- end
45
-
46
- Teacup.handler NSView, :height do |target, h|
47
- f = target.frame
48
- f.size.height = Teacup::calculate(target, :height, h)
49
- target.frame = f
50
- end
51
-
52
- Teacup.handler NSView, :size do |target, size|
53
- f = target.frame
54
- size_x = Teacup::calculate(target, :width, size[0])
55
- size_y = Teacup::calculate(target, :height, size[1])
56
- f.size = [size_x, size_y]
57
- target.frame = f
58
- end
59
-
60
- Teacup.handler NSView, :origin do |target, origin|
61
- f = target.frame
62
- origin_x = Teacup::calculate(target, :width, origin[0])
63
- origin_y = Teacup::calculate(target, :height, origin[1])
64
- f.origin = [origin_x, origin_y]
65
- target.frame = f
66
- end
67
-
68
- Teacup.handler NSView, :center do |target, center|
69
- center_x = Teacup::calculate(target, :width, center[0])
70
- center_y = Teacup::calculate(target, :height, center[1])
71
- target.center = [center_x, center_y]
72
- end
73
-
74
- Teacup.handler NSView, :size do |target, size|
75
- # odd... if I changed these to .is_a?, weird errors happen. Use ===
76
- if Symbol === size && size == :full
77
- if target.superview
78
- size = target.superview.bounds.size
79
- else
80
- size = target.frame.size
81
- end
82
- elsif Array === size
83
- size = [Teacup::calculate(target, :width, size[0]), Teacup::calculate(target, :height, size[1])]
84
- end
85
- f = target.frame
86
- f.size = size
87
- target.frame = f
88
- end
89
-
90
- Teacup.handler NSView, :frame do |target, frame|
91
- # odd... if I changed these to .is_a?, weird errors happen. Use ===
92
- if Symbol === frame && frame == :full
93
- if target.superview
94
- frame = target.superview.bounds
95
- else
96
- frame = target.frame
97
- end
98
- elsif Array === frame && frame.length == 4
99
- frame = [
100
- [Teacup::calculate(target, :width, frame[0]), Teacup::calculate(target, :height, frame[1])],
101
- [Teacup::calculate(target, :width, frame[2]), Teacup::calculate(target, :height, frame[3])]
102
- ]
103
- elsif (Array === frame && frame.length == 2) || NSRect === frame
104
- frame = [
105
- [Teacup::calculate(target, :width, frame[0][0]), Teacup::calculate(target, :height, frame[0][1])],
106
- [Teacup::calculate(target, :width, frame[1][0]), Teacup::calculate(target, :height, frame[1][1])]
107
- ]
108
- end
109
- target.frame = frame
110
- end
111
-
112
- Teacup.handler NSView, :gradient do |target, gradient|
113
- gradient_layer = target.instance_variable_get(:@teacup_gradient_layer) || begin
114
- gradient_layer = CAGradientLayer.layer
115
- gradient_layer.frame = target.bounds
116
- target.layer.insertSublayer(gradient_layer, atIndex:0)
117
- gradient_layer
118
- end
119
-
120
- gradient.each do |key, value|
121
- case key.to_s
122
- when 'colors'
123
- colors = [value].flatten.collect { |color| color.is_a?(UIColor) ? color.CGColor : color }
124
- gradient_layer.colors = colors
125
- else
126
- gradient_layer.send("#{key}=", value)
127
- end
128
- end
129
-
130
- target.instance_variable_set(:@teacup_gradient_layer, gradient_layer)
131
- end