| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #library("view"); | 5 #library("view"); |
| 6 | 6 |
| 7 #import('../base/base.dart'); | 7 #import('../base/base.dart'); |
| 8 #import('../observable/observable.dart'); | 8 #import('../observable/observable.dart'); |
| 9 #import('../touch/touch.dart'); | 9 #import('../touch/touch.dart'); |
| 10 #import('dart:html'); | 10 #import('dart:html'); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 // is discarded. | 196 // is discarded. |
| 197 } | 197 } |
| 198 | 198 |
| 199 void addOnClick(EventListener handler) { | 199 void addOnClick(EventListener handler) { |
| 200 _node.on.click.add(handler); | 200 _node.on.click.add(handler); |
| 201 } | 201 } |
| 202 | 202 |
| 203 /** | 203 /** |
| 204 * Gets whether the view is hidden. | 204 * Gets whether the view is hidden. |
| 205 */ | 205 */ |
| 206 bool get hidden() => Css.getDisplay(_node.style) == 'none'; | 206 bool get hidden() => _node.style.display == 'none'; |
| 207 | 207 |
| 208 /** | 208 /** |
| 209 * Sets whether the view is hidden. | 209 * Sets whether the view is hidden. |
| 210 */ | 210 */ |
| 211 void set hidden(bool hidden) { | 211 void set hidden(bool hidden) { |
| 212 if (hidden) { | 212 if (hidden) { |
| 213 Css.setDisplay(node.style, 'none'); | 213 node.style.display = 'none'; |
| 214 } else { | 214 } else { |
| 215 Css.setDisplay(node.style, ''); | 215 node.style.display = ''; |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 void addClass(String className) { | 219 void addClass(String className) { |
| 220 node.classes.add(className); | 220 node.classes.add(className); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void removeClass(String className) { | 223 void removeClass(String className) { |
| 224 node.classes.remove(className); | 224 node.classes.remove(className); |
| 225 } | 225 } |
| 226 | 226 |
| 227 /** Sets the CSS3 transform applied to the view. */ | 227 /** Sets the CSS3 transform applied to the view. */ |
| 228 set transform(String transform) { | 228 set transform(String transform) { |
| 229 Css.setTransform(node.style, transform); | 229 node.style.transform = transform; |
| 230 } | 230 } |
| 231 | 231 |
| 232 // TODO(rnystrom): Get rid of this, or move into a separate class? | 232 // TODO(rnystrom): Get rid of this, or move into a separate class? |
| 233 /** Creates a View whose node is a <div> with the given class(es). */ | 233 /** Creates a View whose node is a <div> with the given class(es). */ |
| 234 static View div(String cssClass, [String body = null]) { | 234 static View div(String cssClass, [String body = null]) { |
| 235 if (body == null) { | 235 if (body == null) { |
| 236 body = ''; | 236 body = ''; |
| 237 } | 237 } |
| 238 return new View.html('<div class="$cssClass">$body</div>'); | 238 return new View.html('<div class="$cssClass">$body</div>'); |
| 239 } | 239 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 } | 344 } |
| 345 } | 345 } |
| 346 | 346 |
| 347 void _applyLayout() { | 347 void _applyLayout() { |
| 348 if (_layout != null) { | 348 if (_layout != null) { |
| 349 _layout.applyLayout(); | 349 _layout.applyLayout(); |
| 350 } | 350 } |
| 351 _applyLayoutToChildren(); | 351 _applyLayoutToChildren(); |
| 352 } | 352 } |
| 353 } | 353 } |
| OLD | NEW |