motion-kit 0.10.11 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +92 -2
  3. data/lib/motion-kit/calculator/calculate.rb +1 -1
  4. data/lib/motion-kit/calculator/view_calculator.rb +5 -5
  5. data/lib/motion-kit/layouts/base_layout.rb +21 -15
  6. data/lib/motion-kit/layouts/base_layout_class_methods.rb +2 -7
  7. data/lib/motion-kit/layouts/tree_layout.rb +141 -106
  8. data/lib/motion-kit/object.rb +0 -9
  9. data/lib/motion-kit/version.rb +1 -1
  10. data/lib/motion-kit-cocoa/constraints/constraint.rb +11 -12
  11. data/lib/motion-kit-cocoa/constraints/constraint_placeholder.rb +3 -3
  12. data/lib/motion-kit-cocoa/constraints/constraints_layout.rb +103 -58
  13. data/lib/motion-kit-ios/layouts/constraints_layout.rb +4 -2
  14. data/lib/motion-kit-ios/layouts/uiview_layout.rb +0 -17
  15. data/lib/motion-kit-ios/layouts/uiview_layout_constraints.rb +10 -10
  16. data/lib/motion-kit-ios/layouts/uiview_layout_frame.rb +1 -1
  17. data/lib/motion-kit-osx/layouts/constraints_layout.rb +18 -16
  18. data/lib/motion-kit-osx/layouts/nstableview_layout.rb +13 -0
  19. data/lib/motion-kit-osx/layouts/nsview_layout.rb +0 -19
  20. data/lib/motion-kit-osx/layouts/nsview_layout_constraints.rb +10 -10
  21. data/lib/motion-kit-osx/layouts/nsview_layout_frame.rb +1 -1
  22. data/lib/motion-kit-osx/layouts/nswindow_layout.rb +0 -49
  23. data/spec/ios/apply_styles_spec.rb +27 -12
  24. data/spec/ios/calayer_spec.rb +9 -0
  25. data/spec/ios/child_layouts_spec.rb +53 -0
  26. data/spec/ios/constraints_helpers/scale_constraints_spec.rb +62 -0
  27. data/spec/ios/create_layout_spec.rb +1 -1
  28. data/spec/ios/custom_root_layout_spec.rb +1 -1
  29. data/spec/ios/frame_helper_spec.rb +2 -2
  30. data/spec/ios/layout_spec.rb +3 -20
  31. data/spec/ios/layout_state_spec.rb +1 -1
  32. data/spec/ios/motionkit_util_spec.rb +0 -87
  33. data/spec/ios/reapply_frame.rb +0 -2
  34. data/spec/ios/relative_layout.spec.rb +2 -2
  35. data/spec/ios/remove_layout_spec.rb +2 -3
  36. data/spec/ios/view_attr_spec.rb +7 -0
  37. data/spec/osx/constraints_helpers/table_view_spec.rb +34 -0
  38. data/spec/osx/custom_root_layout_spec.rb +1 -1
  39. data/spec/osx/frame_helper_spec.rb +2 -2
  40. metadata +10 -3
  41. data/lib/motion-kit-cocoa/cocoa_util.rb +0 -59
@@ -74,7 +74,6 @@ module MotionKit
74
74
  def ==(compare)
75
75
  if @compare_flag
76
76
  equals(compare)
77
- @compare_flag = false
78
77
 
79
78
  self
80
79
  else
@@ -89,7 +88,6 @@ module MotionKit
89
88
  end
90
89
 
91
90
  gte(compare)
92
- @compare_flag = false
93
91
 
94
92
  self
95
93
  else
@@ -104,7 +102,6 @@ module MotionKit
104
102
  end
105
103
 
106
104
  lte(compare)
107
- @compare_flag = false
108
105
 
109
106
  self
110
107
  else
@@ -279,23 +276,23 @@ module MotionKit
279
276
  def axis_lookup(axis)
