OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. | 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. |
6 | 6 |
7 #include "ui/views/view.h" | 7 #include "ui/views/view.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 void View::SizeToPreferredSize() { | 437 void View::SizeToPreferredSize() { |
438 gfx::Size prefsize = GetPreferredSize(); | 438 gfx::Size prefsize = GetPreferredSize(); |
439 if ((prefsize.width() != width()) || (prefsize.height() != height())) | 439 if ((prefsize.width() != width()) || (prefsize.height() != height())) |
440 SetBounds(x(), y(), prefsize.width(), prefsize.height()); | 440 SetBounds(x(), y(), prefsize.width(), prefsize.height()); |
441 } | 441 } |
442 | 442 |
443 gfx::Size View::GetMinimumSize() const { | 443 gfx::Size View::GetMinimumSize() const { |
444 return GetPreferredSize(); | 444 return GetPreferredSize(); |
445 } | 445 } |
446 | 446 |
447 gfx::Size View::GetMaximumSize() { | 447 gfx::Size View::GetMaximumSize() const { |
448 return gfx::Size(); | 448 return gfx::Size(); |
449 } | 449 } |
450 | 450 |
451 int View::GetHeightForWidth(int w) const { | 451 int View::GetHeightForWidth(int w) const { |
452 if (layout_manager_.get()) | 452 if (layout_manager_.get()) |
453 return layout_manager_->GetPreferredHeightForWidth(this, w); | 453 return layout_manager_->GetPreferredHeightForWidth(this, w); |
454 return GetPreferredSize().height(); | 454 return GetPreferredSize().height(); |
455 } | 455 } |
456 | 456 |
457 void View::SetVisible(bool visible) { | 457 void View::SetVisible(bool visible) { |
(...skipping 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2535 // Message the RootView to do the drag and drop. That way if we're removed | 2535 // Message the RootView to do the drag and drop. That way if we're removed |
2536 // the RootView can detect it and avoid calling us back. | 2536 // the RootView can detect it and avoid calling us back. |
2537 gfx::Point widget_location(event.location()); | 2537 gfx::Point widget_location(event.location()); |
2538 ConvertPointToWidget(this, &widget_location); | 2538 ConvertPointToWidget(this, &widget_location); |
2539 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2539 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
2540 // WARNING: we may have been deleted. | 2540 // WARNING: we may have been deleted. |
2541 return true; | 2541 return true; |
2542 } | 2542 } |
2543 | 2543 |
2544 } // namespace views | 2544 } // namespace views |
OLD | NEW |