OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "views/view.h" | 5 #include "views/view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 } | 374 } |
375 | 375 |
376 bool View::IsVisible() const { | 376 bool View::IsVisible() const { |
377 return is_visible_; | 377 return is_visible_; |
378 } | 378 } |
379 | 379 |
380 bool View::IsVisibleInRootView() const { | 380 bool View::IsVisibleInRootView() const { |
381 return IsVisible() && parent() ? parent()->IsVisibleInRootView() : false; | 381 return IsVisible() && parent() ? parent()->IsVisibleInRootView() : false; |
382 } | 382 } |
383 | 383 |
384 void View::SetEnabled(bool state) { | 384 void View::SetEnabled(bool enabled) { |
385 if (enabled_ != state) { | 385 if (enabled_ != enabled) { |
386 enabled_ = state; | 386 enabled_ = enabled; |
387 SchedulePaint(); | 387 OnEnabledChanged(); |
388 } | 388 } |
389 } | 389 } |
390 | 390 |
391 bool View::IsEnabled() const { | 391 bool View::IsEnabled() const { |
392 return enabled_; | 392 return enabled_; |
393 } | 393 } |
394 | 394 |
| 395 void View::OnEnabledChanged() { |
| 396 SchedulePaint(); |
| 397 } |
| 398 |
395 // Transformations ------------------------------------------------------------- | 399 // Transformations ------------------------------------------------------------- |
396 | 400 |
397 const ui::Transform& View::GetTransform() const { | 401 const ui::Transform& View::GetTransform() const { |
398 static const ui::Transform* no_op = new ui::Transform; | 402 static const ui::Transform* no_op = new ui::Transform; |
399 if (transform_.get()) | 403 if (transform_.get()) |
400 return *transform_.get(); | 404 return *transform_.get(); |
401 return *no_op; | 405 return *no_op; |
402 } | 406 } |
403 | 407 |
404 void View::SetTransform(const ui::Transform& transform) { | 408 void View::SetTransform(const ui::Transform& transform) { |
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1867 result.append(GetChildViewAt(i)->PrintViewGraph(false)); | 1871 result.append(GetChildViewAt(i)->PrintViewGraph(false)); |
1868 | 1872 |
1869 if (first) | 1873 if (first) |
1870 result.append("}\n"); | 1874 result.append("}\n"); |
1871 | 1875 |
1872 return result; | 1876 return result; |
1873 } | 1877 } |
1874 #endif | 1878 #endif |
1875 | 1879 |
1876 } // namespace views | 1880 } // namespace views |
OLD | NEW |