280
277
  case axis
281
278
  when :horizontal
282
- axis = UILayoutConstraintAxisHorizontal
279
+ UILayoutConstraintAxisHorizontal
283
280
  when :vertical
284
- axis = UILayoutConstraintAxisVertical
281
+ UILayoutConstraintAxisVertical
282
+ else
283
+ axis
285
284
  end
286
-
287
- return axis
288
285
  end
289
286
 
290
287
  def orientation_lookup(orientation)
291
288
  case orientation
292
289
  when :horizontal
293
- orientation = NSLayoutConstraintOrientationHorizontal
290
+ NSLayoutConstraintOrientationHorizontal
294
291
  when :vertical
295
- orientation = NSLayoutConstraintOrientationVertical
292
+ NSLayoutConstraintOrientationVertical
293
+ else
294
+ orientation
296
295
  end
297
-
298
- return orientation
299
296
  end
300
297
 
301
298
  def view_lookup(layout, view, target)
@@ -303,10 +300,12 @@ module MotionKit
303
300
  target
304
301
  elsif target.is_a?(ConstraintPlaceholder)
305
302
  target.resolve(layout)
303
+ elsif target == :self
304
+ view
306
305
  elsif target == :superview
307
306
  view.superview
308
307
  else
309
- layout.get(target)
308
+ layout.get_view(target)
310
309
  end
311
310
  end
312
311
 
@@ -10,11 +10,11 @@ module MotionKit
10
10
  def resolve(layout)
11
11
  case @type
12
12
  when :first
13
- layout.get(@name)
13
+ layout.get_view(@name)
14
14
  when :last
15
- layout.last(@name)
15
+ layout.last_view(@name)
16
16
  when :nth
17
- layout.nth(@name, @value)
17
+ layout.nth_view(@name, @value)
18
18
  end
19
19
  end
20
20
 
@@ -22,134 +22,134 @@ module MotionKit
22
22
  ConstraintPlaceholder.new(:nth, name, value)
23
23
  end
24
24
 
25
- def x(value=nil)
26
- target_constraint(:left, :equal, value)
25
+ def x(value=nil, rel=:equal)
26
+ target_constraint(:left, rel, value)
27
27
  end
28
28
  alias left x
29
29
 
30
30
  def min_x(value=nil)
31
- target_constraint(:left, :gte, value)
31
+ x(value, :gte)
32
32
  end
33
33
  alias min_left min_x
34
34
 
35
35
  def max_x(value=nil)
36
- target_constraint(:left, :lte, value)
36
+ x(value, :lte)
37
37
  end
38
38
  alias max_left max_x
39
39
 
40
- def leading(value=nil)
41
- target_constraint(:leading, :equal, value)
40
+ def leading(value=nil, rel=:equal)
41
+ target_constraint(:leading, rel, value)
42
42
  end
43
43
 
44
44
  def min_leading(value=nil)
45
- target_constraint(:leading, :gte, value)
45
+ leading(value, :gte)
46
46
  end
47
47
 
48
48
  def max_leading(value=nil)
49
- target_constraint(:leading, :lte, value)
49
+ leading(value, :lte)
50
50
  end
51
51
 
52
- def center_x(value=nil)
53
- target_constraint(:center_x, :equal, value)
52
+ def center_x(value=nil, rel=:equal)
53
+ target_constraint(:center_x, rel, value)
54
54
  end
55
55
 
56
56
  def min_center_x(value=nil)
57
- target_constraint(:center_x, :gte, value)
57
+ center_x(value, :gte)
58
58
  end
59
59
 
60
60
  def max_center_x(value=nil)
61
- target_constraint(:center_x, :lte, value)
61
+ center_x(value, :lte)
62
62
  end
63
63
 
64
- def right(value=nil)
65
- target_constraint(:right, :equal, value)
64
+ def right(value=nil, rel=:equal)
65
+ target_constraint(:right, rel, value)
66
66
  end
67
67
 
68
68
  def min_right(value=nil)
69
- target_constraint(:right, :gte, value)
69
+ right(value, :gte)
70
70
  end
71
71
 
72
72
  def max_right(value=nil)
73
- target_constraint(:right, :lte, value)
73
+ right(value, :lte)
74
74
  end
75
75
 
76
- def trailing(value=nil)
77
- target_constraint(:trailing, :equal, value)
76
+ def trailing(value=nil, rel=:equal)
77
+ target_constraint(:trailing, rel, value)
78
78
  end
79
79
 
80
80
  def min_trailing(value=nil)
81
- target_constraint(:trailing, :gte, value)
81
+ trailing(value, :gte)
82
82
  end
83
83
 
84
84
  def max_trailing(value=nil)
85
- target_constraint(:trailing, :lte, value)
85
+ trailing(value, :lte)
86
86
  end
87
87
 
88
- def y(value=nil)
89
- target_constraint(:top, :equal, value)
88
+ def y(value=nil, rel=:equal)
89
+ target_constraint(:top, rel, value)
90
90
  end
91
91
  alias top y
92
92
 
93
93
  def min_y(value=nil)
94
- target_constraint(:top, :gte, value)
94
+ y(value, :gte)
95
95
  end
96
96
  alias min_top min_y
97
97
 
98
98
  def max_y(value=nil)
99
- target_constraint(:top, :lte, value)
99
+ y(value, :lte)
100
100
  end
101
101
  alias max_top max_y
102
102
 
103
- def center_y(value=nil)
104
- target_constraint(:center_y, :equal, value)
103
+ def center_y(value=nil, rel=:equal)
104
+ target_constraint(:center_y, rel, value)
105
105
  end
106
106
 
107
107
  def min_center_y(value=nil)
108
- target_constraint(:center_y, :gte, value)
108
+ center_y(value, :gte)
109
109
  end
110
110
 
111
111
  def max_center_y(value=nil)
112
- target_constraint(:center_y, :lte, value)
112
+ center_y(value, :lte)
113
113
  end
114
114
 
115
- def bottom(value=nil)
116
- target_constraint(:bottom, :equal, value)
115
+ def bottom(value=nil, rel=:equal)
116
+ target_constraint(:bottom, rel, value)
117
117
  end
118
118
 
119
119
  def min_bottom(value=nil)
120
- target_constraint(:bottom, :gte, value)
120
+ bottom(value, :gte)
121
121
  end
122
122
 
123
123
  def max_bottom(value=nil)
124
- target_constraint(:bottom, :lte, value)
124
+ bottom(value, :lte)
125
125
  end
126
126
 
127
- def baseline(value=nil)
128
- target_constraint(:baseline, :equal, value)
127
+ def baseline(value=nil, rel=:equal)
128
+ target_constraint(:baseline, rel, value)
129
129
  end
130
130
 
131
131
  def min_baseline(value=nil)
132
- target_constraint(:baseline, :gte, value)
132
+ baseline(value, :gte)
133
133
  end
134
134
 
135
135
  def max_baseline(value=nil)
136
- target_constraint(:baseline, :lte, value)
136
+ baseline(value, :lte)
137
137
  end
138
138
 
139
- def width(value=nil)
140
- target_constraint(:width, :equal, value)
139
+ def width(value=nil, rel=:equal)
140
+ target_constraint(:width, rel, value)
141
141
  end
142
142
  alias w width
143
143
 
144
144
  def min_width(value=nil)
145
- target_constraint(:width, :gte, value)
145
+ width(value, :gte)
146
146
  end
147
147
 
148
148
  def max_width(value=nil)
149
- target_constraint(:width, :lte, value)
149
+ width(value, :lte)
150
150
  end
151
151
 
152
- def height(value=nil)
152
+ def height(value=nil, rel=:equal)
153
153
  target_constraint(:height, :equal, value)
154
154
  end
155
155
  alias h height
@@ -162,45 +162,79 @@ module MotionKit
162
162
  target_constraint(:height, :lte, value)
163
163
  end
164
164
 
165
- def size(value=nil)
166
- target_constraint(:size, :equal, value, SizeConstraint)
165
+ def size(value=nil, rel=:equal)
166
+ target_constraint(:size, rel, value, SizeConstraint)
167
167
  end
168
168
 
169
169
  def min_size(value=nil)
170
- target_constraint(:size, :gte, value, SizeConstraint)
170
+ size(value, :gte)
171
171
  end
172
172
 
173
173
  def max_size(value=nil)
174
- target_constraint(:size, :lte, value, SizeConstraint)
174
+ size(value, :lte)
175
175
  end
176
176
 
177
- def center(value=nil)
178
- target_constraint([:center_x, :center_y], :equal, value, PointConstraint)
177
+ def center(value=nil, rel=:equal)
178
+ target_constraint([:center_x, :center_y], rel, value, PointConstraint)
179
179
  end
180
180
 
181
181
  def min_center(value=nil)
182
- target_constraint([:center_x, :center_y], :gte, value, PointConstraint)
182
+ center(value, :gte)
183
183
  end
184
184
 
185
185
  def max_center(value=nil)
186
- target_constraint([:center_x, :center_y], :lte, value, PointConstraint)
186
+ center(value, :lte)
187
187
  end
188
188
 
189
- def top_left(value=nil)
190
- target_constraint([:left, :top], :equal, value, PointConstraint)
189
+ def top_left(value=nil, rel=:equal)
190
+ target_constraint([:left, :top], rel, value, PointConstraint)
191
191
  end
192
192
  alias origin top_left
193
193
 
194
- def top_right(value=nil)
195
- target_constraint([:right, :top], :equal, value, PointConstraint)
194
+ def min_top_left(value=nil)
195
+ top_left(value, :gte)
196
196
  end
197
+ alias min_origin min_top_left
197
198
 
198
- def bottom_left(value=nil)
199
- target_constraint([:left, :bottom], :equal, value, PointConstraint)
199
+ def max_top_left(value=nil)
200
+ top_left(value, :lte)
200
201
  end
202
+ alias max_origin max_top_left
201
203
 
202
- def bottom_right(value=nil)
203
- target_constraint([:right, :bottom], :equal, value, PointConstraint)
204
+ def top_right(value=nil, rel=:equal)
205
+ target_constraint([:right, :top], rel, value, PointConstraint)
206
+ end
207
+
208
+ def min_top_right(value=nil)
209
+ top_right(value, :gte)
210
+ end
211
+
212
+ def max_top_right(value=nil)
213
+ top_right(value, :lte)
214
+ end
215
+
216
+ def bottom_left(value=nil, rel=:equal)
217
+ target_constraint([:left, :bottom], rel, value, PointConstraint)
218
+ end
219
+
220
+ def min_bottom_left(value=nil)
221
+ bottom_left(value, :gte)
222
+ end
223
+
224
+ def max_bottom_left(value=nil)
225
+ bottom_left(value, :lte)
226
+ end
227
+
228
+ def bottom_right(value=nil, rel=:equal)
229
+ target_constraint([:right, :bottom], rel, value, PointConstraint)
230
+ end
231
+
232
+ def min_bottom_right(value=nil)
233
+ bottom_right(value, :gte)
234
+ end
235
+
236
+ def max_bottom_right(value=nil)
237
+ bottom_right(value, :lte)
204
238
  end
205
239
 
206
240
  def above(view)
@@ -242,7 +276,18 @@ module MotionKit
242
276
  def target_constraint(attribute, relationship, value=nil, constraint_class=nil)
243
277
  constraint_class ||= Constraint
244
278
  constraint = constraint_class.new(constraint_target.view, attribute, relationship)
245
- constraint.equals(value) if value
279
+ if value == :scale
280
+ size = ViewCalculator.intrinsic_size(constraint_target.view)
281
+ if attribute == :width
282
+ constraint.equals(:self, :height).times(size.width / size.height)
283
+ elsif attribute == :height
284
+ constraint.equals(:self, :width).times(size.height / size.width)
285
+ else
286
+ raise "Cannot apply :scale relationship to #{attribute}"
287
+ end
288
+ elsif value
289
+ constraint.equals(value)
290
+ end
246
291
  constraint_target.add_constraints([constraint])
247
292
  constraint
248
293
  end
@@ -1,9 +1,10 @@
1
- # @requires MotionKit::ConstraintsLayout
1
+ # @requires MotionKit::UIViewLayout
2
2
  module MotionKit
3
- class ConstraintsLayout
3
+ class UIViewLayout
4
4
 
5
5
  def content_compression_resistance_priority(value, for_axis: axis)
6
6
  axis = Constraint.axis_lookup(axis)
7
+ target.setContentCompressionResistancePriority(value, forAxis: axis)
7
8
  end
8
9
 
9
10
  def compression_priority(value, for_axis: axis)
@@ -12,6 +13,7 @@ module MotionKit
12
13
 
13
14
  def content_hugging_priority(value, for_axis: axis)
14
15
  axis = Constraint.axis_lookup(axis)
16
+ target.setContentHuggingPriority(value, forAxis: axis)
15
17
  end
16
18
 
17
19
  def hugging_priority(value, for_axis: axis)
@@ -19,23 +19,6 @@ module MotionKit
19
19
  subview.removeFromSuperview
20
20
  end
21
21
 
22
- # UIViews AND CALayers are updated
23
- def reapply!(root=nil)
24
- if root.is_a?(CALayer)
25
- @layout_state = :reapply
26
- MotionKit.find_all_layers(root) do |layer|
27
- call_style_method(layer, layer.motion_kit_id) if layer.motion_kit_id
28
- end
29
- @layout_state = :initial
30
- else
31
- root ||= self.view
32
- reapply!(root.layer)
33
- super(root)
34
- end
35
-
36
- return self
37
- end
38
-
39
22
  end
40
23
 
41
24
  class UIViewLayout < Layout
@@ -2,17 +2,17 @@
2
2
  module MotionKit
3
3
  class UIViewLayout
4
4
 
5
- def constraints(view=nil, &block)
6
- view ||= target
7
- if view.is_a?(Symbol)
8
- view = self.get(view)
5
+ def constraints(add_to_view=nil, &block)
6
+ add_to_view ||= target
7
+ if add_to_view.is_a?(Symbol)
8
+ add_to_view = self.get_view(add_to_view)
9
9
  end
10
- view.setTranslatesAutoresizingMaskIntoConstraints(false)
10
+ add_to_view.setTranslatesAutoresizingMaskIntoConstraints(false)
11
11
 
12
- constraints_target = ConstraintsTarget.new(view)
12
+ constraints_target = ConstraintsTarget.new(add_to_view)
13
13
  deferred(constraints_target) do
14
14
  context(constraints_target, &block)
15
- constraints_target.apply_all_constraints(self, view)
15
+ constraints_target.apply_all_constraints(self, add_to_view)
16
16
  end
17
17
  end
18
18
 
@@ -22,12 +22,12 @@ module MotionKit
22
22
 
23
23
  # Ensure we always have a context in this method; makes it easier to define
24
24
  # constraints in an `add_constraints` method.
25
- def constraints(view=nil, &block)
25
+ def constraints(add_to_view=nil, &block)
26
26
  if has_context?
27
- apply(:constraints, view, &block)
27
+ apply(:constraints, add_to_view, &block)
28
28
  else
29
29
  context(self.view) do
30
- constraints(view, &block)
30
+ constraints(add_to_view, &block)
31
31
  end
32
32
  end
33
33
  end
@@ -91,7 +91,7 @@ module MotionKit
91
91
 
92
92
  def _calculate_frame(f, from: from_view, relative_to: point)
93
93
  if from_view.is_a?(Symbol)
94
- from_view = self.get(from_view)
94
+ from_view = self.get_view(from_view)
95
95
  end
96
96
 
97
97
  from_view_size = from_view.frame.size
@@ -1,39 +1,41 @@
1
- # @requires MotionKit::ConstraintsLayout
1
+ # @requires MotionKit::NSViewLayout
2
2
  module MotionKit
3
- class ConstraintsLayout
3
+ class NSViewLayout
4
4
 
5
5
  def content_compression_resistance_priority(value, for_orientation: orientation)
6
6
  orientation = Constraint.orientation_lookup(orientation)
7
- end
8
-
9
- # consistency with iOS methods:
10
- def content_compression_resistance_priority(value, for_axis: orientation)
11
- content_compression_resistance_priority(value, for_orientation: orientation)
7
+ target.setContentCompressionResistancePriority(value, forOrientation: axis)
12
8
  end
13
9
 
14
10
  def compression_priority(value, for_orientation: orientation)
15
11
  content_compression_resistance_priority(value, for_orientation: orientation)
16
12
  end
17
13
 
18
- # consistency with iOS methods:
19
- def compression_priority(value, for_axis: orientation)
20
- content_compression_resistance_priority(value, for_orientation: orientation)
21
- end
22
-
23
14
  def content_hugging_priority(value, for_orientation: orientation)
24
15
  orientation = Constraint.orientation_lookup(orientation)
16
+ target.setContentHuggingPriority(value, forOrientation: axis)
25
17
  end
26
18
 
27
- # consistency with iOS methods:
28
- def content_hugging_priority(value, for_axis: orientation)
19
+ def hugging_priority(value, for_orientation: orientation)
29
20
  content_hugging_priority(value, for_orientation: orientation)
30
21
  end
31
22
 
32
- def hugging_priority(value, for_orientation: orientation)
23
+ ##|
24
+ ##| Aliases for consistency with iOS versions:
25
+ ##|
26
+
27
+ def content_compression_resistance_priority(value, for_axis: orientation)
28
+ content_compression_resistance_priority(value, for_orientation: orientation)
29
+ end
30
+
31
+ def compression_priority(value, for_axis: orientation)
32
+ content_compression_resistance_priority(value, for_orientation: orientation)
33
+ end
34
+
35
+ def content_hugging_priority(value, for_axis: orientation)
33
36
  content_hugging_priority(value, for_orientation: orientation)
34
37
  end
35
38
 
36
- # consistency with iOS methods:
37
39
  def hugging_priority(value, for_axis: orientation)
38
40
  content_hugging_priority(value, for_orientation: orientation)
39
41
  end
@@ -13,8 +13,21 @@ module MotionKit
13
13
  end
14
14
  target.addTableColumn(column)
15
15
  context(column, &block)
16
+
17
+ column
16
18
  end
17
19
  alias add_table_column add_column
18
20
 
21
+ def column(column_or_identifier, &block)
22
+ if column_or_identifier.is_a?(NSTableColumn)
23
+ column = column_or_identifier
24
+ else
25
+ column_index = target.columnWithIdentifier(column_or_identifier)
26
+ column = target.tableColumns[column_index]
27
+ end
28
+ context(column, &block)
29
+ end
30
+ alias table_column column
31
+
19
32
  end
20
33
  end
@@ -19,25 +19,6 @@ module MotionKit
19
19
  subview.removeFromSuperview
20
20
  end
21
21
 
22
- # NSViews AND CALayers are updated
23
- def reapply!(root=nil)
24
- if root.is_a?(CALayer)
25
- @layout_state = :reapply
26
- MotionKit.find_all_layers(root) do |layer|
27
- call_style_method(layer, layer.motion_kit_id) if layer.motion_kit_id
28
- end
29
- @layout_state = :initial
30
- else
31
- root ||= self.view
32
- if root.layer
33
- reapply!(root.layer)
34
- end
35
- super(root)
36
- end
37
-
38
- return self
39
- end
40
-
41
22
  end
42
23
 
43
24
  class NSViewLayout < Layout
@@ -2,17 +2,17 @@
2
2
  module MotionKit
3
3
  class NSViewLayout
4
4
 
5
- def constraints(view=nil, &block)
6
- view ||= target
7
- if view.is_a?(Symbol)
8
- view = self.get(view)
5
+ def constraints(add_to_view=nil, &block)
6
+ add_to_view ||= target
7
+ if add_to_view.is_a?(Symbol)
8
+ add_to_view = self.get_view(add_to_view)
9
9
  end
10
- view.setTranslatesAutoresizingMaskIntoConstraints(false)
10
+ add_to_view.setTranslatesAutoresizingMaskIntoConstraints(false)
11
11
 
12
- constraints_target = ConstraintsTarget.new(view)
12
+ constraints_target = ConstraintsTarget.new(add_to_view)
13
13
  deferred(constraints_target) do
14
14
  context(constraints_target, &block)
15
- constraints_target.apply_all_constraints(self, view)
15
+ constraints_target.apply_all_constraints(self, add_to_view)
16
16
  end
17
17
  end
18
18
 
@@ -20,12 +20,12 @@ module MotionKit
20
20
 
21
21
  class Layout
22
22
 
23
- def constraints(view=nil, &block)
23
+ def constraints(add_to_view=nil, &block)
24
24
  if has_context?
25
- apply(:constraints, view, &block)
25
+ apply(:constraints, add_to_view, &block)
26
26
  else
27
27
  context(self.view) do
28
- constraints(view, &block)
28
+ constraints(add_to_view, &block)
29
29
  end
30
30
  end
31
31
  end
@@ -145,7 +145,7 @@ module MotionKit
145
145
 
146
146
  def _calculate_frame(f, from: from_view, relative_to: point)
147
147
  if from_view.is_a?(Symbol)
148
- from_view = self.get(from_view)
148
+ from_view = self.get_view(from_view)
149
149
  end
150
150
 
151
151
  from_view_size = from_view.frame.size
@@ -27,55 +27,6 @@ module MotionKit
27
27
  subview.removeFromSuperview
28
28
  end
29
29
 
30
- # NSWindow doesn't have immediate children; restyle its contentView.
31
- def reapply!(window=nil)
32
- window ||= self.window
33
- call_style_method(window, window.motion_kit_id) if window.motion_kit_id
34
- context(window) do
35
- super(window.contentView)
36
- end
37
- end
38
-
39
- def get(element_id)
40
- if self.window.motion_kit_id == element_id
41
- return self.window
42
- elsif self._root == self.window
43
- self.get(element_id, in: self.window.contentView)
44
- else
45
- super
46
- end
47
- end
48
-
49
- def last(element_id)
50
- if self._root == self.window && last = self.last(element_id, in: self.window.contentView)
51
- last
52
- elsif self.window.motion_kit_id == element_id
53
- self.window
54
- else
55
- super
56
- end
57
- end
58
-
59
- def all(element_id)
60
- if self._root == self.window
61
- found = self.all(element_id, in: self.window.contentView)
62
- if self.window.motion_kit_id == element_id
63
- found << self.window
64
- end
65
- return found
66
- else
67
- super
68
- end
69
- end
70
-
71
- def remove(element_id)
72
- if self._root == self.window
73
- self.remove(element_id, from: self.window.contentView)
74
- else
75
- super
76
- end
77
- end
78
-
79
30
  end
80
31
 
81
32
  class NSWindowLayout < WindowLayout